Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error MQTT status unknown when listening mqtt pwsmqttdispatcher #49

Open
Doudy opened this issue Dec 24, 2024 · 0 comments
Open

Error MQTT status unknown when listening mqtt pwsmqttdispatcher #49

Doudy opened this issue Dec 24, 2024 · 0 comments

Comments

@Doudy
Copy link

Doudy commented Dec 24, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant