Closed rklomp closed 3 years ago
Tested this in my home assistant instance (running core-2021.5.0b2) and still working fine. I have asked @itinside to test it as well to see it it fixes https://github.com/home-assistant/core/issues/49592
Just found this in de javascript of the webinterface:
DevClassInverter: "1",
DevClassBattery: "7",
DevClassEnergyMeter: "65"
Looks like these are the options.
And:
this.getDevClassAndValuesArrayFromValueObject = function(a) {
if (angular.isObject(a)) {
var b = Object.keys(a);
if (1 !== b.length) return void c.error(a, "has more or less than one device class. Not supported yet!");
var d = b[0];
return {
devClass: d,
valuesArray: a[d]
}
}
Looks like even the web interface only supports one device class.
Great, so val
and then wildcard *[{}]val
should be ok as well.
I will have a look if I can create a similar function in pysma
and extract the device class to inject that in the JMESPATH_VAL.
It might be usefull later to only load the sensors specific to that device class in HA.
@kellerza , How about this. This will extract the devclass on first read and uses the stored value on subsequent reads.
After this is merged I could create a sensor map that maps certain sensors to specific device classes. For example the sensors mentioned in https://github.com/kellerza/pysma/issues/58 will only be used for devclass == 7
Depending whether multiple devices classes are served from the same device, we might need a different approach. Tring to figure that out in https://github.com/kellerza/pysma/issues/58
This is an untested change proposal for https://github.com/home-assistant/core/issues/49592