claudegel / sinope-130

Neviweb130 custom component for Home Assistant to manage devices connected via a GT130 and wifi devices from Sinopé

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

switch history displayed as graph

chdagenais opened this issue · comments

Since unit_of_measurement field was added to the switch class in bbddb49 , history graph for switches aren't displayed as intended.

My switch.RM3500ZB is now displaying an empty kWh graph instead of switch stauts history (on/off)
Capture d’écran, le 2023-03-03 à 09 14 45

Per HA documentation , entity with unit_of_measurement defined is displayed as x/y graph, and entity without unit_of_measurement is displayed as a linear status graph.

Hi thank you for reporting this issue. I don't think that we need to remove completely unit_of_measurement as it could penalize other devices in the switch.py file.
I'll check to change device_type instead so it will be reported as a switch on/off

I've created a branch https://github.com/claudegel/sinope-130/tree/unit
Please test switch.py
It should fix it and let me know.
For now there are no way to choose other value then state value so we cannot use ºC for the current temp or W for instant power. For the RM3500ZB the state is on/off. But I'm looking for a possibility to decide which value is displayed in the state. it would be interesting to have the flow level on valve equiped with flow meeter or the water temperature for the RM3500ZB

I think the best course of action for displaying sensor value for these devices is to register them as devices with multiple entity (on/off, flow, temp…) or create separated entity (automatically from the addon or manually like the templates in the README to get power consumption in the energy dashboard . Pretty sure a switch (electric or or a water valve) in Home Assistant shouldn’t return a state different than on/off open/closed anyway

So did you test switch.py ?

Ok I've merged your PR into the unit branch and did a code review to fix changes for icon and class in switch.py and sensor.py.
Now the history is showing correctly for all of my switchs.
I'm gonna make a new release for this.

Thank you for your help and comments

Sorry for the delay,
It's back to expected behaviour with 2.0.2 , thanks!

Thanks to you for reporting this issue. Now everything is fine