This is a homebridge plugin to make a Raspberry Pi connected with a Relay Board and DS12B20 Temperature Sensor into a smart thermostat that can be controlled via the Home app on iOS using Homekit.
For those who want to create their own thermostat using Raspberry Pi, here is a blog post that goes through the details of where to buy the parts, how to assemble it and what software to install to get this to work.
- Install nodejs and other dependencies for homebridge to work
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs libavahi-compat-libdnssd-dev
- Install homebridge and this plugin
sudo npm install -g --unsafe-perm homebridge homebridge-pi-thermostat
- Add the accessory config to your homebridge config file located at this path
~/.homebridge/config.json
.
{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},
"description": "",
"accessories": [
{
"accessory": "Thermostat",
"name": "Pi Thermostat",
"fanRelayPin": 26,
"heatRelayPin": 21,
"coolRelayPin": 20,
"temperatureSensorPin": 4,
"minimumOnOffTime": 120000,
"blowerTurnOffTime": 80000,
"startDelay": 10000,
"temperatureCheckInterval": 10000
}
],
"platforms": []
}
- Start it up by running
homebridge
command.
You can change the pin to turn on and off the relay switch for the Fan, Heat and Cool setting.
"fanRelayPin": 26,
"heatRelayPin": 21,
"coolRelayPin": 20,
The system has a minimum on off time which is in miliseconds and is the minimum time it keeps the Heat or Cool turned on and off so that it does not damage the heating or cooling system by turning on and off very quickly.
"minimumOnOffTime": 120000,
The system also has a blowerTurnOffTime which is the time it takes to turn off the blower after Heat or Cool is turned off.
"blowerTurnOffTime": 80000,
The interval for checking the temperature of the room can also be set and defaults to 10 seconds.
"temperatureCheckInterval": 10000