diff --git a/automations.yaml b/automations.yaml index 339c688..dbbaab8 100644 --- a/automations.yaml +++ b/automations.yaml @@ -39,10 +39,10 @@ alias: Garagem - Warn gate Open description: '' trigger: - - entity_id: cover.portao_garagem - from: closed + - entity_id: binary_sensor.portao_garagem_input + from: 'on' platform: state - to: open + to: 'off' condition: [] action: - data: @@ -53,10 +53,10 @@ alias: Garagem - warn gate closed description: '' trigger: - - entity_id: cover.portao_garagem - from: open + - entity_id: binary_sensor.portao_garagem_input + from: 'off' platform: state - to: closed + to: 'on' condition: [] action: - data: @@ -401,9 +401,9 @@ description: '' trigger: - entity_id: cover.portao_garagem - from: closed + from: 'On' platform: state - to: open + to: 'Off' condition: - condition: or conditions: @@ -419,6 +419,7 @@ - service: light.turn_on target: entity_id: light.luz_garagem_2 + data: {} - delay: hours: 0 minutes: 5 @@ -427,6 +428,7 @@ - service: light.turn_off target: entity_id: light.luz_garagem_2 + data: {} - service: notify.buttler data: message: luz desligada diff --git a/cover.yaml b/cover.yaml index 24e21b4..7979a3d 100755 --- a/cover.yaml +++ b/cover.yaml @@ -1,13 +1,30 @@ -# - platform: mqtt -# name: "Portao Garagem" -# state_topic: "garageGate/state" -# command_topic: "garageGate/cmd" -# qos: 1 -#payload_open: "push" -#payload_close: "push" -#payload_stop: "push" -# state_open: "ope" -# state_closed: "close" -# optimistic: true -# retain: true -# device_class: garage +- platform: template + covers: + garage_door: + device_class: garage + friendly_name: "Garage Door" + position_template: "{{ is_state('binary_sensor.portao_garagem_input') }}" + open_cover: + - condition: state + entity_id: binary_sensor.portao_garagem_input + state: "off" + - service: switch.turn_off + target: + entity_id: switch.portao_garagem + close_cover: + - condition: state + entity_id: binary_sensor.portao_garagem_input + state: "on" + - service: switch.turn_on + target: + entity_id: switch.portao_garagem + stop_cover: + service: switch.turn_on + target: + entity_id: switch.portao_garagem + icon_template: >- + {% if is_state('binary_sensor.portao_garagem_input','off') %} + mdi:garage-open + {% else %} + mdi:garage + {% endif %}