Mqtt rflink problem

hello, i have a problem with 1 sensor wind from Oregon. In my log i have this :

2020-08-12 20:45:05 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on rflink/Oregon_Wind-1AFE: b'{"WINDIR":0003,"WINGS":4.6,"WINSP":4.6,"BAT":"OK"}

and in my configuration.yaml :

#Oregon Wind
- platform: mqtt
  name: 'Oregon wind wings'
  state_topic: "rflink/Oregon_Wind-1AFE"
  unit_of_measurement: 'ms'
  value_template: "{{ value_json.WINGS }}"
- platform: mqtt
  name: 'Oregon wind wind speed'
  state_topic: "rflink/Oregon_Wind-1AFE"
  unit_of_measurement: 'ms'
  value_template: "{{ value_json.WINSP }}"
- platform: mqtt
  name: 'Oregon wind battery'
  state_topic: "rflink/Oregon_Wind-1AFE"
  value_template: "{{ value_json.BAT }}"
- platform: mqtt
  state_topic: "rflink/Oregon_Wind-1AFE"
  name: 'Oregon wind direction'
  unit_of_measurement: '°'
  value_template: "{{ value_json.WINDIR }}"

but i have a unknown in home assistant lovelace card. Anyone have an idea ?

Your sensor appears to be putting out JSON format data to HA… do you have an entity for this? You can look in dev/states to verify the entity name if it exists.

For example, I have an arduino nano plugged to my pi usb, which sends data to HA as a serial_sensor. The resulting entity, sensor.serial_sensor has JSON data for it’s state, which looks exactly like this {"battery":912,"mains":854,"bell":11,"brick":1019}. To use this JSON formatted data in HA, you can use templates that look like this:

  - platform: template
    sensors:
      mains_power:
        friendly_name: 'Mains Power'
        value_template: >
          {% set level = state_attr('sensor.serial_sensor','mains') | int %}
          {% if level >= 500 %}
            on
          {% else %}
            off
          {% endif %}

This gives me an entity called sensor.mains_power, which turns on or off depending on the value. I add 3 more templates like that to use battery, bell, and brick data as well. If I want to read a floating point number like you would have to do, it would look like this:

  - platform: template
    sensors:
      backup_battery:
        friendly_name: 'Backup Battery'
        value_template: >
          {{ set level = state_attr('sensor.serial_sensor','battery') | float }}

That should work. You put it under

sensor:

and restarted HA after putting it in configuration.yaml ?

And you do only have sensor: once ?

And as said : You can look in developer tools -> states to verify the entity name if it exists.

no, the problem is 0 leading in windir…

Try :

- platform: mqtt
  state_topic: "rflink/Oregon_Wind-1AFE"
  name: 'Oregon wind direction'
  unit_of_measurement: '°'
  value_template: "{{ value_json.WINDIR  | int  }}"

i have tested this and not working :sob:

Then try this :

- platform: mqtt
  state_topic: "rflink/Oregon_Wind-1AFE"
  name: 'Oregon wind direction'
  value_template: "{{ value_json.WINDIR }}"