New to homeassitant, and got a question for you guys and gals…
I want to create a script that could toggle the cover when called. I understand that I can create one script to open, and one to close, using the sintax:
alias: Open Cover
service: cover.open_cover
data:
entity_id: cover.mqtt_cover
But I want to link this script to a IFTTT button on IOS, so ideally I just want one button, and if the garage is open I want the script to close the cover, if it is closed I want to to open it.
So the script needs to read the current status, and request the opposite… is it possible?
Awesome stuff. Is there a way to integrate this into a MQTT Publish sequence? I have the following to create a MQTT Toggle button in MQTT Dash and it works extremely well but your template may well tidy that up even further.
### Closes garage door (if open) when publishing to display/kitchen/touch/garage ###
### with the payload as 'Closed' which matches the subscribe state in MQTT Dashboard ###
- alias: MQTT Garage Close
hide_entity: true
condition:
- condition: state
entity_id: cover.garage
state: 'open'
trigger:
- platform: mqtt
topic: "display/kitchen/touch/garage"
payload: "Closed"
action:
- service: cover.close_cover
entity_id: cover.garage
### Opens garage door (if closed) when publishing to display/kitchen/touch/garage ###
### with the payload as 'Open' which matches the subscribe state in MQTT Dashboard ###
- alias: MQTT Garage Open
hide_entity: true
condition:
- condition: state
entity_id: cover.garage
state: 'closed'
trigger:
- platform: mqtt
topic: "display/kitchen/touch/garage"
payload: "Open"
action:
- service: cover.open_cover
entity_id: cover.garage