I want to implement an ack function for this plugin. if you send a message to a dimmer, the dimmer sends a ack message back. Now I want the plugin to wait for this message for a little time, if not received within this time it should resend.
Now i’m messing a bit with events but i can’t get it working, don’t know where to start.
What i could think of:
_rfWrite: (datas) ->
datas.command ?= C_SET
data = @_rfencode(datas.destination,datas.sensor,datas.command,datas.ack,datas.type,datas.value)
env.logger.debug "-> Sending ", data
@driver.write(data)
if datas.ack
# send event waiter??
@_getAck(datas.destination, datas.sensor)
_getAck: (nodeid, sensorid) ->
# Wait for ack message with timer?