Skip to content

Instantly share code, notes, and snippets.

@jsdario
Created November 17, 2017 15:54
Show Gist options
  • Save jsdario/d1f71531a3d401ec78ba03b8d3007588 to your computer and use it in GitHub Desktop.
Save jsdario/d1f71531a3d401ec78ba03b8d3007588 to your computer and use it in GitHub Desktop.
Bigfoot Smart Home samples
const bigfoot = require("@netbeast/bigfoot")
bigfoot.hunt().then(function (devices) {
const sensor = devices['motion-sensor-01']
const plug = devices['raspberry-light-01']
bigfoot.listen(sensor, function (state) {
if (state.motion === 'motionstart') {
bigfoot.setState(plug, {power: 1})
} else if (state.motion === 'motionend') {
bigfoot.setState(plug, {power: 0})
}
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment