I am needing help. I have a old garage door(dumb opener). I put a Ecolink tilt sensor on it so I can tell if it is open or closed. I then purchased a sonoff momentary relay to act as the wall push button and control the opener. I can open and close the door remotely, and see the status of the tilt sensor. But they are 2 different cards/buttons on my dashboard.
I would like to combine the 2 into one button. I followed the guide here but am not able to get it to work.
Here is the code I am using.
cover:
- platform: template
covers:
garage_door:
device_class: garage
friendly_name: "Back Garage Door"
position_template: "{{ states('binary_sensor.tilt_sensor_back_garage') }}"
open_cover:
- condition: state
entity_id: binary_sensor.tilt_sensor_back_garage
state: "off"
- service: switch.turn_on
target:
entity_id: switch.sonoff_1001090342
close_cover:
- condition: state
entity_id: binary_sensor.tilt_sensor_back_garage
state: "on"
- service: switch.turn_off
target:
entity_id: switch.sonoff_1001090342
stop_cover:
service: switch.turn_off
target:
entity_id: switch.sonoff_1001090342
icon_template: >-
{% if states('binary_sensor.tilt_sensor_back_garage')|float > 0 %}
mdi:garage-open
{% else %}
mdi:garage
{% endif %}
Here are the errors I get:
1st error:
Logger: homeassistant.helpers.template
Source: helpers/template.py:1286
First occurred: 9:40:14 AM (9 occurrences)
Last logged: 3:33:34 PM
Template warning: ‘float’ got invalid input ‘off’ when rendering template ‘{% if states(‘binary_sensor.tilt_sensor_back_garage’)|float > 0 %} mdi:garage-open {% else %} mdi:garage {% endif %}’ but no default was specified. Currently ‘float’ will return ‘0’, however this template will fail to render in Home Assistant core 2022.1
Template warning: ‘float’ got invalid input ‘on’ when rendering template ‘{% if states(‘binary_sensor.tilt_sensor_back_garage’)|float > 0 %} mdi:garage-open {% else %} mdi:garage {% endif %}’ but no default was specified. Currently ‘float’ will return ‘0’, however this template will fail to render in Home Assistant core 2022.1
Logger: homeassistant.components.template.cover
Source: components/template/cover.py:244
Integration: Template (documentation, issues)
First occurred: 9:33:16 AM (10 occurrences)
Last logged: 3:33:34 PM
2nd error:
could not convert string to float: ‘off’
could not convert string to float: ‘on’
Any help would be great.
Thanks
1 post - 1 participant