Open nouknouk opened 7 years ago
It seems we can get some information by enabling the OZW configuration option "NotifyTransactions":
ozw = new OpenZwaveDriver({ConsoleOutput: true, NotifyTransactions: true}
In such case, we get some feedback via the 'notification' event:
ozw.on("notification", function (nodeid, notif) {
// for NotifyTransactions callbacks,
// notif === 0 (aka. "message complete")
});
I tried with my Fibaro light dimmer ; after requesting a change of the 'level' value, I get two notifications:
Notes:
other attempts with other zwave values (like 'bright'/'dim'/'inc'/'dec' zwave buttons declared in the Fibaro Dimmer) don't make any action on my light, and in such case I receive only the notification for node 0.
no such notification received when the light is put on/off manually using the 'normal' wall switch (in such case, only a 'value update' notification is received.
==> it seems there is no way in the API to bind a call to an OZW action (like 'setValue') to a transactionID and get this ID back in the notification when the action is finished, to make the link. This seems not possible even in the openzwave library itself.
==> That smells like a hell to be able to reliabily trace the (asynchronous) results of the commands trigerred, especially in case multiple commands are sent in parallel to the same node.
Any thought about that ?
Thanks in advance.
This is a known issue about OpenZWave and there's no easy way around it. Some ZWave devices don't even bother to report a manual status change, and you need to enable polling on them. If you're updating UI values then you're better off subscribing to value change events.
I believe the protocol per se does not allow passing user data within a request, so the only way you can correlate a request and the status change is by some sort of FSM. I've done some work recently using the machina.js library and I think I can hack together a small demo in the following days.
thanks for your answer.
Just some questions/remarks:
zwave being a reliable protocol, i suppose the controller should receive at least a 'techical acknowledgment' frame from the device, to state that the request frame has been well delivered (and so, no re-sending is needed). Even if this is not as complete as a 'ack message' that the action itself has been well performed (typically a value change), this could be a first info, no?
unless i'm mistaken, the "transaction id" i see in the logs is present in one of the bytes that are 'sent' (again, according to the logs). no?
Le 28 avril 2017 7:08:35 PM Elias Karakoulakis notifications@github.com a écrit :
This is a known issue about OpenZWave and there's no easy way around it. Some ZWave devices don't even bother to report a manual status change, and you need to enable polling on them. If you're updating UI values then you're better off subscribing to value change events.
I believe the protocol per se does not allow passing user data within a request, so the only way you can correlate a request and the status change is by some sort of FSM. I've done some work recently using the machina.js library and I think I can hack together a small demo in the following days.
-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/OpenZWave/node-openzwave-shared/issues/163#issuecomment-298053910
@ekarak Did you ever manage to hack together a state machine to match received notifications to issued commands? I would very interested.
FYI, I raised the question in openzwave google group:
https://groups.google.com/forum/#!topic/openzwave/QSNaRe8JHLc
Hi,
first, thanks for this usefull library.
I'd like to send zwave commands and associate JS promises, being resolved/rejected according to the real feedback provided by the zwave network. When testing, I set a value (the 'Level' value of a Fibaro FGD212), i get lot's of logs displayed by the zwave driver ; here is a summary (full logs are available at the end of this post):
1- queuing the command, 2- sending it, 3- ensure it is delivered to Z-Wave stack, 4- a callback ID (here 0xc2) 5- a confirmation that the expected callbackId was received 6- finally, a message with the new value
For all those summarized steps, I have no feedback on Javascript side, only for the last one (number 6), using an event ''value changed'
I wonder to be able to get more intermediate notifications (for steps 1 to 5, but especially during step 5, which looks the best step to resolve/reject my 'changeValue' promise).
Is there a way to get them ?
Thanks in advance.
full logs: