Skip to content

Instantly share code, notes, and snippets.

@easierbycode
Created July 16, 2014 15:10
Show Gist options
  • Save easierbycode/8cac50cb5db39b6b0b1e to your computer and use it in GitHub Desktop.
Save easierbycode/8cac50cb5db39b6b0b1e to your computer and use it in GitHub Desktop.
exports.sensorHubEvent = (sensorHubEvent, eventResolved) ->
alertText = switch sensorHubEvent
when 1 then 'Water detect'
when 2 then 'Motion detect'
when 3 then 'Low temperature'
when 4 then 'High temperature'
when 5 then 'Low humidity'
when 6 then 'High humidity'
when 7 then 'Low light'
when 8 then 'High light'
if eventResolved
alertText += ' resolved'
alertText
exports.gatewayEvent = (message) ->
switch gatewayEventCode
when 1 then 'Going from line power to backup battery'
when 2 then 'Going from backup battery to line power'
when 3 then 'Transition from high to low battery voltage'
when 4 then 'Transition from low to critical low battery voltage'
when 5 then 'Going from shipping/dead to power on (SDG connected to line power)'
when 6 then 'Heartbeat'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment