gazoodle / gecko-home-assistant

Home Assistant integration for spas equipped with Gecko Alliance in.touch2 modules
MIT License
66 stars 22 forks source link

When connecting HA to HomeKit each pump has 4 switches #83

Open Kissel-B opened 1 year ago

Kissel-B commented 1 year ago

When porting over to HomeKit each motor has 4 switches assigned to them 1 Fan and 3 toggle.

robgridley commented 1 year ago

The pump for my spa is a two-speed. My solution was to remove the pump from my HomeKit entities list and create two separate template switches instead: one for low speed and one for high speed. This allows me to tell Siri to "turn on spa jets low" or "turn on spa jets high".

Here's the relevant part of my Home Assistant config:

switch:
  - platform: template
    switches:
      spa_jets_low:
        friendly_name: "Spa Jets Low"
        value_template: "{{ is_state_attr('fan.spa_pump', 'preset_mode', 'LO') }}"
        turn_on:
          service: fan.set_preset_mode
          target:
            entity_id: fan.spa_pump
          data:
            preset_mode: "LO"
        turn_off:
          service: fan.set_preset_mode
          target:
            entity_id: fan.spa_pump
          data:
            preset_mode: "OFF"
      spa_jets_high:
        friendly_name: "Spa Jets High"
        value_template: "{{ is_state_attr('fan.spa_pump', 'preset_mode', 'HI') }}"
        turn_on:
          service: fan.set_preset_mode
          target:
            entity_id: fan.spa_pump
          data:
            preset_mode: "HI"
        turn_off:
          service: fan.set_preset_mode
          target:
            entity_id: fan.spa_pump
          data:
            preset_mode: "OFF"
kmck commented 6 months ago

@robgridley thank you for posting this!

Since there isn't currently a Gecko plugin for Homebridge, I recently set up Home Assistant. I ran into the 4-switch issue as soon as I had the initial setup running, and your solution was enormously helpful.

I tweaked it slightly to make each pump appears in HomeKit as a single fan, which I think looks a little better in the Home App (and also the low pump setting on my swim spa is basically standby for when the heater is running). I haven't tried using it with Siri to see how it compares from a voice command perspective.

fan:
  - platform: template
    fans:
      spa_jets:
        friendly_name: "Spa Jets"
        value_template: "{{ not is_state_attr('fan.hydropool_aquaplay_12_ffp_pump_1', 'preset_mode', 'OFF') }}"
        percentage_template: >-
          {% if is_state_attr('fan.hydropool_aquaplay_12_ffp_pump_1', 'preset_mode', 'HI') %}
            100
          {% elif is_state_attr('fan.hydropool_aquaplay_12_ffp_pump_1', 'preset_mode', 'LO') %}
            50
          {% else %}
            0
          {% endif %}
        turn_on:
          service: fan.set_preset_mode
          target:
            entity_id: fan.hydropool_aquaplay_12_ffp_pump_1
          data:
            preset_mode: "HI"
        turn_off:
          service: fan.set_preset_mode
          target:
            entity_id: fan.hydropool_aquaplay_12_ffp_pump_1
          data:
            preset_mode: "OFF"
        set_percentage:
          - service: fan.set_preset_mode
            target:
              entity_id: fan.hydropool_aquaplay_12_ffp_pump_1
            data:
              preset_mode: >-
                {% if percentage > 50 %}
                  HI
                {% elif percentage == 50 %}
                  LO
                {% else %}
                  OFF
                {% endif %}
        speed_count: 2

For the benefit of anyone else who isn't familiar with Home Assistant: that code goes directly into the root configuration.yaml of the HA instance and will create a fan.spa_jets template fan entity. The fan.hydropool_aquaplay_12_ffp_pump_1 corresponds to whatever entities that gecko-home-assistant created and should be edited to whatever ID the pump has in your actual setup.