I have this code I want to use in my boat to receive trim state from my outboard motor from Node-RED (originating from NMEA2000). It's important that the number does not "live" too long, because if I turn off the ignition the engine interface that sends NMEA2000 is turned off, and any changes, like trimming/tilting the engine to the top, will not be read. It will still show as being where it was when I turned off the ignition. I am using the trim state (100-0, if I remember correctly) as a condition in a template switch that controls the jackplate on the boat.
But the sensor does not expire in the webserver GUI or in the ESP internally, it is read as the last value until I do a reboot of the ESP.
This may of course be me misunderstanding the workings of this sensor, but expire_after is obviously a valid option, because when I tried set_expire_after I got this:
[set_expire_after] is an invalid option for [sensor.mqtt_subscribe]. Did you mean [expire_after]?
The problem
I have this code I want to use in my boat to receive trim state from my outboard motor from Node-RED (originating from NMEA2000). It's important that the number does not "live" too long, because if I turn off the ignition the engine interface that sends NMEA2000 is turned off, and any changes, like trimming/tilting the engine to the top, will not be read. It will still show as being where it was when I turned off the ignition. I am using the trim state (100-0, if I remember correctly) as a condition in a template switch that controls the jackplate on the boat.
But the sensor does not expire in the webserver GUI or in the ESP internally, it is read as the last value until I do a reboot of the ESP.
This may of course be me misunderstanding the workings of this sensor, but expire_after is obviously a valid option, because when I tried set_expire_after I got this:
Which version of ESPHome has the issue?
2023.12.9
What type of installation are you using?
pip
Which version of Home Assistant has the issue?
No response
What platform are you using?
ESP32
Board
esp32-VROOM-32D
Component causing the issue
mqtt_subscribe sensor
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response