cyr-ius / hass-heatzy

Climate Home Assistant component for Heatzy Pilot
MIT License
33 stars 13 forks source link

GLOW: Switching to Off in Heatzy app but no change in HA #23

Closed bragitman closed 1 year ago

bragitman commented 1 year ago

If I switch a GLOW radiator to Off in the Heazy app I don't get the change in HA. I turned on debugging and think I can see where the problem is.

If I set the mode to Away (using the Heatzy App) I see this in the Device Data entry of the log file: 'on_off': 1, 'mode': 'fro'

No problem there, but If I then change from Away mode to Off (using Heatzy App) I get this in the log file: 'on_off': 0, 'mode': 'fro'

So it appears that when setting it to Off in Heatzy App it doesn't change the mode to 'stop', only the on_off is set to 0.

CarryNeo commented 1 year ago

Same here, any news on this bug ?

cyr-ius commented 1 year ago

If I switch a GLOW radiator to Off in the Heazy app I don't get the change in HA. I turned on debugging and think I can see where the problem is.

If I set the mode to Away (using the Heatzy App) I see this in the Device Data entry of the log file: 'on_off': 1, 'mode': 'fro'

No problem there, but If I then change from Away mode to Off (using Heatzy App) I get this in the log file: 'on_off': 0, 'mode': 'fro'

So it appears that when setting it to Off in Heatzy App it doesn't change the mode to 'stop', only the on_off is set to 0.

If I understood correctly to disable the Glow , just set the on_off to 0 I prepared a beta version 5.6.1 Can you try? and get back to me if OK

In HACS to enable beta versions: Select Heaty, then on the 3 dots at the top right Redownload and check the beta version. You should see the version in question appear.

CarryNeo commented 1 year ago

Working great. Thanks for the very fast answer.

bragitman commented 1 year ago

I've not had a chance to test this, but looking at the code changes I think you've misunderstood the issue, I should have explained better . Your change looks like it's changing how it works when turning off in HA, but this already works as expected. The problem is that when I turn off in the Heatzy Application it doesn't get reflected in HA.

Yesterday (before your message) I actually fixed the issue for myself by adding this to the Glowv1Thermostat class: @property def preset_mode(self): """Return the current preset mode, e.g., home, away, temp.""" if self.coordinator.data[self.unique_id].get("attr", {}).get("on_off") == 0: return self.HEATZY_TO_HA_STATE.get("stop") return self.HEATZY_TO_HA_STATE.get( self.coordinator.data[self.unique_id].get("attr", {}).get("mode") )

I'm not experienced on GitHub so I was planning on reading up on how to branch and share these changes with you.

bragitman commented 1 year ago

@CarryNeo , I wonder if you have a a different issue to me as I've just tested 5.6.1 and find issues. Here are my results:

I've now reverted to 5.6 with my changes and have found that although that works for updates from Heatzy to HA, and works turning off in HA (resulting in Heatzy turning off), I am unable to turn from Off to On in HA. I can see what the problem is so will try to find a way to fix this. I will then share my version of the code

cyr-ius commented 1 year ago

@CarryNeo , I wonder if you have a a different issue to me as I've just tested 5.6.1 and find issues. Here are my results:

* My Heatzy Glow is off.  But when I restart HA (after updating to 5.6.1) it shows "Away" in HA.

* If I turn  from Off to Away in Heatzy App it also turns to Away in HA.

* If I turn from Away to Off in Heatzy it doesn't turn off HA.

* If I turn off in HA it turns off in Heatzy, but then HA shows that it's Away still.

I've now reverted to 5.6 with my changes and have found that although that works for updates from Heatzy to HA, and works turning off in HA (resulting in Heatzy turning off), I am unable to turn from Off to On in HA. I can see what the problem is so will try to find a way to fix this. I will then share my version of the code

First of all I speak French so if it is also your case. Do not hesitate. Note that you can find a small python example that allows you to get all the lists of equipment Very practical for capturing the parameters at each state. https://github.com/Cyr-ius/heatzypy/blob/master/example.py

Afterwards, I am not surprised by the behavior. Namely that HA is displayed on the preset mode that I read and display on the screen. Unless I understand correctly, the GLOW does not depend on the preset for its on/off state. It is a different value which is on_off at 0 or 1

Can you try version 5.6.2

HA offers several modes, suddenly, I kept the notion on_off 0/1 on the tun_on and turn_off calls but I also impacted this change on the return of the HVAC mode which will thus go from OFF to HEAT

I keep the usual mode preset. So normally you should switch the GLOW to OFF or HEAT

bragitman commented 1 year ago

Sorry, I don't speak French very well, a lot worse than your English!

I've tested 5.6.2 and this works perfectly. Merci beaucoup.