My Home Assistant setup - comments/suggestions welcome!

PilgrimToHyperion

Expert Member
Joined
Jul 4, 2009
Messages
1,105
Reaction score
71
My wife leaving the garage door open too often led me to install HA about 10 months ago. Since then, I've been adding everything around the house to HA as far as I can. Looking to always integrate more. This is addictive!

I'm looking for feedback (positive or critical) on this setup. What else should I add, change etc. I'll gladly share code as well, but I'm pretty sure it ain't pretty! :P

I've made everything mobile friendly as far as possible as we use HA from our phones 95% of the time. Even the wife likes the setup so far! :D

Hardware
----------
Alarm - Paradox
Inverter - Goodwe
Switches and light switches - Sonoff
Cameras - Hikvision
Irrigation - Rainbird
Speakers - Google Nest / Mini
Vacuum - Xiaomi Mi Mop Pro
Aircons - Broadlink RM4 mini

Some of the more sensible automations I've done include:
* Aircons - Switching them off after loadshedding is over as they tend to resume on power restore. Working on more use cases based on temperature, proximity, presence sensors.
* Alarm - Notifies on events like low batteries, supervision problems, triggers, bypasses, cameras take snapshots on certain events.
* Lights - Perimeter lights or a variation thereof switch on when the alarm or entry delays are triggered, gate is opened after dark, anyone walks around the house and the alarm (disarmed) sensors detect them (night, so no more need for a flashlight!). Switch on all lights with one button from main bedroom. Based on temperature outside, switches on dogs' infrared kennel light. Kids' lights controlled based on whether we're home, time of day and whether they're in their rooms or not.
* Proximity - Notified on wife's arrival at work or kids at school.
* Gate Bell - Notified if gate bell is rung with a pic of who is at the gate.
* Geyser - Toggles geyser based on SOC%, time of day etc. Takes loadshedding into consideration.
* Inverter- Loadshedding alerts, mode changes.
* Vacuum cleaner - It sometimes gets stuck. Alerts me so I can go kick it.

Some mobile dashboards
----------------------------

Dynamic greeting and uptime
Gate and garage control
Gate camera
Partitions that triggered alarm or caused entry delays.
Alarm partitions activation/deactivation
Grid status and alarm bypass status
Battery depletion time
Load shedding
1669200279871.png

Light actions - local light, perimeter lights etc.
Recording actions - record 30s, 1min, 2min
Using WebRTC so minimal latency +/- 100ms.
Icons are not centered here, but on mobile they are.
1669200308311.png

Inverter stats
Change inverter mode and DOD%
Custom sensors e.g., essentials vs non-essentials, PV% today etc.
1669200419473.png

Atmospheric dash
1669200466250.png

Tracks the family's distance from home and their current location.
1669200549146.png

Custom built irrigation dashboard used with a Rainbird LNK2.
1669200602194.png

Tries to intimidate intruders and the dogs barking at the moon with
sound clips.
1669200642040.png

Room cleaning
Settings adjust
Mop status :D
1669200709718.png

Custom dashboard
1669200775259.png

Planned:
* Better cameras.
* Frigate integration (Google Tensorflow).
* Weather station.
* Replace all light switches in the house with smart ones.
* Smart led strips for kitchen and hallway.
* Moisture sensors for further irrigation automation
* Switch TV on and cast cameras on alarm trigger etc.

Looking forward to feedback.
 

Attachments

  • 1669200391732.png
    1669200391732.png
    50.1 KB · Views: 33
Get HA running (I ran it in VirtualBox for a while), try to integrate anything you have in your home and play with that, creating dashboards and some basic automation like switch it on/off at specific times. Then when your comfy, add more. Before you buy new things, check that they're compatible with HA. That's how I started off. I've been really lucky that almost all of the things I had in the house were compatible with HA.

If you don't have anything that you can integrate now, buy a cheap sonoff switch and add that. Also install the HA companion app on your phone. Once you see your work in there, HA really starts to shine. Good luck!
 
What are you running HA on now? I have a Paradox alarm system I can integrate at the moment, will have to figure that out though, but I'm planning on doing something similar to what you've done
 
wow, even an "annoy dogs" option!
Lol, yeah! The dogs had this thing where they went into the rose garden to dig holes. That switch makes the rose garden sprinklers come on every 30mins for a minute. They don't like the wet plants much.
 
Wow! this is great.

Do you have any security in place for this setup? I mean if anyone was to gain access to this would do a lot of damage.
 
Wow! this is great.

Do you have any security in place for this setup? I mean if anyone was to gain access to this would do a lot of damage.
Thank you! I use SSL and 2FA in HA. On my router I have IPS enabled which should help a little. Where possible I'm running all the integrations local e.g. Sonoff devices, the alarm, cameras etc. can't get to the internet. There's literally one port open to the internet. I'm sure there's some clued up people than can probably find an exploit, but hoping that doesn't happen.

Will be sort of funny though if someone somehow gets control and starts opening my gate/garage randomly and switches on my lights in the middle of the night. I watched Poltergeist as a kid, so I'll probably just move out and then burn the f-er down!
 
My wife leaving the garage door open too often led me to install HA about 10 months ago. Since then, I've been adding everything around the house to HA as far as I can. Looking to always integrate more. This is addictive!

I'm looking for feedback (positive or critical) on this setup. What else should I add, change etc. I'll gladly share code as well, but I'm pretty sure it ain't pretty! :p

I've made everything mobile friendly as far as possible as we use HA from our phones 95% of the time. Even the wife likes the setup so far! :D
Say thank you to your wife, without her, this setup would not have happened.
 
This is impressive and well laid out.

