I have a weather station/ pool control and testing system/ yard automation system that I have designed and built. I am transmitting an MQTT JSON package to a broker. I have created a manual MQTT sensor in HA. (the MQTT.yaml file is below) I then created a file containing all of the sensors. (the template.yaml file is below) All of the sensors that return a number of some type (i.e. float and int) work just fine. However, the one sensor that returns a text value is only showing “unknown”. ( screenshot below of the values)
I assume there is something wrong with the “State” line in the “template.yaml” file for that sensor. I have tried searching the great “World Wide Web” for an answer with no real success. I need help figuring this one out.
MQTT.yaml
sensor:
- name: "Taigh Gheal Mor"
state_topic: "hatsconsys/ath/status"
json_attributes_topic: "hatsconsys/ath/sensors"
template.yaml
Taigh Gheal Mor
sensor:
- name: "Wind Speed"
state: "{{ state_attr('sensor.taigh_gheal_mor', 'wind') | float | round(1) }}"
icon: mdi:weather-windy
unit_of_measurement: "mph"
- name: "Wind Direction"
state: "{{ state_attr('sensor.taigh_gheal_mor', 'dir') }}"
icon: mdi:compass
unit_of_measurement: ""