#Call service based on which switch is toggled

1 messages · Page 1 of 1 (latest)

open cairn
#

I'm trying to create an automation to send feedbacks to my A/C control hub, it has 7 different feedbacks and when any of it is being triggered, can the the automation understand which feedback should be send to the hub.

- id: ' '
  alias: Feedbacks
  description: ''
  trigger:
  - platform: state
    entity_id:
    - input_button.too_warm
    - input_button.bit_warm
    - input_button.too_hot
    - input_button.comfort
    - input_button.freezing
    - input_button.too_cold
    - input_button.bit_cold
  action:
  - service: >
      {% if trigger.entity_id == "input_button.comfort" %}
        send_comfort_feedback
        data:
          name: Room
          value: Comfort
  mode: single
dense cape
#

```yaml
CODE HERE
```

#

What you're trying to do works, but not the way you're doing it

#

#templates-archived can explain how templates work, but you can template the service or the payload, but not the whole block

open cairn
#

I am very new to HA and coding, any tips or guides would be much appreciated

dense cape
#
  - service: >
        SOMETHING.send_comfort_feedback
        data:
          name: Room
          value: >-
            {% if trigger.entity_id == "input_button.comfort" %}
              Comfort
            {% elif ... %}