Skip to content

Commit

Permalink
fix null value with momentary switch
Browse files Browse the repository at this point in the history
  • Loading branch information
heythisisnate committed Apr 17, 2020
1 parent cdcbb13 commit 3578d55
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Binary file not shown.
Binary file not shown.
5 changes: 4 additions & 1 deletion src/lfs/aws_iot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ c:on('message', function(_, topic, message)

-- set state back to initial after momentary is complete
if payload.momentary and payload.times ~= -1 then
revertIn = (payload.momentary + payload.pause) * payload.times - payload.pause
local pause = payload.pause or 0
local times = payload.times or 1

local revertIn = (payload.momentary + pause) * times - pause
tmr.create():alarm(revertIn, tmr.ALARM_SINGLE, function()
local revertState = { pin = endState.pin, state = endState.state == 0 and 1 or 0}
table.insert(sensorPut, revertState)
Expand Down

0 comments on commit 3578d55

Please sign in to comment.