cdpuk / ha-bestway

Home Assistant integration for Bestway / Lay-Z-Spa hot tubs
MIT License
59 stars 15 forks source link

Feature Request: Power on/off #29

Closed rjlee closed 9 months ago

rjlee commented 1 year ago

From bruces original code for the layzspa, it was possible to control the power on/off:

  - platform: template
    switches:
      hottub_power:
        availability_template: "{{ states('sensor.hottub_online') }}"
        friendly_name: Power
        unique_id: hottub_power
        value_template: "{% if state_attr('sensor.hottub_status', 'power') == 1 %}on{% else %}off{% endif %}"
        turn_on:
          - service: rest_command.hottub_command
            data:
              hottub_command: turn_on
          - delay: 00:00:05
          - service: homeassistant.update_entity
            entity_id: sensor.hottub_status
        turn_off:
          - service: rest_command.hottub_command
            data:
              hottub_command: turn_off
          - delay: 00:00:05
          - service: homeassistant.update_entity
            entity_id: sensor.hottub_status

Could this be added ?