esphome:
name: 3d-printkast
friendly_name: 3d-printkast
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: ""
ota:
password: ""
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
use_address: 192.168.20.8
manual_ip:
static_ip: 192.168.20.8
gateway: 192.168.0.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "3dprintkast Fallback Hotspot"
password: ""
captive_portal:
output:
- platform: gpio
pin: GPIO23
id: led
- platform: gpio
pin: GPIO25
id: relay_pin_1
- platform: gpio
pin: GPIO26
id: relay_pin_2
- platform: gpio
pin: GPIO27
id: relay_pin_3
- platform: gpio
pin: GPIO14
id: relay_pin_4
# Define the switches based on the relay pins
switch:
- platform: output
id: relay_1
name: "Relay 1"
output: relay_pin_1
- platform: output
id: relay_2
name: "Relay 2"
output: relay_pin_2
- platform: output
id: relay_3
name: "Relay 3"
output: relay_pin_3
- platform: output
id: relay_4
name: "Relay 4"
output: relay_pin_4
# Status LED
light:
# - platform: status_led
# name: "RelayBoard Led"
# restore_mode: ALWAYS_ON
# pin:
# number: GPIO23
# interval:
# - interval: 1000ms
# then:
# - output.turn_on: led
# - delay: 500ms
# - output.turn_off: led
- platform: neopixelbus
type: GRB
variant: WS2812x
pin: GPIO17
num_leds: 144
name: "CR10 3D Pinter"
I have 4 relays and a ledstrip. The above code is flashed.
Everything works 1 time, and then it seems like I loose connection or something. Nothing is responsive anymore, sometimes the light and relays do switch after a few minutes of delay.
In the logging I read the following:
WARNING Canāt connect to ESPHome API for 3d-printkast @ 192.168.20.8: Timeout while connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address=ā192.168.20.8ā, port=6053))] (TimeoutAPIError)
INFO Trying to connect to 3d-printkast @ 192.168.20.8 in the background
INFO Successfully connected to 3d-printkast @ 192.168.20.8 in 0.115s
INFO Successful handshake with 3d-printkast @ 192.168.20.8 in 0.091s
A bit later I get:
[10:04:34][D][api:102]: Accepted 192.168.20.40
[10:04:34][W][component:237]: Component api took a long time for an operation (51 ms).
[10:04:34][W][component:238]: Components should block for at most 30 ms.
[10:04:34][D][api.connection:1321]: Home Assistant 2024.5.5 (192.168.20.40): Connected successfully
WARNING 3d-printkast @ 192.168.20.8: Connection error occurred: 3d-printkast @ 192.168.20.8: EOF received
INFO Processing unexpected disconnect from ESPHome API for 3d-printkast @ 192.168.20.8
WARNING Disconnected from API
INFO Successfully connected to 3d-printkast @ 192.168.20.8 in 0.011s
INFO Successful handshake with 3d-printkast @ 192.168.20.8 in 0.091s
[10:07:04][W][api.connection:129]: Home Assistant 2024.5.5 (192.168.20.40) didnāt respond to ping request in time. Disconnectingā¦
[10:07:04][D][api:102]: Accepted 192.168.20.40
[10:07:04][W][component:237]: Component api took a long time for an operation (51 ms).
[10:07:04][W][component:238]: Components should block for at most 30 ms.
[10:07:04][D][api.connection:1321]: Home Assistant 2024.5.5 (192.168.20.40): Connected successfully
[10:08:10][I][ota:117]: Boot seems successful, resetting boot loop counter.
[10:08:10][D][esp32.preferences:114]: Saving 1 preferences to flashā¦
[10:08:10][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
WARNING 3d-printkast @ 192.168.20.8: Connection error occurred: 3d-printkast @ 192.168.20.8: EOF received
INFO Processing unexpected disconnect from ESPHome API for 3d-printkast @ 192.168.20.8
WARNING Disconnected from API
INFO Successfully connected to 3d-printkast @ 192.168.20.8 in 0.010s
INFO Successful handshake with 3d-printkast @ 192.168.20.8 in 0.088s