I have an MQTT sensor that is configured like this:
sensor:
- platform: mqtt
state_topic: "Temp1/Salon/Temperature"
name: "salon_temperature"
unit_of_measurement: "°C"
expire_after: 180
availability_topic: "Temp1/status"
payload_available: "Online"
payload_not_available: "Offline"
and a template sensor that I use to callibrate readings:
- platform: template
sensors:
temperatura_salon:
friendly_name: "Salon"
unit_of_measurement: '°C'
value_template: >-
{{ states.sensor.salon_temperature.state | float - 1.9 }}
The MQTT sensor works fine, but I have weird picks on history charts for the template sensor:
This is best visible in the history panel:
I’m using Wemos D1 with ESPEasy and DS18B20 to read the temperature. The wifi is stable but I noticed that sometimes I get Offline
message on LWT topic, but for a short period of time.
Can I modify the template sensor is such a way that it won’t report -1.9
as the value when the sensor won’t be available?
I’d like to avoid removing the availability_topic
from MQTT sensor and do the work in template sensor.