Raspberry Pi temp sensor?

Hi Everyone,

Interested in adding another temperature sensor to my house. I have a handful of sensors connected to my Vera hub, along with monitoring with Grafana.

I have lots of spare raspberry pi’s hanging around which I’d love to put to use instead of buying more multisensors.

Is there a way to create a temperature sensor on a raspberry pi, that connects to Home Assistant to report temperatures?

Short answer yes.

A dht11 or dht22 (if you want/need temps to .1 decimal place) can be bought and attached to the gpio ports or the raspberry pi. Then use the adafruits dht library to read the value from the gpio port and post it to home assistant. The best way I found to do this was via mqtt.

I have this script here that does it: https://github.com/psyciknz/OpenHAB-Scripts/blob/c09b37461d5d1b283cb3be35de291418b36d46fa/mqtt.dhtsensor.py

I have two raspberry pi doing this. One is dedicated the other is also a ups monitoring server.

1 Like