Open marcelveldt opened 4 years ago
In the value
payloads the command class is listed as a string, which is typically what we're checking command classes against. However the parent commandclass
topics use the command class ID and the payload has both a CommandClass
string and a CommandClassId
integer.
Please use the integer to test in code. The specs has (and will probably continue) to change the names of command classes previously.
If there is a entity where it’s a name without a ID, let me know, I’ll add it.
The “string” representations could be used as GUI elements I guess... 😜
OK, so we'll go with the int's, probably even an enum.
@Fishwaldo do you have a list/enum of all available commandclasses available ?
So, we will just go ahead and only use the ID. Maybe it's a good thing to also rename the keys in the json returned by OZW ?
CommandClassId --> CommandClass (int of CC) CommandClass --> CommandClassLabel (str)
You can get it from here: https://www.silabs.com/documents/login/miscellaneous/SDS13548-List-of-defined-Z-Wave-Command-Classes.xlsx
I'll look at the JSON soon and update
all Z-wave specific constants are now moved to the library. Thing left to do is perhaps prettify the device specific/generic constants into some enums. This is now just one bulky list.
One more TODO is the ValueIndex constants. Problem is that each CommandClass has it's own Values so the ValueIndexes are not unique. Would be great if we can figure out a generic approach to have the ValueIndex property correctly set to the correct CommandClass
https://github.com/cgarwood/python-openzwave-mqtt/blob/master/openzwavemqtt/models/value.py#L67
Could we have a CC data class that maps the CC to the ValueIndex enum of the CC? We have the CC available in the OZWValue
class so then it's easy to use that in the lookup in the method.
Yeah, I was indeed thinking in that same direction.
Constants are spread across the lib and the hass component. I want to move them into the library. At the same time the Command Classes are being mixed up between string's and int's. We need to fix that.
I will start working on this this weekend but we might need to discuss how we want to handle the Command Classes in a consequent way.