Share sensor value between Home assistant and espeasy

Hello all !

To initialize a pulse counter that is installed for a water meter, attached to a espeasy unit, I need to pull a start value from Home assistant during the espeasy boot.
The retain flag for the HA sensor is unfortunately no longer an option since 0.87 update, i’m then stuck for espeasy to get the initial counter value at boot (using mqtt import plugin).
If anyone would know a solution to pull this value from HA…

Thanks

Not sure what you mean.
You can use the mqtt.publish service with the retain flag

Hi,
In fact, if the mqtt sensor was defined as retained in my mqtt.yaml file, its value would be automatically loaded into the espeasy mqtt_import plugin at boot time.
( It works fine with mqtt switches being defined as retained in HA ).
Unfortunately, defining retain flag to true in the yaml file throws an error since it is no longer accepted by HA 0.87 update.

I’m in the need to get this value in espeasy when it boots up, without having to send a publish command.

I hope I did somehow make it more clear…[quote=“peces12, post:1, topic:634411, full:true”]
Hello all !

To initialize a pulse counter that is installed for a water meter, attached to a espeasy unit, I need to pull a start value from Home assistant during the espeasy boot.
The retain flag for the HA sensor is unfortunately no longer an option since 0.87 update, i’m then stuck for espeasy to get the initial counter value at boot (using mqtt import plugin).
If anyone would know a solution to pull this value from HA…

Thanks
[/quote]

The post you mention is about creating a MQTT sensor in HA, so using MQTT as input.

Unless I misunderstand, you want HA to output / publish a value to MQTT, so that espeasy can read it. You have to use the mqtt.publish HA service to do so.
You’d typically use that service in an automation that would trigger on the state of whatever HA sensor holding the actual value.

Please do read the doc here: