I have a template sensor where the value_template is set to extract the value from value_json… however since this is a MQTT based sensor it is possible that there has been no value after a restart of the system. I am wondering how to set a default value here if there is not yet a value set through mqtt. I don’t necessarily want a retained value here since this sensor is not actually always available, so for me it makes more sense to default it to 0. Sensor definition is below.
sensor:
- platform: mqtt
name: "Smoker Temp 1"
state_topic: "smoker/temp1/temperature"
value_template: "{{ value_json.value }}"
unit_of_measurement: 'F'