|
@@ -1,7 +1,7 @@
|
|
|
substitutions:
|
|
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 Plug 01
|
|
|
|
|
|
|
+ friendly_devicename: FF Akwarium Light 01
|
|
|
|
|
|
|
|
esphome:
|
|
esphome:
|
|
|
name: $devicename
|
|
name: $devicename
|
|
@@ -85,6 +85,9 @@ binary_sensor:
|
|
|
name: "Power Button"
|
|
name: "Power Button"
|
|
|
on_press:
|
|
on_press:
|
|
|
- switch.toggle: relay
|
|
- switch.toggle: relay
|
|
|
|
|
+ - select.next:
|
|
|
|
|
+ id: mode
|
|
|
|
|
+ cycle: true
|
|
|
|
|
|
|
|
switch:
|
|
switch:
|
|
|
- platform: gpio
|
|
- platform: gpio
|
|
@@ -102,10 +105,10 @@ switch:
|
|
|
inverted: false
|
|
inverted: false
|
|
|
|
|
|
|
|
- platform: gpio
|
|
- platform: gpio
|
|
|
- name: Switch
|
|
|
|
|
pin: P8
|
|
pin: P8
|
|
|
id: relay
|
|
id: relay
|
|
|
-
|
|
|
|
|
|
|
+ internal: true
|
|
|
|
|
+
|
|
|
# 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:
|
|
|
- switch.turn_on: led_2
|
|
- switch.turn_on: led_2
|
|
@@ -121,3 +124,78 @@ button:
|
|
|
id: restart_button
|
|
id: restart_button
|
|
|
name: Restart
|
|
name: Restart
|
|
|
entity_category: diagnostic
|
|
entity_category: diagnostic
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+globals:
|
|
|
|
|
+ - id: current_light
|
|
|
|
|
+ type: select
|
|
|
|
|
+ restore_value: True
|
|
|
|
|
+ initial_value: "0"
|
|
|
|
|
+
|
|
|
|
|
+select:
|
|
|
|
|
+ - platform: template
|
|
|
|
|
+ name: "Light Mode"
|
|
|
|
|
+ id: mode
|
|
|
|
|
+ options:
|
|
|
|
|
+ - "Off"
|
|
|
|
|
+ - "Day"
|
|
|
|
|
+ - Daybreak
|
|
|
|
|
+ - Night
|
|
|
|
|
+ optimistic: true
|
|
|
|
|
+ on_value:
|
|
|
|
|
+ then:
|
|
|
|
|
+ - if:
|
|
|
|
|
+ condition:
|
|
|
|
|
+ - lambda: |-
|
|
|
|
|
+ return(id(mode).state) == "Off";
|
|
|
|
|
+ then:
|
|
|
|
|
+ - switch.turn_off: relay
|
|
|
|
|
+ - if:
|
|
|
|
|
+ condition:
|
|
|
|
|
+ - lambda: |-
|
|
|
|
|
+ return(id(mode).state) == "Day";
|
|
|
|
|
+ then:
|
|
|
|
|
+ - switch.turn_off: relay
|
|
|
|
|
+ - delay: 20s
|
|
|
|
|
+ - switch.turn_on: relay
|
|
|
|
|
+ - if:
|
|
|
|
|
+ condition:
|
|
|
|
|
+ - lambda: |-
|
|
|
|
|
+ return(id(mode).state) == "Daybreak";
|
|
|
|
|
+ then:
|
|
|
|
|
+ - switch.turn_off: relay
|
|
|
|
|
+ - delay: 20s
|
|
|
|
|
+ - switch.turn_on: relay
|
|
|
|
|
+ - delay: 200ms
|
|
|
|
|
+ - switch.turn_off: relay
|
|
|
|
|
+ - delay: 200ms
|
|
|
|
|
+ - switch.turn_on: relay
|
|
|
|
|
+
|
|
|
|
|
+ - if:
|
|
|
|
|
+ condition:
|
|
|
|
|
+ - lambda: |-
|
|
|
|
|
+ return(id(mode).state) == "Night";
|
|
|
|
|
+ then:
|
|
|
|
|
+ - switch.turn_off: relay
|
|
|
|
|
+ - delay: 20s
|
|
|
|
|
+ - switch.turn_on: relay
|
|
|
|
|
+ - delay: 200ms
|
|
|
|
|
+ - switch.turn_off: relay
|
|
|
|
|
+ - delay: 200ms
|
|
|
|
|
+ - switch.turn_on: relay
|
|
|
|
|
+ - switch.turn_off: relay
|
|
|
|
|
+ - delay: 200ms
|
|
|
|
|
+ - switch.turn_on: relay
|
|
|
|
|
+
|
|
|
|
|
+light:
|
|
|
|
|
+ - platform: template
|
|
|
|
|
+ name: None
|
|
|
|
|
+ restore_mode: RESTORE_AND_OFF
|
|
|
|
|
+ effects:
|
|
|
|
|
+ - lambda:
|
|
|
|
|
+ name: Day
|
|
|
|
|
+ - lambda:
|
|
|
|
|
+ name: Daybreak
|
|
|
|
|
+ - lambda:
|
|
|
|
|
+ name: Night
|
|
|
|
|
+
|