longquo
(LongQuo)
1
Hi All,
I’m new to this HA.
Trying to set up the garage_door template from:
Have these:
Sensor: binary_sensor.port1_sensor
Switch: switch.sonoff_100086f177 (inching 1sec mode)
Garage input: Impulse to trigger port up/stop/down/stop…
I want to change the garage icon to match the sensor state and up/down arrow. But somehow the state not updating?
Have this right now:
cover:
- platform: template
covers:
garage_door:
device_class: garage
friendly_name: "Garage Door"
position_template: "{{ states('binary_sensor.port1_sensor') }}"
open_cover:
- condition: state
entity_id: binary_sensor.port1_sensor
state: "off"
- service: switch.turn_on
target:
entity_id: switch.sonoff_100086f177
close_cover:
- condition: state
entity_id: binary_sensor.port1_sensor
state: "on"
- service: switch.turn_on
target:
entity_id: switch.sonoff_100086f177
stop_cover:
service: switch.turn_on
target:
entity_id: switch.sonoff_100086f177
icon_template: >-
{% if states('binary_sensor.port1_sensor')|float > 0 %}
mdi:garage-open
{% else %}
mdi:garage
{% endif %}
koying
(Chris B)
2
position_template
wants a percentage value, not “on”/“off”.
longquo
(LongQuo)
3
Ahh i see…thanks for the pointers after that i got it to work
Is there a way to change the color on the port? so when it open it green and red when it closed?
final template;
cover:
- platform: template
covers:
garage_door1:
device_class: garage
friendly_name: "Garage Port 1"
value_template: "{{is_state('binary_sensor.port1_sensor', 'on')}}"
open_cover:
- condition: state
entity_id: binary_sensor.port1_sensor
state: "off"
- service: switch.turn_on
target:
entity_id: switch.sonoff_100086f177
close_cover:
- condition: state
entity_id: binary_sensor.port1_sensor
state: "on"
- service: switch.turn_on
target:
entity_id: switch.sonoff_100086f177
stop_cover:
service: switch.turn_on
target:
entity_id: switch.sonoff_100086f177
icon_template: >-
{% if is_state('binary_sensor.port1_sensor', 'on') %}
mdi:garage-open
{% else %}
mdi:garage
{% endif %}
longquo
(LongQuo)
4
Is there a way to change the color on the mdi:garage-open ?
cover:
- platform: template
covers:
garage_door1:
device_class: garage
friendly_name: "Garage Port 1"
value_template: "{{is_state('binary_sensor.door_mccgq11lm_port1_contact', 'on')}}"
open_cover:
- condition: state
entity_id: binary_sensor.door_mccgq11lm_port1_contact
state: "off"
- service: switch.turn_on
target:
entity_id: switch.shellyplus1_garage1
close_cover:
- condition: state
entity_id: binary_sensor.door_mccgq11lm_port1_contact
state: "on"
- service: switch.turn_on
target:
entity_id: switch.shellyplus1_garage1
stop_cover:
service: switch.turn_on
target:
entity_id: switch.shellyplus1_garage1
icon_template: >-
{% if is_state('binary_sensor.door_mccgq11lm_port1_contact', 'on') %}
mdi:garage-open
{% else %}
mdi:garage
{% endif %}