Skip to content

Error MQTT status unknown when listening mqtt pwsmqttdispatcher #49

@Doudy

Description

@Doudy

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 ↗️ emoticon in 'windDirCardinal' which was the source of the error.
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions