Hello everyone, I am making a smart power strip with six outlets and a display that makes me read the ON/OFF states of each relay, returns room temperature and water temperature of an aquarium (the Esp32-S3 of the power strip, actually reads me the entities of room temperature and tank water, which are detected by another SP32 with separate probes).
To do this, I am using, as mentioned above, an ESP32-S3, an ST7796 320*480 LCD screen, a 4-channel 5V relay board, a two-channel 5V relay board, and a 5V 2A power supply, which powers the esp and the two relay boards.
Everything seems to work fine, when, however, I connect a load to one of the six sockets, everything goes crazyâŚesp restarts itself, LCD no longer reads etc.
IF I restart the esp32 without having connected any load to the power strip, everything works fine again, every single channel of the relay boards turns on and off regularly, on the display I read the status of every single channel correctly etc. ; it is enough, however, that I connect anything to one of the six sockets that everything goes to hell.
I am attaching the yaml file:
, in the hope that someone can/will help me.
Thank you and bye
Translated with DeepL.com (free version).
This is the yaml file:
esphome:
name: acquario
friendly_name: Acquario
on_boot:
if:
condition:
time.has_time:
then:
- logger.log: Time has been set and is valid!
esp32:
board: esp32-s3-devkitc-1
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "IlXNRQa69lp+OYgvLgZAP+rR/25e8u7sizfnl/opRdk="
ota:
- platform: esphome
password: "f256321e2622b5deb90bd8aa44a6f29a"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Prova-S3 Fallback Hotspot"
password: "pC0trGfQMn10"
web_server:
port: 80
captive_portal:
time:
platform: homeassistant
id: homeassistant_time
timezone: Europe/Rome
spi:
clk_pin: GPIO4
mosi_pin: GPIO5
id: lcd
# MISO non è usato per il display ST7735S
color:
- id: my_red
red: 100%
green: 3%
blue: 5%
- id: my_blu
red: 5%
green: 3%
blue: 100%
- id: my_green
red: 5%
green: 100%
blue: 3%
- id: my_yellow
hex: ffff00
- id: my_fucsia
hex: f400a1
- id: my_orange
hex: FF8000
display:
- platform: ili9xxx
model: ST7796
spi_id: lcd
cs_pin: GPIO15
dc_pin: GPIO7
reset_pin: GPIO6
invert_colors: false
dimensions: 320x480 #320x480 not possible because of memory limitations
rotation: 90
color_palette: 8BIT
#data_rate: 40MHz
lambda: |-
it.strftime(3, 3, id(fonts2), "%d %b %Y", id(homeassistant_time).now());
it.strftime(3, 23, id(fonts2), "%H:%M:%S", id(homeassistant_time).now());
it.print(140, 0, id(fonts4), id(my_fucsia), "ACQUARIO:");
it.rectangle (0, 52.5, 480, 267.5, id(my_green));
it.print(10, 60, id(fonts3), id(my_blu), "Luci:");
if (id(relay_1).turn_on()) {
it.print(100, 60, id(fonts3), id(my_green), "ON");
} else {
it.print(100, 60, id(fonts3), id(my_red), "OFF");
}
it.print(10, 85, id(fonts3), id(my_blu), "Filtro:");
if (id(relay_2).turn_on()) {
it.print(100, 85, id(fonts3), id(my_green), "ON");
} else {
it.print(100, 85, id(fonts3), id(my_red), "OFF");
}
it.print(10, 110, id(fonts3), id(my_blu), "Aria:");
if (id(relay_3).turn_on()) {
it.print(100, 110, id(fonts3), id(my_green), "ON");
} else {
it.print(100, 110, id(fonts3), id(my_red), "OFF");
}
it.print(10, 135, id(fonts3), id(my_blu), "Riscald.:");
if (id(relay_4).turn_on()) {
it.print(100, 135, id(fonts3), id(my_green), "ON");
} else {
it.print(100, 135, id(fonts3), id(my_red), "OFF");
}
it.print(10, 160, id(fonts3), id(my_blu), "Refrig.:");
if (id(relay_5).turn_on()) {
it.print(100, 160, id(fonts3), id(my_green), "ON");
} else {
it.print(100, 160, id(fonts3), id(my_red), "OFF");
}
it.print(10, 185, id(fonts3), id(my_blu), "Aux:");
if (id(relay_6).turn_on()) {
it.print(100, 185, id(fonts3), id(my_green), "ON");
} else {
it.print(100, 185, id(fonts3), id(my_red), "OFF");
}
it.rectangle (160, 57.5, 185, 40, id(my_green));
it.rectangle (160, 57.5, 185, 107.5, id(my_green));
it.rectangle (5, 57.5, 150, 160, id(my_green));
font:
- file: "fonts/arial.ttf"
id: fonts
size: 20
- file: "fonts/arial.ttf"
id: fonts1
size: 14
- file: "fonts/arial.ttf"
id: fonts2
size: 21
- file: "fonts/arial.ttf"
id: fonts3
size: 22
- file: "fonts/Ramillas.ttf"
id: fonts4
size: 40
# Definizione dei relè e interruttori
switch:
- platform: gpio
pin: GPIO42
id: relay_1
name: "Luci"
- platform: gpio
pin: GPIO41
id: relay_2
name: "Filtro"
- platform: gpio
pin: GPIO40
id: relay_3
name: "Aria"
- platform: gpio
pin: GPIO39
id: relay_4
name: "Riscaldatore"
- platform: gpio
pin: GPIO38
id: relay_5
name: "Refrigerazione"
- platform: gpio
pin: GPIO37
id: relay_6
name: "Aux"
binary_sensor:
- platform: gpio
name: "Interruttore Luci"
pin:
number: GPIO36 # Interruttore Luci
mode:
input: true
pullup: true
inverted: true
on_press:
then:
- switch.turn_on: relay_1
on_release:
then:
- switch.turn_off: relay_1
filters:
- delayed_on_off: 50ms
- platform: gpio
pin:
number: GPIO35 #Interruttore Filtro
mode:
input: true
pullup: true
inverted: true
name: "Interruttore Filtro"
on_press:
then:
- switch.turn_on: relay_2
on_release:
then:
- switch.turn_off: relay_2
filters:
- delayed_on_off: 50ms
# ================================================================================================ #
# light
# ================================================================================================ #
light:
- platform: esp32_rmt_led_strip
id: led_ww
rgb_order: GRB
pin: GPIO20
num_leds: 1
rmt_channel: 0
chipset: ws2812
name: "on board led"
internal: True
# effects:
# - pulse:
# transition_length: 500ms
# update_interval: 500ms
# ================================================================================================ #
# text_sensor
# ================================================================================================ #
text_sensor:
- platform: version
hide_timestamp: true
name: "${friendly_name} ESPHome Versione"
entity_category: diagnostic
- platform: wifi_info
ip_address:
name: "${friendly_name} IP Address"
icon: mdi:wifi
entity_category: diagnostic
ssid:
name: "${friendly_name} Connected SSID"
icon: mdi:wifi-strength-2
entity_category: diagnostic
# ================================================================================================ #
# sensor
# ================================================================================================ #
sensor:
- platform: wifi_signal
name: "WiFi Signal dB"
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"
- platform: homeassistant
id: temp_ambiente
entity_id: sensor.broadlink_rm4_pro_studio_maxi_temperatura
# ================================================================================================ #
# script
# ================================================================================================ #
script:
- id: led_blink_red
then:
- light.turn_on:
id: led_ww
red: 100%
green: 0%
blue: 0%
brightness: 40%
transition_length: 50ms
#effect: pulse
- delay: 1100ms
- light.turn_off:
id: led_ww
- id: led_blink_green
then:
- light.turn_on:
id: led_ww
red: 0%
green: 100%
blue: 0%
brightness: 30%
transition_length: 50ms
#effect: pulse
- delay: 1100ms
- light.turn_off:
id: led_ww
# ================================================================================================ #
# interval
# ================================================================================================ #
interval:
- interval: 3s
then:
if:
condition:
api.connected:
then:
- script.execute: led_blink_green
- interval: 1.5s
then:
if:
condition:
not:
api.connected:
then:
- script.execute: led_blink_red
I hope that someone can/will help me.
Thank you and bye