MMunsters
(Mark Munsters)
1
Hi, I’m trying to set up MQTT to publish data and display this on a card in HA.
I have got a Raspberry Pi publish data using MQTT, a Python dictionary sent as JSON. On my HA Mosquitto broker is running and messages are coming in.
Now, I try to put the incoming data on a card, but I’m not been able to figure out how to do this. Some help would be appreciated.
Tinkerer
(aka DubhAd on GitHub)
2
You need to create a sensor or other entity so that you’ve got something to work with.
MMunsters
(Mark Munsters)
3
Success!
This is what the payload looks like (with some test data):
payload = {
"supply_fan_speed" : 10,
"exhaust_fan_speed" : 11,
"return_temperature" : 12,
"supply_temperature" : 13,
"outside_temperature" : 14,
"exhaust_temperature" : 15,
"bypass_valve" : "valve",
"filter_weeks" : "filter",
"summer_mode" : "summer"
}
I added this to the configuration:
mqtt:
sensor:
- name: "whr930_supply_fan_speed"
state_topic: "bijkeuken/whr930/data"
value_template: "{{ value_json.supply_fan_speed }}"
- name: "whr930_exhaust_fan_speed"
state_topic: "bijkeuken/whr930/data"
value_template: "{{ value_json.exhaust_fan_speed }}"
Now entities sensor.whr930_supply_fan_speed and sensor.whr930_exhaust_fan_speed can be used on the card.
1 Like