Skip to content
Snippets Groups Projects

DS18B20 for CH Monitor

This is a simple script written in PHP to submit the temperature read from a DS18B20 sensor to CH Monitor.

Preparation

You will need to setup the Raspberry Pi to add OneWire support. Start by adding the following line to /boot/config.txt at the very bottom:

dtoverlay=w1-gpio

Then edit /etc/modules and add the following 2 lines at the very bottom:

w1-gpio
w1-therm

Then reboot the Raspberry Pi.

Installation

Make sure that PHP, PHP-cURL and Git is installed on the Raspberry Pi.

Then clone the files from this project to /home/pi/sensor using the following command:

git clone http://git.zsinfo.nl/CHMonitor/DS18B20.git /home/pi/sensor

Edit the sensorId and apiKey values in the updateSensor.php file to the values supplied to you on the CH Monitor panel.

Test if the script finds the temperature sensor by running the following command. Exit the script using ctrl + c

php /home/pi/sensor/updateSensor.php

and add the following crontab using sudo crontab -e.

@reboot php /home/pi/sensor/updateSensor.php