- Grab a DHT22 sensor or DHT11.
- Connect VCC to 3.3, GND to GND and signal to GPIO 4.
- Edit
/boot/config.txt
to havedtoverlay=dht11,gpiopin=4
- reboot
- I’m using home assistant to record the data, here is the script I use, modify to whatever you like
#!/bin/bash set -eux set -o pipefail PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin KEY="" HA_URL="" # no trailing slash TEMP_VALUE=`cat /sys/bus/iio/devices/iio\:device0/in_temp_input | sed 's/...$/.&/'` HUMIDITY_VALUE=`cat /sys/bus/iio/devices/iio\:device0/in_humidityrelative_input | sed 's/...$/.&/'` curl -X POST -H "Authorization: Bearer $KEY" \ -H "Content-Type: application/json" \ -d "{\"state\": \"$TEMP_VALUE\", \"attributes\": {\"unit_of_measurement\": \"°C\", \"friendly_name\": \"Satnogs Temp\"}}" \ $HA_URL/api/states/sensor.satnogs_temp curl -X POST -H "Authorization: Bearer $KEY" \ -H "Content-Type: application/json" \ -d "{\"state\": \"$HUMIDITY_VALUE\", \"attributes\": {\"unit_of_measurement\": \"%\", \"friendly_name\": \"Satnogs Humidity\"}}" \ $HA_URL/api/states/sensor.satnogs_humidity
- Add to crontab - eg
* * * * * /root/ha_temp.sh >/dev/null 2>&1
Sometimes you’ll get input/output errors reading. Just try again.