Skip to content

Commit

Permalink
Update localbytes-plug-pm.yaml
Browse files Browse the repository at this point in the history
Fixed a bug with restoring the state of `disable_led`.
  • Loading branch information
JamesSwift authored Aug 18, 2023
1 parent a5b5e3a commit dbebb63
Showing 1 changed file with 81 additions and 51 deletions.
132 changes: 81 additions & 51 deletions localbytes-plug-pm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand All @@ -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:
Expand All @@ -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

Expand Down

0 comments on commit dbebb63

Please sign in to comment.