substitutions: devicename: ff-akwarium-plug-01 low_devicename: ff_akwarium_plug_01 friendly_devicename: FF Akwarium Light 01 memory_delay: 15s relay_delay: 40ms esphome: name: $devicename friendly_name: $friendly_devicename platformio_options: lib_ignore: - RPAsyncTCP on_boot: then: - light.turn_on: id: blue_led effect: strobe bk72xx: board: generic-bk7231t-qfn32-tuya #framework: # version: dev packages: # Enable Home Assistant API esphome: !include common/keys.yaml diag: !include common/diag.yaml # Enable logging logger: web_server: port: 80 wifi: ssid: !secret iot_ssid password: !secret iot_password domain: .int.mmax.cloud binary_sensor: - platform: gpio pin: number: P7 inverted: true mode: input: true pullup: true name: "Power Button" on_press: - switch.toggle: relay - light.turn_on: id: blue_led effect: strobe # - select.next: # id: light_mode # cycle: true light: - platform: binary name: Red LED id: red_led output: led_1 internal: True restore_mode: ALWAYS_OFF - platform: binary name: Red LED id: blue_led output: led_2 effects: - strobe: # transition_length: 50ms # update_interval: 50ms output: - platform: gpio # RED id: led_1 pin: number: P6 inverted: false - platform: gpio # BLUE id: led_2 pin: number: P26 inverted: false globals: - id: current_light type: int initial_value: "0" select: - platform: template name: "Light Mode" id: light_mode options: - "Off" - "Day" - "Daybreak" - "Night" optimistic: true on_value: then: - if: condition: - lambda: |- return(id(light_mode).state) == "Off"; then: - light.turn_off: red_led - light.turn_off: blue_led - switch.turn_off: relay - if: condition: - lambda: |- return(id(light_mode).state) == "Day"; then: - light.turn_off: blue_led - light.turn_on: red_led - switch.turn_off: relay - light.turn_on: red_led - delay: $memory_delay - switch.turn_on: relay - if: condition: - lambda: |- return(id(light_mode).state) == "Daybreak"; then: - light.turn_off: blue_led - light.turn_on: red_led - switch.turn_off: relay - light.turn_on: red_led - delay: $memory_delay - switch.turn_on: relay - delay: $relay_delay - switch.turn_off: relay - delay: $relay_delay - switch.turn_on: relay - if: condition: - lambda: |- return(id(light_mode).state) == "Night"; then: - light.turn_off: blue_led - light.turn_on: red_led - switch.turn_off: relay - light.turn_on: red_led - delay: $memory_delay - switch.turn_on: relay - delay: $relay_delay - switch.turn_off: relay - delay: $relay_delay - switch.turn_on: relay - delay: $relay_delay - switch.turn_off: relay - delay: $relay_delay - switch.turn_on: relay - lambda: |- id(current_light) == id(light_mode).active_index(); switch: - platform: gpio pin: P8 id: relay internal: true restore_mode: ALWAYS_OFF # Turn off red LED to show blue when turned on on_turn_on: - light.turn_on: red_led # # - switch.turn_off: led_1 # # Turns on the red LED once the plug is turned off on_turn_off: - light.turn_off: red_led # # - switch.turn_on: led_1 # - platform: template # name: mode # output: relay # internal: True # effects: # - lambda: # name: Day # - lambda: # name: Daybreak # - lambda: # name: Night