Underestimating laziness as a virtue!

Hi Folks,

I am not sure the exact nature of my request so could not put more specific tags but here is a low down on my situation.

As automation starts working, I’m surprised at my own ability to forget stuff, largely thanks to @frenck video that helped me refactor code, here is a great primer if you have not seen it yet - Understanding YAML as it's used in Home Assistant Config files - YouTube

After watching the above video, I started doing three things:

  1. Take a backup before start of any new experiment
  2. Work on one single problem, if it works refactor the code to its folder/file structure. So my configuration.yaml, automation.yaml etc only have the testing in progress stuff &nothing else
  3. At the end of the day, if I’m not productive restore the backup from 1) and sleep peacefully :grinning:

Now here is the problem about the stuff that actually starts working, I just tend to forget its there. For example, I created a group to monitor all the reed switches, then added an automation to notify me if any of boards are offline, then added few Zigbee devices where running a wire was not feasible, then created automation to monitor batteries for Zigbee devices and so on. So 6-months later when I decide to add one more reed switch on the liquor cabinet when kids turn 12 (just kidding!), I may not remember all of the above trails of groups and automation etc.

As I add another device say a Sonoff S31 flashed with ESPHome, it would be nice if I am asked few additional questions (besides Zone) if this device or its entities needs to be added to groups at the time of adding it to the integration.

I just learnt the hard way that S31 i installed on the dryer was not added to the group monitoring the WiFi signal strength and automation kept failing.

Just my two cents!!

Instead of adding devices to monitor to a group, you could monitor devices based on attributes instead of group membership. this is how i check if my devices are offline:

sensor:
  - platform: template
    sensors:
      # devices offline
      number_devices_offline:
        friendly_name: Devices offline
        unique_id: 093B1671-0652-40C4-AF2F-D9E50E7EBC22
        unit_of_measurement: "Devices"
        value_template: >-
            {{ states 
              | selectattr('attributes.device_class', 'eq', 'connectivity') 
              | selectattr('state', 'in', ['off','unavailable'])
              | map(attribute='entity_id') 
              | list 
              | count
            }}

This should work with device_class: signal_strength, too.

1 Like

It works only in theory as not all devices (or their states) are equal. For instance the contact sensor for front door not working is lot more severe than a printer offline cos my wife pulled the printer power cord to plug in vacuum cleaner.

Thanks.

One feature I really like in firewall’s UI is “Aliases” where I can create logical combinations using IP Address, host names or sub-nets and even add descriptive notes like “192.168.1.10: Office Laptop”.

Groups are nothing but "aliases’ in HA so I usually combine them logically like Sonoff Slamphers, Sonoff Basic, S31 and so on.