diff --git a/packages/binary_sensor/puerta_tendedero.yaml b/packages/binary_sensor/puerta_tendedero.yaml index a261613..c56d182 100644 --- a/packages/binary_sensor/puerta_tendedero.yaml +++ b/packages/binary_sensor/puerta_tendedero.yaml @@ -7,6 +7,11 @@ binary_sensor: - binary_sensor.puerta_tendedero_primario - binary_sensor.puerta_tendedero_secundario value_template: >- - {{ is_state('binary_sensor.puerta_tendedero_primario','on') or is_state('binary_sensor.puerta_tendedero_secundario','on') }} + {% if as_timestamp(states.binary_sensor.puerta_tendedero_secundario.last_changed) <= + as_timestamp(states.binary_sensor.puerta_tendedero_primario.last_changed) -%} + {{ states('binary_sensor.puerta_tendedero_primario') }} + {%- else -%} + {{ states('binary_sensor.puerta_tendedero_secundario') }} + {%- endif -%} device_class: door