albertogeniola / meross-homeassistant

Custom component that leverages the Meross IoT library to integrate with Homeassistant
MIT License
687 stars 76 forks source link

adding energy sensor for plugs #460

Closed benoitm974 closed 8 months ago

benoitm974 commented 9 months ago

Since homeassistant deprecated the energy and power in switch entity, moving energy as sensor.

adicrescenzo commented 8 months ago

Please @albertogeniola merge this pull request in order to restore the energy and power data

benoitm974 commented 8 months ago

Original intent was to add energy sensor as part of switch I didn't though there would be energy sensor not being electricity devices ... I've included the changes mentioned. Thanks for your feedback.

benoitm974 commented 8 months ago

By th way I was not able to conclude whether you’d remove the previous code from the switch file since it was depreciated in home assistant. I’m not familiar enough with home assistant code practice for this.

albertogeniola commented 8 months ago

By th way I was not able to conclude whether you’d remove the previous code from the switch file since it was depreciated in home assistant. I’m not familiar enough with home assistant code practice for this.

Since it has been deprecated, I think it is ok to get rid of them on the switch entity. However this will possibly break things for people who use them. For now, let's start by merging your work. I suggest to propose a new PR for getting rid of the deprecated properties.

benoitm974 commented 8 months ago

By th way I was not able to conclude whether you’d remove the previous code from the switch file since it was depreciated in home assistant. I’m not familiar enough with home assistant code practice for this.

Since it has been deprecated, I think it is ok to get rid of them on the switch entity. However this will possibly break things for people who use them. For now, let's start by merging your work. I suggest to propose a new PR for getting rid of the deprecated properties.

Is there a version mecanism in home assistant where we could test the version and not execute the code ? I was not able to identify if home assistant simply don't call those anymore in newer version or still call it but it gets ignore or fails... therefore we could had a if version > then.

benoitm974 commented 8 months ago

@albertogeniola can we close both issue #404 and #439 ? Thanks a lot for integration in 1.2.10!

albertogeniola commented 8 months ago

Done! Thanks.