Help me create an automation with my dash button to control my garage door

Hello all,

I have some dash buttons that I have successfully configured using daher and would like to use one of them as a garage door opener. Since the dash button can only be configured to respond to a single press, I am trying to figure out the best way to toggle my garage doors (from open to close or vice versa). I would use garageio to send the open and close command through IFTTT, and I do know the current state of the garage door (open or closed). How do I make a press of my dash button send the appropriate command - do I create some sort of logical toggle switch using a template?? I’m lost :slight_smile:

Thanks for any help you can provide!

Tom

Have your dash button run an automation.
Then use the state of your garage door to determine whether to call the open or close service for the cover.

see the section titled “Use templates to decide which service to call” on this page:

Thanks for pointing me in the right direction. This is the action that I use with IFTTT to close the garage door (and this does work):

action:
  service: ifttt.trigger
  data: {"event":"Garage_sue_shut"}

Here’s what I tried (just putting a bogus trigger in the automation - I only ever want it triggered manually from the Dash button - I’m sure there is a better way to do this!):

- alias: Open/Close Sue's Garage Door
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: group.garage_stall_doors
    from: 'off'
    to: 'onxxxx'
  action:
    service: ifttt.trigger
    data_template:
      data: >
        {% if is_state('binary_sensor.door_window_sensor_158d00019e0db4', 'off') %}
          {"event":"Garage_sue_open"}
        {% else %}
          {"event":"Garage_sue_shut"}
        {% endif %}  

I get this error in the log:

2017-08-13 14:30:08 ERROR (MainThread) [homeassistant.core] Invalid service data for ifttt.trigger: extra keys not allowed @ data['data']. Got '{"event":"Garage_sue_open"}'
required key not provided @ data['event']. Got None

Try this:

 - alias: Open/Close Sue's Garage Door
   initial_state: 'on'
   trigger:
     platform: state
     entity_id: group.garage_stall_door
     from: 'off'
     to: 'onxxxx'
   action:
     service: ifttt.trigger
     data_template:
       event: >
         {% if is_state('binary_sensor.door_window_sensor_158d00019e0db4', 'off') %}
           Garage_sue_open
         {% else %}
          Garage_sue_shut
         {% endif %}

Thank you for your help …better - no more error message in the log, but I am not seeing any action on the door. Have confirmed that the two events are working when I manually run them from the Services panel:

{"event":"Garage_sue_shut"}

and

{"event":"Garage_sue_open"}

Tom

perhaps the “garage_sue_shut” and “Garage_sue_open” need to be in quotes? Sorry for stabbing in the dark, there’s no way for me to test this for the right answer.

Really appreciate your help - thank you.

Putting double (or single quotes) did not fix the automation. For testing sake, I did make this change, and it did work:

  action:
    service: ifttt.trigger
    data_template:
      event: "Garage_sue_shut"
      # event: >
        # {% if is_state('binary_sensor.door_window_sensor_158d00019e0db4', 'off') %}
          # Garage_sue_open
        # {% else %}
          # Garage_sue_shut
        # {% endif %}

…and I rebooted … and it is now working. Thanks @treno for your help!

1 Like