Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 96121

Restore lights to status they had before power outage

$
0
0

@acme wrote:

Hello all.
Where I leave we have many power failures and when power comes back, all lights (yeelight bulbs and ceiling lights) turn on.
I am trying to find a way to handle it.
I have a shelly plug and I was thinking to make the below automation.

- alias: Auto close Lights after power failure
  initial_state: true
  trigger:
  - platform: state
    entity_id: switch.shelly_tv_plug
    from: unavailable
    to: 'on'
  condition: []
  action:
  - delay: 00:01:00
  - data:
      entity_id: group.all_lights
    service: light.turn_off
  - service: notify.mobile_app_mi_mix_3
    data_template:
      message: '{{states.sensor.counter_lights_on.state}} lights turned off 1'

(I have created a group for all the lights and a sensor that counts how many lights are on.)

I run HA in NUC which is plugged in UPS.

The issues that I found with the above automation, are:

  • If the power outage lasts longer than what UPS can stand, automation will not work.
  • I would prefer to check the status of lights when pluged turned to unavailable and return lights to the same status, 1 minute after status of plug changes to ‘on’. I say 1 minute so as to be sure that all devices are connected to the network.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 96121

Trending Articles