# Note this device is a work in progress substitutions: device_id: pool device_name: Pool api_key: !secret pool_key pwd: !secret pool_pwd esp32_variant: esp32s3 packages: device_base: !include ./packages/device_base_esp32.yaml external_components: - source: type: local path: ./components components: [pool_controller, pzem6l24] esphome: on_boot: then: - light.turn_off: lcd_backlight - output.set_level: id: backlight_pwm_output level: 0% # - lambda: |- # id(return_temp).set_address(101); binary_sensor: - platform: gpio id: flow_main name: "Main Pump Flow" icon: mdi:waves-arrow-right pin: pcf8574: io_expander number: 4 mode: input: true inverted: true - platform: gpio id: flow_aux name: "Auxiliary Pump Flow" icon: mdi:waves-arrow-right pin: pcf8574: io_expander number: 5 mode: input: true inverted: true button: - platform: template name: "Reset Energy Counters" icon: "mdi:lightning-bolt" entity_category: diagnostic on_press: - pzem6l24.reset_energy: id: pzem phase: all display: - platform: mipi_rgb id: pool_display model: RPI update_interval: never auto_clear_enabled: false color_order: RGB pclk_frequency: 18MHz pclk_inverted: true dimensions: width: 1024 height: 600 de_pin: number: 5 hsync_pin: number: 46 ignore_strapping_warning: true vsync_pin: number: 3 ignore_strapping_warning: true pclk_pin: 7 reset_pin: waveshare_io_ch32v003: wave_io number: 3 hsync_back_porch: 152 hsync_front_porch: 48 hsync_pulse_width: 162 vsync_back_porch: 13 vsync_front_porch: 3 vsync_pulse_width: 45 data_pins: red: - 1 # r3 - 2 # r4 - 42 # r5 - 41 # r6 - 40 # r7 green: - 39 # g2 - 0 # g3 - 45 # g4 - 48 # g5 - 47 # g6 - 21 # g7 blue: - 14 # b3 - 38 # b4 - 18 # b5 - 17 # b6 - 10 # b7 font: - file: "gfonts://Roboto" id: font_roboto_24 size: 24 - file: "gfonts://Roboto" id: font_roboto_16 size: 16 - file: "https://github.com/Templarian/MaterialDesign-Webfont/raw/v7.4.47/fonts/materialdesignicons-webfont.ttf" id: font_mdi_wifi size: 28 glyphs: - "\U000F092B" # wifi-strength-outline (no signal) - "\U000F091F" # wifi-strength-1 - "\U000F0922" # wifi-strength-2 - "\U000F0925" # wifi-strength-3 - "\U000F0928" # wifi-strength-4 (full) i2c: id: i2c_bus sda: GPIO8 scl: GPIO9 light: - platform: monochromatic id: lcd_backlight output: backlight_pwm_output default_transition_length: 0ms restore_mode: ALWAYS_OFF lvgl: displays: - pool_display touchscreens: - touchscreen_id: pool_touchscreen on_idle: timeout: 15sec then: - light.turn_off: lcd_backlight - lvgl.pause: bg_color: 0x1a1a2e default_font: font_roboto_24 pages: - id: main_page widgets: - label: id: lbl_title text: "Pool Controller" align: CENTER text_color: 0xffffff text_font: font_roboto_24 - label: id: lbl_wifi text: "\U000F092B" align: TOP_RIGHT x: -10 y: 10 text_color: 0xaaaaaa text_font: font_mdi_wifi - label: id: lbl_datetime text: "--- --- -- --:-- --" align: TOP_RIGHT x: -48 y: 14 text_color: 0xaaaaaa text_font: font_roboto_24 modbus: uart_id: modbus_uart output: - platform: waveshare_io_ch32v003 id: backlight_pwm_output inverted: true power_supply: backlight_enable - platform: gpio id: heater_output pin: pcf8574: io_expander number: 0 mode: OUTPUT inverted: true - platform: gpio id: fill_output pin: pcf8574: io_expander number: 1 mode: OUTPUT inverted: true - platform: gpio id: cleaner_output pin: pcf8574: io_expander number: 2 mode: OUTPUT inverted: true - platform: gpio id: pump_output pin: pcf8574: io_expander number: 3 mode: OUTPUT inverted: true pcf8574: - id: "io_expander" address: 0x20 pcf8575: false interrupt_pin: number: GPIO6 mode: INPUT_PULLUP pool_controller: primary_pump: name: "Pump" id: pool_pump icon: mdi:pump output: pump_output current_sensor: pump_current flow_sensor: flow_main schedule_select: id: pump_select name: Pump Schedule icon: mdi:clock-outline restore_mode: Always Off schedules: - name: Normal runtimes: - start_time: "4:00" end_time: "6:00" minutes_per_hour: 60 - start_time: "6:00" end_time: "18:00" minutes_per_hour: 40 days_of_week: MON-FRI - start_time: "21:00" end_time: "22:00" minutes_per_hour: 60 days_of_week: MON-FRI - start_time: "6:00" end_time: "22:00" minutes_per_hour: 40 days_of_week: SAT,SUN - name: Always Except Peak runtimes: - start_time: "0:00" end_time: "18:00" minutes_per_hour: 60 days_of_week: MON-FRI - start_time: "21:00" end_time: "24:00" minutes_per_hour: 60 days_of_week: MON-FRI - start_time: "0:00" end_time: "24:00" minutes_per_hour: 60 days_of_week: SAT,SUN auxiliary_pumps: - id: pool_cleaner name: "Cleaner" icon: mdi:robot-vacuum output: cleaner_output current_sensor: cleaner_current flow_sensor: flow_aux schedule_select: id: cleaner_select name: Cleaner Schedule icon: mdi:clock-outline schedules: - name: Normal runtimes: - start_time: "4:00" end_time: "5:00" minutes_per_hour: 60 - name: Double Time runtimes: - start_time: "4:00" end_time: "6:00" minutes_per_hour: 60 restore_mode: Always Off # pool_heater: # name: Heater # id: pool_heater # output: heater_output # temperature_sensor: water_temp power_supply: - id: backlight_enable pin: waveshare_io_ch32v003: wave_io number: 2 mode: output: true enable_time: 10ms keep_on_time: 10s psram: mode: octal speed: 80MHz sensor: - id: !extend wifi_rssi on_value: then: - lvgl.label.update: id: lbl_wifi text: !lambda |- if (x >= -55) return std::string("\U000F0928"); // 4 bars if (x >= -67) return std::string("\U000F0925"); // 3 bars if (x >= -80) return std::string("\U000F0922"); // 2 bars if (x >= -90) return std::string("\U000F091F"); // 1 bar return std::string("\U000F092B"); // outline - platform: ezo id: orp name: Oxidation Reduction Potential icon: mdi:chemical-weapon address: 98 device_class: voltage accuracy_decimals: 0 unit_of_measurement: "mV" update_interval: 10s - platform: ezo id: ph name: pH icon: mdi:ph address: 99 device_class: ph accuracy_decimals: 2 update_interval: 10s - platform: ezo id: water_temp name: Water Temperature icon: mdi:water-thermometer address: 101 accuracy_decimals: 2 device_class: temperature unit_of_measurement: "°C" update_interval: 10s - platform: ezo id: return_temp name: Return Water Temperature icon: mdi:water-thermometer address: 102 accuracy_decimals: 2 device_class: temperature unit_of_measurement: "°C" update_interval: 10s - platform: pzem6l24 id: pzem address: 0x01 update_interval: 2s # Voltage voltage_a: id: supply_voltage name: Supply Voltage entity_category: diagnostic voltage_b: id: pump_voltage name: Pump Voltage entity_category: diagnostic voltage_c: id: cleaner_voltage_int name: Cleaner Voltage entity_category: diagnostic # Current current_b: id: pump_current name: Pump Current entity_category: diagnostic current_c: id: cleaner_current name: Cleaner Current entity_category: diagnostic # Power factor power_factor_b: id: pump_power_factor name: Pump Power Factor entity_category: diagnostic power_factor_c: id: cleaner_power_factor name: Cleaner Power Factor entity_category: diagnostic # Active power active_power_b: id: pump_power name: Pump Power active_power_c: id: cleaner_power name: Cleaner Power # Energy active_energy_b: id: pump_energy name: Pump active_energy_c: id: cleaner_energy name: Cleaner - platform: internal_temperature name: Controller Temperature switch: - platform: output output: heater_output name: Heater Test device_class: switch restore_mode: RESTORE_DEFAULT_OFF time: - id: !extend time_source on_time_sync: then: - lvgl.label.update: id: lbl_datetime text: !lambda |- auto t = id(time_source).now(); if (!t.is_valid()) return std::string(""); return t.strftime("%a %b %d %I:%M %p"); on_time: - seconds: 0 then: - lvgl.label.update: id: lbl_datetime text: !lambda |- auto t = id(time_source).now(); if (!t.is_valid()) return std::string(""); return t.strftime("%a %b %d %I:%M %p"); - seconds: 0 minutes: 0 hours: 0 then: - pzem6l24.reset_energy: id: pzem phase: all touchscreen: - platform: gt911 id: pool_touchscreen display: pool_display interrupt_pin: number: GPIO4 mode: INPUT_PULLUP reset_pin: waveshare_io_ch32v003: wave_io number: 1 mode: OUTPUT on_touch: then: - if: condition: light.is_off: lcd_backlight then: - lvgl.resume: - light.turn_on: lcd_backlight uart: id: modbus_uart tx_pin: GPIO43 rx_pin: GPIO44 baud_rate: 9600 waveshare_io_ch32v003: - id: wave_io address: 0x24 i2c_id: i2c_bus