cyberjunky / home-assistant-toon_climate

This component provides a climate device for rooted Toon thermostats.
MIT License
32 stars 8 forks source link

Missing 'off' button (enable ECO?) #23

Closed freddieleeman closed 3 years ago

freddieleeman commented 3 years ago

I like the new 'auto' feature, but removing the option to turn it 'off' messed up my automations. Would it be an option to add the 'off'-button again and make it enable the ECO mode?

Also the service 'climate.turn_on' and 'climate.turn_off' could switch to 'auto' and 'eco'-mode for instance.

rbak69 commented 3 years ago

@freddieleeman sorry about messing up your automations but the Toon cannot really be switched "off" hence why I changed the code to use "heat" and "auto" to reflect the actual behaviour of the Toon.

The service 'climate.turn_on' and 'climate.turn_off' are standard home assistant functions to turn climate devices on and off. In this case you cannot turn the Toon device "off" as it basically only consists off a "manual" and and "schedule" mode. You can even consider the vacation mode in the Toon as a sort ot manual mode. Although the Toon itself does also allow you to set an end date which we are unable to do with the web requests as far as I am aware. I suggest you use the service "climate.set_hvac_mode" instead to switch the Toon between "manual" and "schedule"mode.

See below the example of two scripts that can set the Toon to "manual" or "scheduled" mode

script:
  - toon_enable_manual_mode:
      alias: Toon enable Manual mode
      sequence:
      - service: climate.set_hvac_mode
        data:
          hvac_mode: 'heat'
        entity_id: climate.toon
      mode: single
  - toon_enable_schedule_mode:
      alias: Toon enable Schedule mode
      sequence:
      - service: climate.set_hvac_mode
        data:
          hvac_mode: 'auto'
        entity_id: climate.toon
      mode: single

If you wish to use the "eco/vacation" preset you can do so by using the service "climate.set_preset_mode". See below the example of a script that can set the Toon to the "eco" preset.

script:    
  - toon_activate_preset_eco:
      alias: Toon activate preset Eco
      sequence:
      - service: climate.set_preset_mode
        data:
          preset_mode: 'eco'
        entity_id: climate.toon
      mode: single

Obviously you can do the same for any of the other standard presets for the Toon. The latter can be called in either the "manual" or "schedule" operation mode of the Toon.

See the example scripts below:

script:
  - toon_activate_preset_comfort:
      alias: Toon activate preset Comfort
      sequence:
      - service: climate.set_preset_mode
        data:
          preset_mode: 'comfort'
        entity_id: climate.toon
      mode: single
  - toon_activate_preset_away:
      alias: Toon activate preset Away
      sequence:
      - service: climate.set_preset_mode
        data:
          preset_mode: 'away'
        entity_id: climate.toon
      mode: single
  - toon_activate_preset_home:
      alias: Toon activate preset Home
      sequence:
      - service: climate.set_preset_mode
        data:
          preset_mode: 'home'
        entity_id: climate.toon
      mode: single
  - toon_activate_preset_sleep:
      alias: Toon activate preset Sleep
      sequence:
      - service: climate.set_preset_mode
        data:
          preset_mode: 'sleep'
        entity_id: climate.toon
      mode: single

I hope that will resolve your automation issues.

freddieleeman commented 3 years ago

I understand the choices made but suggested merely to add the climate.turn_on / climate.turn_off to toggle the 'eco' and 'auto' mode. This way, other peoples implementations do not break and it is easier to understand / implement in my opinion. Just feedback, you can ignore it if you like. I've fixed it in my case like you suggested.

I really like a button to switch a thermostat 'off'. The fact that it doesn't actually go 'off' but switches to 'eco' mode would be a good alternative in my opinion.

image

rbak69 commented 3 years ago

@freddieleeman thanks for your feedback.

understand the choices made but suggested merely to add the climate.turn_on / climate.turn_off to toggle the 'eco' and 'auto' mode. This way, other peoples implementations do not break and it is easier to understand / implement in my opinion. Just feedback, you can ignore it if you like. I've fixed it in my case like you suggested.

