What to do if a device does not reply? #1415
-
Again a case of specs vs reality. The specs mandate for every GET-type command that the device MUST reply with the corresponding Report. However, we're often in a situation where we know the device has received the command, but simply does not reply. This could have several reasons, e.g. something is not supported, the response gets lost along the way back, ... Experience has shown that many of even the most basic queries (e.g. switch value, or sensor value for a supported CC) do timeout.
It advertises support for the Z-Wave+ CC (even the manual says so), but does not reply when we query it:
^ message acknowledged, but then... crickets... OZW just ignores all of these failures - zwave-js aborts the interview (mainly because I trusted the specs back when I wrote this behavior). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes. You're dealing with RF communication and a stateless protocol - there are no guarantees. Keep in mind this is as true for
Depending on the Command Class in question, this might mean that the entire interview must be halted. For example, if something like this were to happen for the S2 Command Class during the "secure inclusion" process, the entire "secure inclusion" process is aborted. The device must be manually excluded by the user, and the user must then perform a new attempt at inclusion. Other failures are softer - it should, for example, be possible to continue with not knowing the on/off state of a bulb during the initial interview, defaulting to an "unknown" state.
In these situations, trying to be smart usually causes more harm than good. It's better to be honest - something failed and the library doesn't have the context to deal with it. Let the client know what went wrong, it's likely in a better position to deal with the exception. As the library matures, and with input from clients using it, some cases that can be handled might come up - but this is a safer starting point.
For the sake of this discussion, let's assume that zwave-js is at this point Z-Wave Certified and has the "it does the right thing"TM stamp of approval. You're facing a device that is in breach of certification requirements. Even if the manufacturer gets notified of this and releases an OTA firmware update, you still have to deal with the device in front of you. You have options. In this case, the library could decide that after 3 failed attempts at getting the information, it'll give up and set its values to a sensible, generic default (if there is one). Another option would be "hiding" that Command Class from clients. A third possibility is having device-specific workarounds, where these values are known in advance and provided out-of-band to the library. Whatever the workaround, it's important to surface the problem to the client. It, or it's users, then have the opportunity to let device manufacturer and the Z-Wave Alliance know about the non-compliance so it can get corrected.
"Trust, but verify." Even if the Certification process was somehow infalible and never let a single non-compliance slip through, a library will still need to deal with older devices, manufactured during a time when a certain requirement might not have existed. |
Beta Was this translation helpful? Give feedback.
Yes. You're dealing with RF communication and a stateless protocol - there are no guarantees. Keep in mind this is as true for
SET
requests as it is forGET
requests: if a device tries to switch a power switch on via aSET
command, but the switch device detects over-current or over-temp., it's free to refuse the request and not change state. Unless this request was Supervision Command Class encapsulated, the sender won't know the reason for refusing the state change. Some devices might chose to send aREPORT
out the Lifeline with the state not having changed and/or issue a notification/alarm via Notification Command Class letting t…