How to Identify Various Versions of FIBARO FGK-101 within Handler?

(JJG) #1

I developed a custom Device Handler for the original “Fibaro FGK-101 Temperature & Door/Window” Device, but it breaks down when paired to the latest Z-Wave+ version (aka ZW5) of the FGK-101.
It gets more complicated because Fibaro did not make this ZW5 version 100% upward compatible with the original FGK-101, so I will have to include some conditional code in my custom Handler, because I would like to keep a single version of the Handler, compatible with both versions of the FGK-101.

So the question becomes : how can I reliably identify the 2 versions of the FGK-101 from within the Device Handler itself ?
There are multiple informations which I can download using the proper Commands, such as productTypeId, productId, zWaveProtocolSubVersion, zWaveProtocolVersion, zWaveLibraryType, etc… but I was unable to determine WHICH of those is the true determinator for Z-Wave vs Z-Wave+ version.

Thanks for any help.

(JJG) #2

I will answer my own question, from an answer I got on a Fibaro forum : use the applicationVersion.applicationSubVersion from VersionReport answer to VersionGet command.
If >=3.2 => ZW5
if <=2.5 => non-ZW5

Using those, it is possible to create a single Custom Handler supporting both versions of the Fibaro FGK-101 hardware.


so i have a 3.02 ?

am not sure how to do this:

(JJG) #4

I suppose 3.2 and 3.02 could be considered mostly identical…
But I would consider the sticker inside the FGK-101 case as more reliable; note that this sticker did not exist before ZW5 versions.

You can look at my FGK-101 Custom Handler on GitHub.
It is a bit tricky, because you actually have the Device to wake up twice before its actual version can be ascertained : once for sending a “VersionGet” query, and then a second time to process the “VersionReport” answer. Before that second answer, the actual version of the Device is “unknown”.
Note also that the “device.rawDescription” is mostly useless for automatic handling because its format is unstable.
Look at lines 647 and 556-573 in the above example (v0.9.6.3).