Can I force to get the state of an MQTT light?
When the light power is switched off, it takes about 30 seconds for the ‘button’ to go to offline. Can I force that the status will be controlled earlier (via a script)?
Can I force to get the state of an MQTT light?
When the light power is switched off, it takes about 30 seconds for the ‘button’ to go to offline. Can I force that the status will be controlled earlier (via a script)?
Possibly. Share your light configuration YAML.
I don’t understand exactly what you want to see.
When I press the button (to turn off the lamp), a script is started, which first adjusts the lamp to normal light. Then it checked which position the relay* has and then the correct coil is pulsed and the lamp power switched off.
I want to see your light configuration. Or is it a discovered entity?
It’s a discovered entity. (tasmota)
Then try using the homeassistant.update_entity
service on your light entity after changing it.
Thanks, what I have tried:
Run actions (by hand) after power off the light
alias: TEST update
description: ""
triggers: []
conditions: []
actions:
- action: homeassistant.update_entity
target:
entity_id:
- light.tasmota_kitchen
mode: single
and check the state in:<home-assistant.local>/developer-tools/state > light.tasmota_kitchen
After starting the automation manually (several times), the status of the lamp was still ON while the power was off.
Isn’t this because the MQTT broker itself doesn’t want to or can’t force the update?
It is entirely possible to implement refresh logic using MQTT messages, but I do not think many integrations do. Most probably rely on the retain mechanism of the MQTT server.
Ok, I think I’ll make a fake state