diff --git a/localbytes-plug-pm.yaml b/localbytes-plug-pm.yaml index e5a3810..f01b682 100644 --- a/localbytes-plug-pm.yaml +++ b/localbytes-plug-pm.yaml @@ -24,7 +24,15 @@ esphome: # configuration and updates. project: name: localbytes.plug-pm - version: "1.6.2" + version: "1.6.3" + + on_boot: + priority: 300 + then: + #Signal to the template switches that their initial values have been loaded + globals.set: + id: setupComplete + value: "true" esp8266: board: esp01_1m @@ -100,6 +108,11 @@ globals: type: float restore_value: true initial_value: "0.805" + + - id: setupComplete + type: bool + restore_value: no + initial_value: "false" binary_sensor: # Push Button (Toggles Relay When Pressed) @@ -145,11 +158,9 @@ switch: condition: switch.is_off: disable_led then: - light.turn_on: - id: led + light.turn_on: led on_turn_off: - - light.turn_off: - id: led + - light.turn_off: led - platform: template name: "Disable LED" @@ -158,27 +169,35 @@ switch: restore_mode: RESTORE_DEFAULT_OFF optimistic: true on_turn_on: - #Flash twice - - light.turn_off: led - - delay: 0.1s - - light.turn_on: led - - delay: 0.1s - - light.turn_off: led - - delay: 0.1s - - light.turn_on: led - - delay: 0.1s + - if: + condition: + lambda: 'return id(setupComplete) == true;' + then: + #Flash twice + - light.turn_off: led + - delay: 0.15s + - light.turn_on: led + - delay: 0.15s + - light.turn_off: led + - delay: 0.15s + - light.turn_on: led + - delay: 0.15s #Final state - light.turn_off: led on_turn_off: - #Flash twice - - light.turn_on: led - - delay: 0.1s - - light.turn_off: led - - delay: 0.1s - - light.turn_on: led - - delay: 0.1s - - light.turn_off: led - - delay: 0.7s + - if: + condition: + lambda: 'return id(setupComplete) == true;' + then: + #Flash twice + - light.turn_on: led + - delay: 0.15s + - light.turn_off: led + - delay: 0.15s + - light.turn_on: led + - delay: 0.15s + - light.turn_off: led + - delay: 1s #Final state - if: condition: @@ -195,43 +214,54 @@ switch: restore_mode: RESTORE_DEFAULT_OFF optimistic: true on_turn_on: - #Flash thrice - - light.turn_off: led - - delay: 0.15s - - light.turn_on: led - - delay: 0.15s - - light.turn_off: led - - delay: 0.15s - - light.turn_on: led - - delay: 0.15s - - light.turn_off: led - - delay: 0.15s - - light.turn_on: led - - delay: 0.15s + - if: + condition: + lambda: 'return id(setupComplete) == true;' + then: + #Flash thrice + - light.turn_off: led + - delay: 0.15s + - light.turn_on: led + - delay: 0.15s + - light.turn_off: led + - delay: 0.15s + - light.turn_on: led + - delay: 0.15s + - light.turn_off: led + - delay: 0.15s + - light.turn_on: led + - delay: 0.15s #Final state - if: condition: - switch.is_off: relay + or: + - switch.is_off: relay + - switch.is_on: disable_led then: light.turn_off: led on_turn_off: - #Flash thrice - - light.turn_on: led - - delay: 0.15s - - light.turn_off: led - - delay: 0.15s - - light.turn_on: led - - delay: 0.15s - - light.turn_off: led - - delay: 0.15s - - light.turn_on: led - - delay: 0.15s - - light.turn_off: led - - delay: 0.7s + - if: + condition: + lambda: 'return id(setupComplete) == true;' + then: + #Flash thrice + - light.turn_on: led + - delay: 0.15s + - light.turn_off: led + - delay: 0.15s + - light.turn_on: led + - delay: 0.15s + - light.turn_off: led + - delay: 0.15s + - light.turn_on: led + - delay: 0.15s + - light.turn_off: led + - delay: 1s #Final state - if: condition: - switch.is_on: relay + - switch.is_on: relay + - switch.is_off: disable_led then: light.turn_on: led