diff --git a/esphome/esp-officeduallights.yaml b/esphome/esp-officeduallights.yaml index 11de242..8d7351e 100644 --- a/esphome/esp-officeduallights.yaml +++ b/esphome/esp-officeduallights.yaml @@ -241,13 +241,21 @@ mqtt: payload: "On" then: - script.stop: relay_1_timer_script - - light.turn_on: light_1 + - if: + condition: + lambda: "return !id(relay_1).state;" + then: + - light.turn_on: light_1 - topic: "${mqtt_local_command1_topic}" payload: "Off" then: - script.stop: relay_1_timer_script - - light.turn_off: light_1 + - if: + condition: + lambda: "return id(relay_1).state;" + then: + - light.turn_off: light_1 - topic: "${mqtt_local_command1_topic}" then: @@ -279,13 +287,21 @@ mqtt: payload: "On" then: - script.stop: relay_2_timer_script - - light.turn_on: light_2 + - if: + condition: + lambda: "return !id(relay_2).state;" + then: + - light.turn_on: light_2 - topic: "${mqtt_local_command2_topic}" payload: "Off" then: - script.stop: relay_2_timer_script - - light.turn_off: light_2 + - if: + condition: + lambda: "return id(relay_2).state;" + then: + - light.turn_off: light_2 - topic: "${mqtt_local_command2_topic}" then: