Advertisement
adorobis

gate template cover

Jan 16th, 2025
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. - platform: template
  2. covers:
  3. gate:
  4. unique_id: gate_template
  5. device_class: gate
  6. friendly_name: "Gate"
  7. availability_template : '{{ not (is_state("cover.brama", "unavailable") or is_state("cover.brama", "unknown")) }}'
  8. value_template: >
  9. {% if states("binary_sensor.gate_left_closing") == "on" or states("binary_sensor.gate_right_closing") == "on" %}
  10. closing
  11. {% elif states("binary_sensor.gate_left_opening") == "on" or states("binary_sensor.gate_right_opening") == "on" %}
  12. opening
  13. {% elif states("cover.brama") == "closed" %}
  14. closed
  15. {% else %}
  16. open
  17. {% endif %}
  18. position_template: >
  19. {% if states("cover.brama") == "closed" %}
  20. 0
  21. {% elif states("input_boolean.gate_open") == "on" %}
  22. 100
  23. {% else %}
  24. 50
  25. {% endif %}
  26. open_cover:
  27. service: script.gate_open
  28. close_cover:
  29. service: script.gate_close
  30. stop_cover:
  31. service: script.gate_stop
  32. icon_template: >
  33. {% if states("binary_sensor.gate_left_closing") == "on" or states("binary_sensor.gate_right_closing") == "on" %}
  34. mdi:format-horizontal-align-center
  35. {% elif states("binary_sensor.gate_left_opening") == "on" or states("binary_sensor.gate_right_opening") == "on" %}
  36. mdi:arrow-expand-horizontal
  37. {% elif states("cover.brama") == "closed" %}
  38. mdi:gate
  39. {% else %}
  40. mdi:gate-open
  41. {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement