Hello list,
Devices I created in HA work fine, but their initial state is “Unknown”. Therefore I wrote a shell script that sets all “Unknown” values to something else, like “Clear” for a PIR and “Closed” for a door and 0.000 for a temperature indicator (using mosquitto_pub):
mqtt:
sensor:
- name: "ha_temp01"
state_topic: "home/hbs/ha_temp01"
device_class: "temperature"
unit_of_measurement: "°C"
unique_id: "sensor_ha_temp01_202412081223"
binary_sensor:
- name: "pcf PIR BG"
state_topic: "pcf8574/0x38/5/contact"
payload_on: "_0"
payload_off: "_1"
qos: 0
device_class: motion
value_template: "{{ value_json.state }}"
I tried several syntaxes but the validator definitly says “no”. Is there a simple way to add fixed initial values?
R.