#code

1 messages · Page 1 of 1 (latest)

glass sparrow
#

code

#

cover:

  • platform: template
    covers:
    garage_door:
    device_class: garage
    friendly_name: "Garagentor"
    open_cover:
    - condition: state
    entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_28a2a403_on_off
    state: "close"
    - service: switch.toggle
    target:
    entity_id: switch.garagentor_trigger
    close_cover:
    - condition: state
    entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_28a2a403_on_off
    state: "open"
    - service: switch.toggle
    target:
    entity_id: switch.garagentor_trigger
    stop_cover:
    service: switch.toggle
    target:
    entity_id: switch.garagentor_trigger

    value_template: >-
      {% if is_state('binary_sensor.lumi_lumi_sensor_magnet_aq2_78695d02_on_off', 'open') and  is_state('binary_sensor.lumi_lumi_sensor_magnet_aq2_28a2a403_on_off', 'open') %}
      {%    if ('input_number.garage_last_state' == 0) %}
              closing
      {%    else %}
              opening
      {%    endif %}
      {% elif is_state('binary_sensor.lumi_lumi_sensor_magnet_aq2_78695d02_on_off', 'open') and  is_state('binary_sensor.lumi_lumi_sensor_magnet_aq2_28a2a403_on_off', 'closed') %}
        closed
      {% set input_number.garage_last_state = 1 %}
      {% elif is_state('binary_sensor.lumi_lumi_sensor_magnet_aq2_78695d02_on_off', 'closed') and  is_state('binary_sensor.lumi_lumi_sensor_magnet_aq2_28a2a403_on_off', 'open') %}
        open
        {% set input_number.garage_last_state = 0 %}
      {% endif %}
    
#

sry, don´t yet know how to do this formatting