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
