Closed Sakke64 closed 10 months ago
Is there way to read and publish and entity (switch, sensor, ...) state to the MQTT broker asynchronously i.e. not based on entity state change but an external trigger? There is, for example, node "current state" node in the node-red-contrib-home-assistant-websocket palette for such reading. Unfortunately, my node-red installation is not on the HA machine but on the plain RPi OS client machine. So, is this possible one or other way for entitity nodes created by the node-red-contrib-ha-mqtt? Actual problem is, the HA on the other machine looses entities state always after some time period. Some sensors like temperature ones one updated regular way and state is maintained, but for example switches and numbers state are not updated on the client machine. For sure I can build some tricks to store states locally and update entities w/ a current state, but I'l like to use more elegant way. This is also some relatated to my other issue about the retain flag. I guess if retain flag would be supported, HA would maintain entities state, but I'm not 100% sure.
After restarting HA, there will indeed be a loss of entity status, which is caused by my mandatory specification of the retain flag. I will address this issue in future versions and let users choose their own implementation method
Hi! Thank you, I'd appreciate if retain flag can be set per topic in the future. It seems entities state is lost in the HA even the HA do not restart. There is some other constraint (time, mqtt broker behaviour, ...?) what causes state loss in the HA. One odditional questions, where a node-red-contrib-ha-mqtt entity state is stored when the HA is not installe on the same machine? Is it possible to some way read an entity state from a memory?
This node does not store state, and by default, restarting HA will lose all states. But you can use the discovery
node to solve the problem of lost configuration. It subscribes to homeassistant/status
and will reconfigure everything when it receives an online
message sent by HA
You mean Auto Discovery node? I'm using it already, but it doesn't help. That's why I'm thinking problem is not on the HA side.
The new version has been fixed, check 'retain' in the device
After one day, it seems this fix works perfectly so far! States has never been completely available after a night before this fix but now they are. Thank you very much!
I just bought you a cup of coffee, or tea if you prefer, with a cake! :)
Is there way to read and publish and entity (switch, sensor, ...) state to the MQTT broker asynchronously i.e. not based on entity state change but an external trigger? There is, for example, node "current state" node in the node-red-contrib-home-assistant-websocket palette for such reading. Unfortunately, my node-red installation is not on the HA machine but on the plain RPi OS client machine. So, is this possible one or other way for entitity nodes created by the node-red-contrib-ha-mqtt? Actual problem is, the HA on the other machine looses entities state always after some time period. Some sensors like temperature ones one updated regular way and state is maintained, but for example switches and numbers state are not updated on the client machine. For sure I can build some tricks to store states locally and update entities w/ a current state, but I'l like to use more elegant way. This is also some relatated to my other issue about the retain flag. I guess if retain flag would be supported, HA would maintain entities state, but I'm not 100% sure.