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

Energy consumption not shown correctly #125

Closed
enrico1036 opened this issue Aug 29, 2024 · 7 comments
Closed

Energy consumption not shown correctly #125

enrico1036 opened this issue Aug 29, 2024 · 7 comments

Comments

@enrico1036
Copy link
Contributor

I'm using device 009-100 and I want to know device's daily energy consumption. I run dump and I can see the same value reported by ConnectLife App. This is the dump: 009-100.json
The problem is when the consumption is below 1. In home assistant I can only view the integer part of the number. Not the decimals. Since this is a daily consumption it will reset every day resulting to be always 0 or sometimes 1 at the end of the day.
I tried to scroll the source code but I cannot find an explicit cast to integer. How can this be fixed? I can create the pull request and test on my own but I need help if you can point me to the right place in source code.

Thanks

@oyvindwe
Copy link
Owner

Ah - this is the first time I have seen a value above 0 for daily_energy_kwh - I'll look into parsing it as a decimal number instead of integer!

@oyvindwe
Copy link
Owner

This had to be fixed in the upstream library: oyvindwe/connectlife#17

@oyvindwe
Copy link
Owner

Fixed in version 0.18.1

@enrico1036
Copy link
Contributor Author

Perfect! I tested it and works good. Thanks for the fast fix and for the whole work you did in this integration. If you agree, later I'll create a PR to update data dictionary and set daily_energy_kwh state_class to total_increasing, kWh

@oyvindwe
Copy link
Owner

Ah, yes, this should be total_increasing and kWh. I have seen this property on all devices I have received JSON dumps for - would you care to update all the mapping files?

@enrico1036
Copy link
Contributor Author

@oyvindwe Sure, I can do it. Do you think is better to update all the data_dictionaries containing daily_energy_kwh or just the 009-100 where it is used for sure? In all other dumps I see 0 as value.
And, always referring to 009-100, there are lot of sensors that are always 0 and unused (I guess). Should I disable them? In the same PR or a separate one?

@oyvindwe
Copy link
Owner

@enrico1036 That is a fair point. I suggest you make a PR with all the changes for 009-100 first.

daily_energy_kwh is also the only property I've seen that is a number and not a string on JSON, so it is clearly different from all other properties. Perhaps is should be treated in a generic way, but that would require some code change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants