Page 1 of 1

[ZWay JS API] each Set() triggering a corresponding Get ?

Posted: 03 Nov 2014 00:29
by Bids
Hi,

I am experimenting with the JS API, and I noticed in the logs that when I perform an action like:

Code: Select all

zway.devices[9].instances[0].SwitchBinary.Set(0);
I properly see the z-wave frame being sent to set value to 0 on the switch node,

Code: Select all

[2014-11-02 22:07:00.519] Job 0x13 (SwitchBinary Set): Delivered
[2014-11-02 22:07:00.519] SETDATA devices.9.data.lastPacketInfo.delivered = True
[2014-11-02 22:07:00.519] SETDATA devices.9.data.lastPacketInfo.packetLength = 6 (0x00000006)
[2014-11-02 22:07:00.520] SETDATA devices.9.data.lastPacketInfo.deliveryTime = 78 (0x0000004e)
[2014-11-02 22:07:00.520] SETDATA devices.9.data.lastPacketInfo = **********
[2014-11-02 22:07:00.520] SendData Response with callback 0x46 received: received by recipient
[2014-11-02 22:07:00.520] SETDATA devices.9.data.lastSend = 1323420 (0x0014319c)
[2014-11-02 22:07:00.520] Job 0x13 (SwitchBinary Set): success
[2014-11-02 22:07:00.520] Removing job: SwitchBinary Set
But for this same unique Set() call, there is also systematically a corresponding "Get" being performed by the Z-way server immediately after:

Code: Select all

[2014-11-02 22:07:00.698] Job 0x13 (SwitchBinary Get): Delivered
[2014-11-02 22:07:00.698] SETDATA devices.9.data.lastPacketInfo.delivered = True
[2014-11-02 22:07:00.698] SETDATA devices.9.data.lastPacketInfo.packetLength = 5 (0x00000005)
[2014-11-02 22:07:00.698] SETDATA devices.9.data.lastPacketInfo.deliveryTime = 55 (0x00000037)
[2014-11-02 22:07:00.698] SETDATA devices.9.data.lastPacketInfo = **********
[2014-11-02 22:07:00.699] SendData Response with callback 0x49 received: received by recipient
[2014-11-02 22:07:00.699] SETDATA devices.9.data.lastSend = 1323435 (0x001431ab)
[2014-11-02 22:07:00.699] Job 0x13 (SwitchBinary Get): success
[2014-11-02 22:07:00.699] Removing job: SwitchBinary Get
Is this done on purpose ? Since every (non-broadcast) Z-wave frame is acknowlegded, I don't see the need for reading values immediately after setting them on the node, especially since it doubles the traffic on the network.
Can anyone shed some light on this ?

Thanks !

Re: [ZWay JS API] each Set() triggering a corresponding Get

Posted: 03 Nov 2014 04:20
by pofs
Yes, this is done on purpose.

1) It might be not necessary for you, but for automation scenarios it might be important to have actual value as soon as possible.
2) For sleeping battery devices packet can only be delivered when device wakes up. When you really need a value, waiting for wakeup would take much more time than issuing Get request immediately with Set (so both packets are dispatched during the same wakeup cycle).
3) You don't really use that much Sets daily to actually double traffic on your network. It just increases a little bit. Even more, devices supporting multi-command will receive both Set and Get as a single packet (with just one acknowledgement).
4) If you're making multiple Set calls in a short period of time (or, in case of battery device, before device wakes up), only one Get will be requested in the end to avoid unnecessary traffic.

You may consider it as a trade-off between a little extra traffic and keeping device data in consistent state.

Re: [ZWay JS API] each Set() triggering a corresponding Get

Posted: 04 Nov 2014 23:33
by Bids
Pretty clear explanation, thank you.
In my case, my primary concern is the latency introduced by the additional Get calls : when setting a specific value on 20+ devices upon receiving a given trigger (scene activation in my case), all these request queue up and end-up representing a significant time between the Set on the first device and the set on the last device.
Is this behaviour specific to the JS API, or does it also apply to the lower level zDev API ?

Regards,