999LV / SmartVirtualThermostat

Smart Virtual Thermostat python plugin for Domoticz home automation system
MIT License
41 stars 31 forks source link

Heater state not always plotted correctly on visualization #44

Closed amokkatgithub closed 3 years ago

amokkatgithub commented 3 years ago

https://github.com/999LV/SmartVirtualThermostat/blob/b76e6ecee6f2646986288483262c5b4f91159248/viewer/Smart%20Thermostats.html#L70

I have the case below: 0: Object { Data: "On", Date: "2021-01-22 16:30:40", Level: 0, … } ​​1: Object { Data: "On", Date: "2021-01-22 16:30:55", Level: 0, … } ​​2: Object { Data: "Off", Date: "2021-01-22 16:39:40", Level: 0, … } and getting just flat line at 0 as 'heater' state on visualization plot.

I propose to change that to y: (item.Data=="On" || item.Data.startsWith("Set Level"))?(((item.Level==undefined) || (item.Level==0))?100:(item.Level>100?100:item.Level)):0

At least that works for my case.

ultrasuperpingu commented 3 years ago

I didn't realize that the On/Off switches have a Level parameter but it seams they do... On my system, switches controlling the heaters are dimmers (because they can set the mode heater to Economy, Frost free, etc ). With whose dimmers, if their states are On but Level is 0, this means no heating so you're fix won't work. So I guess I have to check if the actual type of the switch is a dimmer and not just check that Level attribute is present to assume it. I'll fix this soon.