09-26-2023, 08:13 PM
Good day, I have one of these units set up with esphome. I'm using the recommended yaml for ethernet connection.
My intention was to use the board to restart my router when the internet fails. So the board powers the router and at the same time is connected to the router via the ethernet port.
The problem I have is that when I power cycle the board or associated relay powering the router, the esp32 chip does not reconnect to the network.
I can see the board connected to the network with it's associated IP address, but the esp32 does not seem to connect and therefore the board is inaccessible. I cant see it in homeassitant or on the assigned ip address webui.
If I just use it to power something else and it doesn't loose Ethernet connection, then it works fine.
However, as I explained the use case was as an internet 'watchdog'.
Is there an additional setting I must add to the esphome yaml?
See below my esphome yaml for reference
```
substitutions:
name: networksocket
friendly_name: networksocket
esphome:
name: ${friendly_name}
esp32:
board: esp32dev
framework:
type: arduino
web_server:
port: 80
logger:
api:
encryption:
key: "key"
services:
- service: power_cycle_relay1
then:
- switch.turn_off: relay1
- delay: 30s
- switch.turn_on: relay1
- service: power_cycle_relay2
then:
- switch.turn_off: relay2
- delay: 30s
- switch.turn_on: relay2
- service: power_cycle_esp
then:
- delay: 5min
- button.press: ${friendly_name}_restart
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
i2c:
- id: bus_a
sda: GPIO4
scl: GPIO5
scan: true
switch:
- platform: gpio
name: ${friendly_name}-relay1
pin: 15
inverted: false
restore_mode: RESTORE_DEFAULT_ON
id: relay1
- platform: gpio
name: ${friendly_name}-relay2
pin: 2
inverted: false
restore_mode: RESTORE_DEFAULT_ON
id: relay2
binary_sensor:
- platform: gpio
name: ${friendly_name}-input1
pin:
number: 36
inverted: true
on_press:
then:
- switch.toggle: relay1
- platform: gpio
name: ${friendly_name}-input2
pin:
number: 39
inverted: true
on_press:
then:
- switch.toggle: relay2
sensor:
- platform: uptime
name: ${friendly_name} uptime
text_sensor:
- platform: version
name: ${friendly_name} ESPHome Version
- platform: ethernet_info
ip_address:
name: ${friendly_name} IP Address
time:
- platform: homeassistant
id: homeassistant_time
# https://esphome.io/components/esp32_ble_tracker.html
esp32_ble_tracker:
scan_parameters:
active: true
# https://esphome.io/components/bluetooth_proxy.html
bluetooth_proxy:
active: true
button:
- platform: restart
name: ${friendly_name} restart
entity_category: config
disabled_by_default: false
device_class: restart
id: ${friendly_name}_restart
```
Thank you
My intention was to use the board to restart my router when the internet fails. So the board powers the router and at the same time is connected to the router via the ethernet port.
The problem I have is that when I power cycle the board or associated relay powering the router, the esp32 chip does not reconnect to the network.
I can see the board connected to the network with it's associated IP address, but the esp32 does not seem to connect and therefore the board is inaccessible. I cant see it in homeassitant or on the assigned ip address webui.
If I just use it to power something else and it doesn't loose Ethernet connection, then it works fine.
However, as I explained the use case was as an internet 'watchdog'.
Is there an additional setting I must add to the esphome yaml?
See below my esphome yaml for reference
```
substitutions:
name: networksocket
friendly_name: networksocket
esphome:
name: ${friendly_name}
esp32:
board: esp32dev
framework:
type: arduino
web_server:
port: 80
logger:
api:
encryption:
key: "key"
services:
- service: power_cycle_relay1
then:
- switch.turn_off: relay1
- delay: 30s
- switch.turn_on: relay1
- service: power_cycle_relay2
then:
- switch.turn_off: relay2
- delay: 30s
- switch.turn_on: relay2
- service: power_cycle_esp
then:
- delay: 5min
- button.press: ${friendly_name}_restart
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
i2c:
- id: bus_a
sda: GPIO4
scl: GPIO5
scan: true
switch:
- platform: gpio
name: ${friendly_name}-relay1
pin: 15
inverted: false
restore_mode: RESTORE_DEFAULT_ON
id: relay1
- platform: gpio
name: ${friendly_name}-relay2
pin: 2
inverted: false
restore_mode: RESTORE_DEFAULT_ON
id: relay2
binary_sensor:
- platform: gpio
name: ${friendly_name}-input1
pin:
number: 36
inverted: true
on_press:
then:
- switch.toggle: relay1
- platform: gpio
name: ${friendly_name}-input2
pin:
number: 39
inverted: true
on_press:
then:
- switch.toggle: relay2
sensor:
- platform: uptime
name: ${friendly_name} uptime
text_sensor:
- platform: version
name: ${friendly_name} ESPHome Version
- platform: ethernet_info
ip_address:
name: ${friendly_name} IP Address
time:
- platform: homeassistant
id: homeassistant_time
# https://esphome.io/components/esp32_ble_tracker.html
esp32_ble_tracker:
scan_parameters:
active: true
# https://esphome.io/components/bluetooth_proxy.html
bluetooth_proxy:
active: true
button:
- platform: restart
name: ${friendly_name} restart
entity_category: config
disabled_by_default: false
device_class: restart
id: ${friendly_name}_restart
```
Thank you