Simple rule to check if all lights are off when Mode changes to Night

Hi all

I'm not a great lover of dashboards, as I try to get my home automation to be as automatic as possible. The following is a straightforward rule that I've created in Rule Machine to check if my lights & devices have obeyed my Good Night command via Alexa and if not to give a verbal warning. I thought I would share in case, anyone else would find this useful.

Some context:
I have an Alexa routine that is triggered by the voice command 'Good Night'. This routine changes the Mode to Night and turns off all my internal lights within Hubitat and turns off my wi-fi external lights and pond pump.

Sometimes, when I get up in the morning, I find that one or more lights have failed to turn off and I then have to manually turn these off. Normally these are wi-fi external lights.

After I have triggered the Good Night routine, I would like a warning in my main bedroom if any lights failed to switch off.

I have an instance of Home Assistant running on a Raspberry Pi which I have linked to my HE, via the User App - Home Assistant Device Bridge. This enables the wi-fi devices to be added to HE without any other driver code and I use HE to control all automations.

I then created a Group within HE>Groups & Scenes for three Zones: Zone One - Living Area; Zone Two - Sleeping Area; and Zone 3 - Outside. As well as adding the devices from the relevant areas to each group, I have also selected the following options within each Group set-up:

  1. Use group device to indicate if any members are on;
  2. Show group state in group device


I then created a rule that checked Zone 1 and 3 to ensure that everything was turned off and if not write to the log and issue a verbal warning, if not the case:

I hope someone may find this useful :slight_smile:

I needed something similar and did it like this:

It just notifies after we think we've locked up for the night and before we're likely to be asleep. After that of course it leaves us to check the dashboard to see what device is not as it should be :smiley:


A much simpler solution than mine! :slight_smile:

Some additional requirements I should have mentioned:

  1. I have about 20/30 devices that I check and so wanted an approach to changing the scope without amending the rule in Rule Machine. Although I still need to amend the Group...

  2. I'm also trying to bring about Zoning as a condition in addition to Mode going forward for some rules and so this is a foundation for further work;

  3. I wanted the rule to be checked just before we go to bed rather than at a specific time in the evening.

We're very old and routine-bound so the time really doesn't need to be variable :slight_smile:


If not allOff, I'd resend the Off, wait a bit and recheck if not allOff (perhaps loop a couple of times) before speaking the notification.


Hi @ChrisP

Good idea! Originally, I wanted this to flag an issue so that I could investigate further but this seems to be worth a try. Although, I often I have to use the native app (e.g. SmartLife) to force the device to off.

For some reason, the group state doesn't change back to allOff from someOn after the Group is switched to Off. So I can't check if the forced Off is working - This is the case even after I've checked that all switches and bulbs are off in their individual Device records. :upside_down_face: