Is there a way to write an automation to say, “keep trying to turn this group on until it really ends up on”? Here’s my problem…
I have my landscape lighting on a couple of SmartLife WiFi smart plugs, and am using automation to turn them on 20 minutes before sunset and off at sunrise. Most of the time it works great, but once or twice a week it seems like one or the other of the plugs will miss one of the automation events, and will remain on (or off) when it shouldn’t be.
The weird thing is, when I check HA after noticing a problem, it has the correct status for the plug. That is, if it should have turned off, but in fact remained on, HA will accurately show it as “on”.
I’m guessing maybe there are momentary network (or Tuya server) glitches that cause some events not to make it through. Is there a better way to code the automations? Say, so that they keep asking the switch to turn off until it really ends up off? Or some other way I could be approaching this?
Here’s the relevant parts of my config:
configuration.yaml
# ...
tuya:
username: !secret smart_life_username
password: !secret smart_life_password
country_code: 1
platform: smart_life
groups.yaml
exterior_lights:
name: Exterior lights
entities:
- switch.front_porch_light
- switch.front_landscape_lights
- switch.rear_landscape_lights
automations.yaml
- alias: Exterior lights on at dusk
initial_state: True
hide_entity: True
trigger:
platform: sun
event: sunset
offset: "-00:20:00"
action:
service: homeassistant.turn_on
entity_id: group.exterior_lights
- alias: Exterior lights off at dawn
initial_state: True
hide_entity: True
trigger:
platform: sun
event: sunrise
action:
service: homeassistant.turn_off
entity_id: group.exterior_lights
Thanks for any help and suggestions.
[Home Assistant 0.83.3; HassOS 1.12 on Raspberry Pi]