Is there any way to intentionally publish an “unknown” value to Home Assistant?
Context: when my kettle is off the base, there is no way to know what its temperature really is.
While I am avoiding publishing any new data in this situation by using {}, HA continues to trust and display the last value, and shows a flat line graph in the history.
Here’s what I have,
tuya:
# These datapoints need to publish here, otherwise ESPhome will convert them to a float by the time they reach the entity's on_raw_value
on_datapoint_update:
- sensor_datapoint: 19 # problem bitfield
datapoint_type: bitmask
then:
- binary_sensor.template.publish:
id: kettle_absent
state: !lambda 'return (x & 0x02);'
sensor:
- id: current_temperature
name: "Current Temperature"
platform: tuya
sensor_datapoint: 2
device_class: temperature
unit_of_measurement: °C
filters:
- lambda: |-
if (id(kettle_absent).state) return {};
return x;
binary_sensor:
- id: kettle_absent
name: "Kettle Absent"
platform: template
What I’d ideally like to add is something like “on_value → then → water_heater.template.publish → UNKNOWN_VALUE”.