|
@@ -2,6 +2,8 @@ substitutions:
|
|
|
devicename: ff-akwarium-plug-01
|
|
devicename: ff-akwarium-plug-01
|
|
|
low_devicename: ff_akwarium_plug_01
|
|
low_devicename: ff_akwarium_plug_01
|
|
|
friendly_devicename: FF Akwarium Light 01
|
|
friendly_devicename: FF Akwarium Light 01
|
|
|
|
|
+ memory_delay: 15s
|
|
|
|
|
+ relay_delay: 40ms
|
|
|
|
|
|
|
|
esphome:
|
|
esphome:
|
|
|
name: $devicename
|
|
name: $devicename
|
|
@@ -9,6 +11,11 @@ esphome:
|
|
|
platformio_options:
|
|
platformio_options:
|
|
|
lib_ignore:
|
|
lib_ignore:
|
|
|
- RPAsyncTCP
|
|
- RPAsyncTCP
|
|
|
|
|
+ on_boot:
|
|
|
|
|
+ then:
|
|
|
|
|
+ - light.turn_on:
|
|
|
|
|
+ id: blue_led
|
|
|
|
|
+ effect: strobe
|
|
|
|
|
|
|
|
bk72xx:
|
|
bk72xx:
|
|
|
board: generic-bk7231t-qfn32-tuya
|
|
board: generic-bk7231t-qfn32-tuya
|
|
@@ -41,10 +48,13 @@ binary_sensor:
|
|
|
pullup: true
|
|
pullup: true
|
|
|
name: "Power Button"
|
|
name: "Power Button"
|
|
|
on_press:
|
|
on_press:
|
|
|
- # - output.toggle: relay
|
|
|
|
|
- - select.next:
|
|
|
|
|
- id: light_mode
|
|
|
|
|
- cycle: true
|
|
|
|
|
|
|
+ - switch.toggle: relay
|
|
|
|
|
+ - light.turn_on:
|
|
|
|
|
+ id: blue_led
|
|
|
|
|
+ effect: strobe
|
|
|
|
|
+ # - select.next:
|
|
|
|
|
+ # id: light_mode
|
|
|
|
|
+ # cycle: true
|
|
|
|
|
|
|
|
light:
|
|
light:
|
|
|
- platform: binary
|
|
- platform: binary
|
|
@@ -53,7 +63,15 @@ light:
|
|
|
output: led_1
|
|
output: led_1
|
|
|
internal: True
|
|
internal: True
|
|
|
restore_mode: ALWAYS_OFF
|
|
restore_mode: ALWAYS_OFF
|
|
|
-
|
|
|
|
|
|
|
+ - platform: binary
|
|
|
|
|
+ name: Red LED
|
|
|
|
|
+ id: blue_led
|
|
|
|
|
+ output: led_2
|
|
|
|
|
+ effects:
|
|
|
|
|
+ - strobe:
|
|
|
|
|
+# transition_length: 50ms
|
|
|
|
|
+# update_interval: 50ms
|
|
|
|
|
+
|
|
|
output:
|
|
output:
|
|
|
- platform: gpio
|
|
- platform: gpio
|
|
|
# RED
|
|
# RED
|
|
@@ -62,13 +80,13 @@ output:
|
|
|
number: P6
|
|
number: P6
|
|
|
inverted: false
|
|
inverted: false
|
|
|
|
|
|
|
|
-# - platform: gpio
|
|
|
|
|
-# # BLUE
|
|
|
|
|
-# id: led_2
|
|
|
|
|
-status_led:
|
|
|
|
|
- pin:
|
|
|
|
|
- number: P26
|
|
|
|
|
- inverted: false
|
|
|
|
|
|
|
+ - platform: gpio
|
|
|
|
|
+ # BLUE
|
|
|
|
|
+ id: led_2
|
|
|
|
|
+ pin:
|
|
|
|
|
+ number: P26
|
|
|
|
|
+ inverted: false
|
|
|
|
|
+
|
|
|
|
|
|
|
|
globals:
|
|
globals:
|
|
|
- id: current_light
|
|
- id: current_light
|
|
@@ -92,26 +110,34 @@ select:
|
|
|
- lambda: |-
|
|
- lambda: |-
|
|
|
return(id(light_mode).state) == "Off";
|
|
return(id(light_mode).state) == "Off";
|
|
|
then:
|
|
then:
|
|
|
|
|
+ - light.turn_off: red_led
|
|
|
|
|
+ - light.turn_off: blue_led
|
|
|
- switch.turn_off: relay
|
|
- switch.turn_off: relay
|
|
|
- if:
|
|
- if:
|
|
|
condition:
|
|
condition:
|
|
|
- lambda: |-
|
|
- lambda: |-
|
|
|
return(id(light_mode).state) == "Day";
|
|
return(id(light_mode).state) == "Day";
|
|
|
then:
|
|
then:
|
|
|
|
|
+ - light.turn_off: blue_led
|
|
|
|
|
+ - light.turn_on: red_led
|
|
|
- switch.turn_off: relay
|
|
- switch.turn_off: relay
|
|
|
- - delay: 20s
|
|
|
|
|
|
|
+ - light.turn_on: red_led
|
|
|
|
|
+ - delay: $memory_delay
|
|
|
- switch.turn_on: relay
|
|
- switch.turn_on: relay
|
|
|
- if:
|
|
- if:
|
|
|
condition:
|
|
condition:
|
|
|
- lambda: |-
|
|
- lambda: |-
|
|
|
return(id(light_mode).state) == "Daybreak";
|
|
return(id(light_mode).state) == "Daybreak";
|
|
|
then:
|
|
then:
|
|
|
|
|
+ - light.turn_off: blue_led
|
|
|
|
|
+ - light.turn_on: red_led
|
|
|
- switch.turn_off: relay
|
|
- switch.turn_off: relay
|
|
|
- - delay: 20s
|
|
|
|
|
|
|
+ - light.turn_on: red_led
|
|
|
|
|
+ - delay: $memory_delay
|
|
|
- switch.turn_on: relay
|
|
- switch.turn_on: relay
|
|
|
- - delay: 200ms
|
|
|
|
|
|
|
+ - delay: $relay_delay
|
|
|
- switch.turn_off: relay
|
|
- switch.turn_off: relay
|
|
|
- - delay: 200ms
|
|
|
|
|
|
|
+ - delay: $relay_delay
|
|
|
- switch.turn_on: relay
|
|
- switch.turn_on: relay
|
|
|
|
|
|
|
|
- if:
|
|
- if:
|
|
@@ -119,15 +145,19 @@ select:
|
|
|
- lambda: |-
|
|
- lambda: |-
|
|
|
return(id(light_mode).state) == "Night";
|
|
return(id(light_mode).state) == "Night";
|
|
|
then:
|
|
then:
|
|
|
|
|
+ - light.turn_off: blue_led
|
|
|
|
|
+ - light.turn_on: red_led
|
|
|
- switch.turn_off: relay
|
|
- switch.turn_off: relay
|
|
|
- - delay: 20s
|
|
|
|
|
|
|
+ - light.turn_on: red_led
|
|
|
|
|
+ - delay: $memory_delay
|
|
|
- switch.turn_on: relay
|
|
- switch.turn_on: relay
|
|
|
- - delay: 200ms
|
|
|
|
|
|
|
+ - delay: $relay_delay
|
|
|
- switch.turn_off: relay
|
|
- switch.turn_off: relay
|
|
|
- - delay: 200ms
|
|
|
|
|
|
|
+ - delay: $relay_delay
|
|
|
- switch.turn_on: relay
|
|
- switch.turn_on: relay
|
|
|
|
|
+ - delay: $relay_delay
|
|
|
- switch.turn_off: relay
|
|
- switch.turn_off: relay
|
|
|
- - delay: 200ms
|
|
|
|
|
|
|
+ - delay: $relay_delay
|
|
|
- switch.turn_on: relay
|
|
- switch.turn_on: relay
|
|
|
- lambda: |-
|
|
- lambda: |-
|
|
|
id(current_light) == id(light_mode).active_index();
|
|
id(current_light) == id(light_mode).active_index();
|
|
@@ -141,11 +171,11 @@ switch:
|
|
|
# Turn off red LED to show blue when turned on
|
|
# Turn off red LED to show blue when turned on
|
|
|
on_turn_on:
|
|
on_turn_on:
|
|
|
- light.turn_on: red_led
|
|
- light.turn_on: red_led
|
|
|
- # - switch.turn_off: led_1
|
|
|
|
|
- # Turns on the red LED once the plug is turned off
|
|
|
|
|
|
|
+# # - switch.turn_off: led_1
|
|
|
|
|
+# # Turns on the red LED once the plug is turned off
|
|
|
on_turn_off:
|
|
on_turn_off:
|
|
|
- light.turn_off: red_led
|
|
- light.turn_off: red_led
|
|
|
- # - switch.turn_on: led_1
|
|
|
|
|
|
|
+# # - switch.turn_on: led_1
|
|
|
# - platform: template
|
|
# - platform: template
|
|
|
# name: mode
|
|
# name: mode
|
|
|
# output: relay
|
|
# output: relay
|