When working on the latest version of the climate component I actually also created a version that used the "off" state to put in in "vacation" mode instead of using the "eco" preset. While testing the two alternatives it was clear that the "eco" option better mimics the actual behaviour of the Toon. Also I think it will be less confusing if you only have the option to select the "manual" and "schedule" mode (the buttons in the thermostat card) and not have a third "off" mode as well. But ofcourse that is a strong personal preference.

I really like a button to switch a thermostat 'off'. The fact that it doesn't actually go 'off' but switches to 'eco' mode would be a good alternative in my opinion.

There is another reason why I do not like to use the "climate.turn_on" service and that is because the "climate.turn_on" will automatically select the "heat" mode rather then allowing you to have that enable the "auto" mode. I think you might have noticed that as the "climate.turn_on" service does behave like that also in the latest version of the climate component. The "climate.turn_off" function could be enabled but it will automatically result in the three mode buttons to apear in the standard climate card in home assistant. The alternative would look like this (it is only a very minor change to the code):

Toon 3 button - auto - home

Anyway this is why I personally prefer the service "climate.set_hvac_mode" for any automation to change the work mode for the Toon and why I try to stay away from the "climate.turn_on" and "climate.turn_off" service in combination with the Toon (and thus this climate component).

I think the "climate.turn_on" and "climate.turn_off" services are better suited for Fans rather than for Thermostats like in this case the Toon.

freddieleeman commented 3 years ago

Sounds like you thought about this more than I have, so I'm just going to accept it and get used to it. Thanks for the feedback and thank you for maintaining the integration.

rbak69 commented 3 years ago

@freddieleeman no worries. To be honest both options would work. As said it was just a personal preference but I am happy to post the updated code here so you can test it and let me know your experience. Based on that we can decide whether to push it out or not. Let me know what you think.

You can also change it in the code yourselves. In the "climate.py" file just replace the line:

SUPPORT_MODES = [HVAC_MODE_HEAT, HVAC_MODE_AUTO]

with

SUPPORT_MODES = [HVAC_MODE_HEAT, HVAC_MODE_AUTO, HVAC_MODE_OFF]

As mentioned I already prepared the code for both options and this is all there is to it to enable the "off" mode as well. When selected the code will apply the same logic as when you would select the "eco" preset.

Please let me know what you think ;-)

timkoers commented 2 years ago

SUPPORT_MODES = [HVAC_MODE_HEAT, HVAC_MODE_AUTO, HVAC_MODE_OFF]

I'd preffer this rather than using the ECO mode for vacation as it's pretty confusing.

Here is my suggestion: When the Toon is set on vacation, show that using HVAC_MODE_OFF, but when you press the on/off button, go to a low temperature, and turn off the scheduled heating.

You might want to update preset_mode to reflect the OFF state when (programState = 0 and activeState = 2) or activeState = 4 In this case I assume that the SLEEP state has a low enough temperature for the Toon not to heat

When you press ON/OFF button resume the program as you would during normal operation.

rbak69 commented 2 years ago

@timkoers there are different ways to skin a cat and as mentioned here it is very easy to add the "off" button as well if you prefer that.

Personally I expect most people will use only the "heat mode" and "auto mode". I hardly ever use the "vacation" mode on the Toon myself but liked the idea to be able to recognize this state and to use that in my automations. Technically you can also simply set the Toon to "heat mode" with a low enough target temperature to achieve more or less the same thing but than I cannot distinguish between the normal "heat mode" or "vacation" mode. To me using the "eco" preset simply made more sense than adding an additional "off mode".

Please note the "eco" preset, or SLEEP state as you refer to it, will use the target temperature that was last set when activating the "vacation" mode on the Toon itself. So you cannot really control the target tempreature yourselves from Home Assistant in that state (valid for both the "eco" preset or "off mode"). By default that temperature is set to 6 degrees celcius in the Toon if you have not changed that previously.

As mentioned earlier the "eco" preset seems to mimic the actual Toon behaviour better than the "off" state hence why I decided to go that route.