PDA

View Full Version : EventHandler keyMod only 0 result for IR PIR1 device



MarBe
December 31st, 2015, 08:10 AM
Hi, want to use eventhandler for trigger event, if the IR code from PIR get on.
On keypress IR code I get one event like this
čt pro 31 15:07:18 2015 Event: b4dd9acadf55f7390b9e0e13be208846 123 0

and the same for stop press. I need to resolve, if the ir code start or stop.

I use now this script for eventhandler
________________________________________
if handlerId then
gir.removeEventHandler( handlerId )
handlerId = nil
print('handler removed')
end

handlerId, err = gir.addEventHandler( ".*", 123, 124, function( eventString ,eventDevice, keyMod, payloads, captures )

print("Event: ", eventString, eventDevice, keyMod)
table.print(payloads)
table.print(captures)

end)

if not handlerId then
print("Add Handler registration failed.", err)
else
print("Handler registered.")
end

Ron
December 31st, 2015, 11:26 AM
The PIR-1 code is not designed to do ON-REPEAT-OFF modifiers. You could do this in code if you like. Set/reset a timeout whenever a repeat comes in. Then if the timeout actually fires it means that no more IR codes came in and you should do OFF modifier.