chomupashchuk / ariston-remotethermo-home-assistant-v2

Ariston NET remotethermo integration for Home Assistant based on API
MIT License
94 stars 22 forks source link

Power ON/OFF button #8

Closed cristi2005 closed 3 years ago

cristi2005 commented 3 years ago

Hi,

First, Thank you for the great job with Ariston implementation in HA. I have a request, can you add power - turn power off and on (on value is defined by power_on attribute) in this V2 ???

Thank you, Cristi

chomupashchuk commented 3 years ago

Hi,

I did not like the idea of having additional configuration data for sensors/switches, which makes switches more complex and requires very clear description in documentation as we create inter-parameter dependencies. The main reason why i did not include it is because it is possible to define template switch which shall call service ariston.set_data for ON and OFF values with wanted mode in the data. For example following can be added by the user for one of the options:

switch:
  - platform: template
    switches:
      ariston_power:
        value_template: "{{ is_state('sensor.ariston_mode', 'winter') or is_state('sensor.ariston_mode', 'summer') or is_state('sensor.ariston_mode', 'heating_only') }}"
    availability_template: "{{ is_state('sensor.ariston_mode', 'winter') or is_state('sensor.ariston_mode', 'summer') or is_state('sensor.ariston_mode', 'heating_only') or is_state('sensor.ariston_mode', 'off') }}"
        turn_on:
          service: ariston.set_data
          data:
            mode: 'summer'
        turn_off:
          service: ariston.set_data
          data:
            mode: 'off'
cristi2005 commented 3 years ago

Where do I add these command lines, in configuration.yaml ?

chomupashchuk commented 3 years ago

yes, see https://www.home-assistant.io/integrations/switch.template/

cristi2005 commented 3 years ago

Ok, Thank you very much.