I’ve got 6 Rasberry Pi’s doing various jobs round the house, and recently added a DS18B20 temperature sensor to each; they log their temperatures to a local database that I can access via a web page.
I’m trying to set up MQTT publishing on each to send to the Broker running on HA, following this - Tutorial for Using Python with FairCom EDGE MQTT - example for each Pi
If I open the MQTT integration and type in the Listen to a topic “/home/#” (so /home, then a wildcard), it shows the results for the first Pi I’ve set up, but I can’t get Home Assistant to show that temperature on the Dashboard, nor show the others are being received.
Is there a step I’ve missed on the HA side?
import time
import paho.mqtt.client as mqtt
from w1thermsensor import W1ThermSensor
sensor = W1ThermSensor()
client = mqtt.Client(client_id="HA")
client.connect("192.168.1.10", 1883, 60)
while True:
temp = sensor.get_temperature(W1ThermSensor.DEGREES_F)
jsonMsg = "{%f}" % (temp)
client.publish("/home/tvroom/temp-sensor", jsonMsg)
print("published %s" %(jsonMsg))
time.sleep(10)
1 post - 1 participant