generated from home-assistant/addons-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
configuration.yaml
mqtt:
sensor:
- name: "Indoor temperature"
unique_id: 6b464994-96b2-11ee-b9d1-0242ac120002
state_topic: "pwsmqttdispatcher/json"
value_template: "{{ value_json.temperatureIndoor | float }}"
unit_of_measurement: "°C"
state_class: measurement
with this syntax I had an unknown status error
So I did some research, and it was the
chatgpt helped me a lot
The solution:
mqtt:
sensor:
- name: "Indoor temperature"
unique_id: "6b464994-96b2-11ee-b9d1-0242ac120002"
state_topic: "pwsmqttdispatcher/json"
unit_of_measurement: "°C"
value_template: >
{% set message = value | replace('↗️', '') | replace('NaN', 'null') %}
{% set json_data = message | from_json %}
{{ json_data['temperatureIndoor'] | default('N/A') }}
That's it, if it helps
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels