You can check app settings.
Shellies you can configure on the web interface, what their state should be after power loss.
Bneta is a hit/miss in the tuya app. If flashed to tasmota there is a setting on the web interface.
For HA automations, I went overboard to fix this issue you have. I literally have an automation running every minute checking light states, or rather, just setting them to the state they should be.
See:
https://github.com/tinuva/home-assi...e5c7503fa/packages/lights/lights_outside.yaml
2 samples:
Code:
automation:
## Whole night
- alias: "Turn on outside lights and check every minute - whole night"
trigger:
- platform: time_pattern
# You can also match on interval. This will match every x minutes
minutes: "/1"
condition:
condition: or
conditions:
- condition: sun
after: sunset
#after_offset: "00:20:00"
- condition: sun
before: sunrise
#before_offset: "-00:20:00"
action:
- service: light.turn_on
entity_id:
- light.lights_whole_night
## Whole day
- alias: "Turn off outside lights and check every minute - whole night"
trigger:
- platform: time_pattern
# You can also match on interval. This will match every x minutes
minutes: "/1"
condition:
condition: and
conditions:
- condition: sun
after: sunrise
#after_offset: "-00:20:00"
- condition: sun
before: sunset
#before_offset: "00:20:00"
action:
- service: light.turn_off
entity_id:
- light.lights_whole_night