Last active
November 16, 2017 23:49
-
-
Save jsdario/4b1e2115e4ff1ac9e7e0797beb5dc796 to your computer and use it in GitHub Desktop.
Bigfoot Smart Home samples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bigfoot = require('@netbeast/bigfoot') | |
const gpio = require('rpi-gpio') | |
const device = { | |
id: 'raspberry-light-01', | |
name: 'Bedtime light', | |
topic: 'Bulb', | |
} | |
let state = {} | |
bigfoot.alive(device, function handler (commit, params) { | |
state = { ...state, ...params } | |
gpio.write(7, state.power, function(err) { | |
if (err) return console.error(err) | |
commit(state) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment