Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySensors energy meter sensors Watt and kWh switch values sometimes after restart #7018

Closed
daenny opened this issue Apr 10, 2017 · 3 comments

Comments

@daenny
Copy link
Contributor

commented Apr 10, 2017

Home Assistant release (hass --version):
0.42.2

Python release (python3 --version):
python

Component/platform:
mysensors

Description of problem:
I have built the mysensors energy monitor and it works great. But sometimes the sensors which are created for the node switch the values.
I.e. at the screenshots it's currently correct. But sometimes
sensor.energy_meter_3_1 becomes the kWh sensor
and
sensor.energy_meter_3_1_1 becomes the Watt sensor
As both are from the same node, I guess it's a matter of initialisation of the sensors when the data comes in.
I think it's here:
https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/mysensors.py#L419
and/or:
https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/mysensors.py#L400
These values are not accessed in the same order every time. So maybe there should be a sort or something.

This has been around for a bit, first I thought it was an issue in emon cms (I use the emoncms history plugin for nicer energy visualization), but as you can see before the reboot, I had immense power usage the last days, since the kWh was reported as Watt value...

screen shot 2017-04-10 at 14 29 21

Additional info:
screen shot 2017-04-10 at 14 23 01
screen shot 2017-04-10 at 14 22 41

@MartinHjelmare

This comment has been minimized.

Copy link
Member

commented Apr 10, 2017

You can work around this by using different child ids for the different value types, Watt vs kWh.

A fix would mean adding the value type to the entity id. Id clashes could still occur in that case though when there are more than one gateway and identical sensors on multiple gateways.

@daenny

This comment has been minimized.

Copy link
Contributor Author

commented Apr 10, 2017

Thanks. I also thought about a workaround using template sensors, since both contain the complete information, I can use the attributes to create a template which always contains the correct data.

I do like the fix though to make the id more "unique", since I think it might happen in other cases as well, i.e. in Temp/Hum sensors.

@MartinHjelmare

This comment has been minimized.

Copy link
Member

commented Apr 10, 2017

Currently the component assumes you have one child per sensor, so I suggest you make that change in your sketch. Only platforms that require more than one value type should report multiple value types per child, eg cover platform.

@home-assistant home-assistant locked and limited conversation to collaborators Jul 17, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.