Skip to content

boomninjavanish/motion-thermostat

Repository files navigation

motion-thermostat

Motion thermostat uses an Espruino Puck to send temperature data to a local server so that a device may be switched on once the ambient temperature exceeds the set temperature threshold. The user may flip the puck over (face-side down) to opt to have the fan turned off permanently.

This project utilizes IFTTT webhooks to receive commands to control other devices. For example, I originally started this project in order to control a vent fan that is plugged into a TPLink Kasa IoT plug.

Setup

  1. On the IFTTT website, setup two Web Hooks with the event names: 'puck_on' and 'puck_off'.
  2. Using the Espruino web IDE, flash the code found in 'espruino-puck-code.js' to the Puck.
  3. Clone this repository on your choice of server. I opted to use a Raspberry Pi 4 running Ubuntu 20.04. However, you may use any computer compatible with Node 14+ and the @abandonware/noble library:
$ git clone https://github.com/boomninjavanish/motion-thermostat.git
  1. In the newly created directory, install any node packages:
$ cd motion-thermostat
$ npm install
  1. Add the following environmental variables via the command line. Be sure to replace the x's with your Puck's mac address and the key found in the IFTTT API URL prefix:
$ export PUCK_ADDRESS=xx:xx:xx:xx:xx:xx && export IFTTT_API_KEY=xxxxxxxxxxxxxxxxxx
  1. Run the node script:
$ node motion-temperature --verbose

If the output looks like this, you were successful:

[2021-04-05 06:21:14] - battery: 2.8v, fanOn?: false, temp: 20.8

After testing, the script may run like a service using systemd unit files, launchd, node-windows, etc. Make sure to leave out the --verbose flag to reduce the amount of chatter in your log files.

About

A thermostat that utilizes a Espruino Puck, a Raspberry Pi server, and IFTTT to control a fan.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published