I’ve a TRADFRI gateway from Ikea.
If the gateway is restarted (e.g.: power outage) after home assistant, all the related lights/switch/… are unavailable and/or in an inconsistent state. But in any case, unresponsive until a restart.
I can detect the restart of the gateway through a monitored switch that detect the drop in the power consumption. I’d like to create an automation to “restart the ikea integration” upon detection of the restart.
Today, I’m just conditioning a card based on that detection, means I’m hiding everything ikea related. Moreover, I’m creating a persistent notification to alert the user so (s)he can restart HA.
That would be so much beter to restart ikea integration if possible.
Do you think of something that could help me?
- id: '1644234294010'
alias: Gateway TRADFRI - Power drop
description: ''
trigger:
- platform: state
entity_id: switch.tradfri_switch
attribute: energy_meter
action:
- service_template: '{% if state_attr(''switch.tradfri_switch'', ''energy_meter'') < 0.5
%} input_boolean.turn_off {% else %} input_boolean.turn_on {% endif %}
'
entity_id: input_boolean.tradfri
mode: single
As this automation is switching an input_boolean to on or off (if drop occured or not), I did build an automation triggering the notification (and the card is conditionned on the input_boolean as well)
- id: '1644245622351'
alias: TRADFRI Alert
description: ''
trigger:
- platform: state
entity_id: input_boolean.tradfri
to: 'off'
from: 'on'
action:
- service: persistent_notification.create
data:
message: Please restart HA, Tradfri GW lost sync
mode: single
This is the latest that I want to extend to restart the ikea integration (instead of a home_assistant restart, which is also possible but that I want to avoid)