Open dmaj opened 1 year ago
Hm. I don't know... But it seems correct in Home Assistant for me:
I actually lack practical experience with "homeassistant" here. I went through the code of "pysmartmeeter" to see how the whole thing works together. I checked the code against the specification of the interface of "homeassistant". However, I have no experience whatsoever of the effects these parameters have on the system. As long as it works ... :-)
And two screenshots attached.
With ./cli.py dump
you can see a little bit, what published via MQTT, e.g.:
But this is a layer between "RAW-Serial output" and HomeAssistant payload.
One of the tests has some "realistic" data as input and the payload to HomeAssistant is here:
So you can see, that there correct unit_of_measurement
send. Don't know what happens or if it's better so den all voltage with
"device_class": "volatge"
instead of "device_class": "energy"
EDIT: Currently the device_class
is hardcoded to energy
... I will look, if we can set this dynamically...
I made a test in https://github.com/jedie/pysmartmeter/pull/28
and yes, it a good idea to change the device class for voltage. In the end this is the visible change in HomeAssistant:
OLD:
And with #28 the icons changed, e.g.:
The payload change can be seen here: https://github.com/jedie/pysmartmeter/commit/e18294899483ab991361a28116d47d554c437242#diff-0777ab2a4f412c65a478205c3806bf571d7dd798688c33e20e8ecc6122320002
Maybe other values can also have a better class, e.g.:
'identifier': 'Gerätetyp mit Software Version',
'1-0:0.0.0*255': 'Eigentumsnummer',
'1-0:96.1.0*255': 'Geräte-Identifikationsnummer',
'1-0:96.5.0*255': 'Betriebszustand',
'0-0:96.8.0*255': 'Betriebsdauer',
@dmaj where is a good overview about existing device classes?!?
Sorry, i forgot to attach the links :-): Development Homeassistant Development Homeassistant Entity
You use the DEVICE_CLASS 'energy' for all values, even if the values refer to current or voltage. Wouldn't it make sense to use the intended classes here?
Unfortunately, I cannot test it because my meter does not output any values for voltage. But it looks to me as if only 'energy' is used.