We are using variable_watch to register a callback with LUUP interface and get a notification when the variable changed.
This is working fine.
But we have a concern when we re-register the same variable with the LUUP for the same “function”.
Lets say we have a function [font=courier]handleVariableChange[/font]
and we have a Security sensor whose variable “Armed” has been registered with this handleVariableChange function…
[font=courier]luup.variable_watch(“handleVariableChange”, “urn:micasaverde-com:serviceId:SecuritySensor1”, “Armed”, device_id_of_security_sensor)[/font]
Now, when the code is restarted, we would automatically call the luup.variable_watch function once again…
And now if the variable changes, we get 2 call backs to the same function…
If we restart code once more (i.e register once more for variable_watch function… We get one more callback (i.e the same function gets called 3 times).
We want to avoid this…
Will the variable_watch function be fixed to not register a duplicate callback for the same function/schema/variable/device_id combination.
Is there a way to un-register this callback that was issued to variable_watch, and calling this function will remove the callback that is currently registered…
Any suggestions please…
Thanks in advance…