Instead of opening a port Have a look at wireguard or tailscale vpn. Both are free and give you a bit more security

Would be interested to find out how you did the "the batteries will last for x time given the current load"... you open to sharing some yaml?
 
Thank you.

I'll definitely read up on those. Haven't encountered them yet.

I have these custom sensors:

YAML:
- platform: template
  sensors:
    soc_battery_depletion_seconds_backup_circuit:
      friendly_name: "Battery Depletion Seconds - Backup Circuit"
      unit_of_measurement: Seconds
      value_template: "{{ (((states('sensor.battery_state_of_charge') | float * 9.6 * 10) - 960 - 60) / ((states('sensor.back_up_power')) | float) * 60 * 60 ) | timestamp_custom('%s', 0)}}"
      
      - platform: template
  sensors:
    soc_battery_depletion_backup_circuit_formatted_no_ago:
      friendly_name: "Battery Depletion No Ago - Backup Circuit"
      value_template: >
        {% set time = states('sensor.soc_battery_depletion_seconds_backup_circuit') | int %}
        {%- set minutes = ((time % 3600) // 60) %}
        {%- set minutes = '{} minutes'.format(minutes) if minutes > 0 else '' %}
        {%- set hours = ((time % 86400) // 3600) %}
        {%- set hours = '{} hours, '.format(hours) if hours > 0 else '' %}
        {%- set days = (time // 86400) %}
        {%- set days = '{} day, '.format(days) if days > 0 else '' %}
        {{ 'Less than 1 minute' if time < 60 else days + hours + minutes }}
 
Last edited:
I never added the card yaml @Mzezman , hope it helps:

YAML:
type: custom:mushroom-title-card
title: ''
alignment: center
subtitle: >-
  Battery will deplete in {{
    states('sensor.soc_battery_depletion_backup_circuit_formatted_no_ago') }} at current essentials ({{states('sensor.back_up_power') }}W) load if grid fails.

  {{ state_attr('calendar.loadshedding', 'message') }} {{
  (state_attr('calendar.loadshedding', 'start_time') | as_datetime |
  as_local).strftime("%H:%M") }} - {{ (state_attr('calendar.loadshedding',
  'end_time') | as_datetime | as_local).strftime("%H:%M") }}
 
value_template: "{{ (((states('sensor.battery_state_of_charge') | float * 9.6 * 10) - 960 - 60) / ((states('sensor.back_up_power')) | float) * 60 * 60 ) | timestamp_custom('%s', 0)}}"
Hi Pilgrim,
Looks amazing!
Can you maybe explain the logic for the above?
How does the xxx * 9.6 * 10 work, does this relate to battery KW rating or Ah or what?
Would love to use on my HA, but don't quite understand.
 
Hi Pilgrim,
Looks amazing!
Can you maybe explain the logic for the above?
How does the xxx * 9.6 * 10 work, does this relate to battery KW rating or Ah or what?
Would love to use on my HA, but don't quite understand.
The 9.6 would correspond to the kwh rating of your battery bank.
 
Hi Pilgrim,
Looks amazing!
Can you maybe explain the logic for the above?
How does the xxx * 9.6 * 10 work, does this relate to battery KW rating or Ah or what?
Would love to use on my HA, but don't quite understand.
Hello!

Oh boy, that's bad. Lol! Probably a very late night when I did that. Don't know why I did it like that and it doesn't make much sense except that I needed to multiply by 10 or it would give me 480 instead of 4,800 at 50% SOC.

I've just redone it and it can probably be made way better by other people :D

YAML:
{{ ((((states('sensor.battery_state_of_charge') | float /100) * 9600) - 960 - 60) / ((states('sensor.back_up_power')) | float) * 60 * 60 ) | timestamp_custom('%s', 0)}}

Btw, just some clarification for the manually entered numbers:
* /100 is to get the SOC% to a number. I think that's where things went south in the previous code.
* 9600 is my total battery capacity in watts. The Goodwe integration doesn't have an entity that has this value.
* 960 is 10% of my battery that I cannot use due to the battery having a max DOD of 90%.
* the 60 is what I think my inverter self uses.

I subtract the 960 and 60 to get me closer to an accurate number of what is really available for use.

Hope this helps!

EDIT

Just to add if it wasn't clear. I divide by the backup usage (connected to backup circuit) only because the rest of the load will disappear in case of loadshedding / power failure.
 
Hi, what weather provider are you using? The default gives me very inaccurate data for Pretoria.
 
Hello!

Oh boy, that's bad. Lol! Probably a very late night when I did that. Don't know why I did it like that and it doesn't make much sense except that I needed to multiply by 10 or it would give me 480 instead of 4,800 at 50% SOC.

I've just redone it and it can probably be made way better by other people :D

YAML:
{{ ((((states('sensor.battery_state_of_charge') | float /100) * 9600) - 960 - 60) / ((states('sensor.back_up_power')) | float) * 60 * 60 ) | timestamp_custom('%s', 0)}}

Btw, just some clarification for the manually entered numbers:
* /100 is to get the SOC% to a number. I think that's where things went south in the previous code.
* 9600 is my total battery capacity in watts. The Goodwe integration doesn't have an entity that has this value.
* 960 is 10% of my battery that I cannot use due to the battery having a max DOD of 90%.
* the 60 is what I think my inverter self uses.

I subtract the 960 and 60 to get me closer to an accurate number of what is really available for use.

Hope this helps!

EDIT

Just to add if it wasn't clear. I divide by the backup usage (connected to backup circuit) only because the rest of the load will disappear in case of loadshedding / power failure.

Many thanks, now I understand and can hopefully get my number right. Will also use essentials side only on the second part.
 
Top
Sign up to the MyBroadband newsletter
X