Hi. For the gate opener I need a status indication OPEN/CLOSE.
it might be on the line of gate related switch or in the form of “single sensor” indication.
This status is based on 2 sensors where one is ON second OFF for OPEN and vice versa.
Switch “toggle” gate only, i.e. one click/impuls - gate opens, next click - gate closes.
At the same time gate might be opened by its own remote.
I would like to have an indication if it is open or closed.
I am able to read and indicate each sensor separately but not able to use them together.
Hm, I have 2 sensors-Alarm and Alarm2. Both are working separately. It seems to me that I cannot use them together in template. Well, be more specific I am not able to use them as I need.
Please advice.
- platform: template
sensors:
gate:
friendly_name: "Test"
value_template: >-
{% if is_state('sensor.alarm2', 'ON' ) %}
{% if is_state('sensor.alarm', 'OFF' ) %}
OPEN
{% endif %}
{% elif is_state('sensor.alarm2', 'OFF' ) %}
{% if is_state('sensor.alarm', 'ON' ) %}
CLOSE
{% else %}
MOVE
{% endif %}
{% endif %}
One last thing I need to solve within those sensors is how to achieve their “immediate” reaction on the change. Now I am using short telemetry period ( 10 sec ) but I do not think it is the best solution.
If I checked sonoff console, sensor connected to GPIO14 of sonoff is publishing MQTT cmnd/ and tele/ but no stat/ stat/ is published by the main switch only.
So far I do not know how to change it.
Regarding template it was was tough way back to school time and force me to refresh programming basis.
I am curious what will be the next challenge