The device, a Sonoff Basic, is not showing in my router (ASUS RT-AX88U) but its Online in both Home Assistant and ESPHome.
I had a problem with the Sonoff that it didnt Connect to the router until I manually set the ip-adress.
Now it connects and works but the ”problem” is that it doesnt show in the router.
I have followed the instructions from this: Ultimate Fan Project V3.1 - Home Assistant ESPHome Sonoff - YouTube
Sounds more like a question for your router’s manufacturer.
Is it possible that the view in your router does not show devices with static ip addresses?
Perhaps a router question… I dont know.
The router shows other devices with static ip.
1 Like
I should perhaps add that this is my first ESPHome-device.
1 Like
Blacky
December 19, 2021, 6:54am
5
I have had this problem before when I use to use my ISP router. Its the router… you know it is connected to your network because HA and ESPHome can see it.
What router do you have?
Interesting is that it shows up in my wireless log on my asus with its MAC-adress. But with no IP-address…
It works in both HA and addon ESPHome but not visible in router with ip-address. Strange indeed.
The Sonoff-Basic is configured like this:
substitutions:
name: flyttbar
esphome:
name: fan-${name}
platform: ESP8266
board: esp01_1m
wifi:
ssid: !secret ssid
password: !secret wifi_password
manual_ip:
static_ip: 198.162.1.5
gateway: 198.162.1.1
subnet: 255.255.255.0
dns1: 198.162.1.64
dns2: 198.162.1.250
logger:
api:
ota:
mcp23008:
- id: "mcp23008_hub"
address: 0x20
i2c:
sda: GPIO1 # Tx Blue
scl: GPIO3 # Rx Green
# scan: true
binary_sensor:
- platform: gpio
id: button1
filters:
- delayed_on_off: 100ms
pin:
mcp23xxx: mcp23008_hub
number: 0
mode: INPUT_PULLUP
inverted: true
on_press:
then:
- if:
condition:
and:
- lambda: "return id(speed).state == 1;"
- switch.is_on: master
then:
- switch.turn_off: master
else:
- number.set:
id: speed
value: 1
- switch.turn_on: master
- platform: gpio
id: button2
filters:
- delayed_on_off: 100ms
pin:
mcp23xxx: mcp23008_hub
number: 1
mode: INPUT_PULLUP
inverted: true
on_press:
then:
- if:
condition:
and:
- lambda: "return id(speed).state == 2;"
- switch.is_on: master
then:
- switch.turn_off: master
else:
- number.set:
id: speed
value: 2
- switch.turn_on: master
- platform: gpio
id: button3
filters:
- delayed_on_off: 100ms
pin:
mcp23xxx: mcp23008_hub
number: 2
mode: INPUT_PULLUP
inverted: true
on_press:
then:
- if:
condition:
and:
- lambda: "return id(speed).state == 3;"
- switch.is_on: master
then:
- switch.turn_off: master
else:
- number.set:
id: speed
value: 3
- switch.turn_on: master
number:
- platform: template
name: Fan ${name} speed
id: speed
icon: mdi:fan
update_interval: never
optimistic: true
min_value: 1
max_value: 3
initial_value: 1
step: 1
set_action:
- if:
condition:
- switch.is_on: master
then:
- lambda: >-
if (x == 1) {return id(relay1).turn_on();}
- lambda: >-
if (x == 2) {return id(relay2).turn_on();}
- lambda: >-
if (x == 3) {return id(relay3).turn_on();}
switch:
- platform: template
id: master
icon: mdi:fan
name: Fan ${name} master
optimistic: true
on_turn_on:
then:
- lambda: >-
if (id(speed).state == 1) {return id(relay1).turn_on();}
- lambda: >-
if (id(speed).state == 2) {return id(relay2).turn_on();}
- lambda: >-
if (id(speed).state == 3) {return id(relay3).turn_on();}
on_turn_off:
- lambda: "id(relay1).turn_off();"
- lambda: "id(relay2).turn_off();"
- lambda: "id(relay3).turn_off();"
- platform: gpio
id: internal_relay
pin: GPIO12
- platform: gpio
id: relay1
pin:
mcp23xxx: mcp23008_hub
number: 5
mode: OUTPUT
inverted: true
interlock: &interlock_group [relay1, relay2, relay3]
interlock_wait_time: 250ms
on_turn_on:
- switch.turn_on: internal_relay
- number.set:
id: speed
value: 1
on_turn_off:
- switch.turn_off: internal_relay
- platform: gpio
id: relay2
pin:
mcp23xxx: mcp23008_hub
number: 6
mode: OUTPUT
inverted: true
interlock: *interlock_group
interlock_wait_time: 250ms
on_turn_on:
- number.set:
id: speed
value: 2
- platform: gpio
id: relay3
pin:
mcp23xxx: mcp23008_hub
number: 7
mode: OUTPUT
inverted: true
interlock: *interlock_group
interlock_wait_time: 250ms
on_turn_on:
- number.set:
id: speed
value: 3
status_led:
pin:
number: GPIO13
inverted: yes
Tommmii
December 19, 2021, 11:24am
8
You might want to dig deeper into why the Sonoff isn’t obtaining an ip address via the DHCP mechanism.
Different routers behave differently when faced with devices that have the ip set statically in the device itself. This is why you need to leave things up to DHCP, and when you really need a static ip (servers, printers, …) you set a reservation in the router’s dhcp management section.
When I tried that,. no manual_ip: then it wouldnt connect to anything.
Tommmii
December 19, 2021, 11:26am
10
typo in the wifi settings ?
very unlikely as that would also stop it from connecting when setting manual ip.
my bad.
Tommmii
December 19, 2021, 11:27am
11
also the log shows why it isn’t connecting properly,
*do you have an active dhcp server ?
*what are those 2 dns servers you’re providing in the config ?
Tommmii
December 19, 2021, 11:37am
13
so the pi-hole is the dhcp server ?
No its just a recursive Ad-blocking.
Removed the dns1 and dns2… no change
Tommmii
December 19, 2021, 11:39am
15
you never said : do you have an active dhcp server ?
Yes, its on my Asus router
Tommmii
December 19, 2021, 11:45am
17
do you have access to the serial logging on the Sonoff ?
Does that mention anything odd regarding networking ?
INFO Reading configuration /config/esphome/fan-flyttbar.yaml...
INFO Starting log output from 198.162.1.5 using esphome API
INFO Successfully connected to 198.162.1.5
[13:42:50][I][app:102]: ESPHome version 2021.12.1 compiled on Dec 19 2021, 12:36:23
[13:42:50][C][status_led:019]: Status LED:
[13:42:50][C][status_led:020]: Pin: GPIO13
[13:42:50][C][wifi:488]: WiFi:
[13:42:50][C][wifi:350]: Local MAC: REDACTED
[13:42:50][C][wifi:351]: SSID: [redacted]
[13:42:50][C][wifi:352]: IP Address: 198.162.1.5
[13:42:50][C][wifi:354]: BSSID: [redacted]
[13:42:50][C][wifi:355]: Hostname: 'fan-flyttbar'
[13:42:50][C][wifi:357]: Signal strength: -47 dB ▂▄▆█
[13:42:50][C][wifi:361]: Channel: 1
[13:42:50][C][wifi:362]: Subnet: 255.255.255.0
[13:42:50][C][wifi:363]: Gateway: 198.162.1.1
[13:42:50][C][wifi:364]: DNS1: 0.0.0.0
[13:42:50][C][wifi:365]: DNS2: 0.0.0.0
[13:42:50][C][logger:233]: Logger:
[13:42:50][C][logger:234]: Level: DEBUG
[13:42:50][C][logger:235]: Log Baud Rate: 115200
[13:42:50][C][logger:236]: Hardware UART: UART0
[13:42:50][C][i2c.arduino:032]: I2C Bus:
[13:42:50][C][i2c.arduino:033]: SDA Pin: GPIO1
[13:42:50][C][i2c.arduino:034]: SCL Pin: GPIO3
[13:42:50][C][i2c.arduino:035]: Frequency: 50000 Hz
[13:42:50][C][i2c.arduino:038]: Recovery: bus successfully recovered
[13:42:50][I][i2c.arduino:048]: Scanning i2c bus for active devices...
[13:42:50][I][i2c.arduino:053]: Found i2c device at address 0x20
[13:42:50][C][mcp23008:023]: MCP23008:
[13:42:50][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'button1'
[13:42:50][C][gpio.binary_sensor:016]: Pin: 0 via MCP23XXX
[13:42:50][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'button2'
[13:42:50][C][gpio.binary_sensor:016]: Pin: 1 via MCP23XXX
[13:42:50][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'button3'
[13:42:50][C][gpio.binary_sensor:016]: Pin: 2 via MCP23XXX
[13:42:50][C][template.number:049]: Template Number 'Fan flyttbar speed'
[13:42:50][C][template.number:049]: Icon: 'mdi:fan'
[13:42:50][C][template.number:050]: Optimistic: YES
[13:42:50][C][template.number:051]: Update Interval: never
[13:42:50][C][template.switch:058]: Template Switch 'Fan flyttbar master'
[13:42:50][C][template.switch:058]: Icon: 'mdi:fan'
[13:42:50][C][template.switch:059]: Restore State: NO
[13:42:50][C][template.switch:060]: Optimistic: YES
[13:42:50][C][switch.gpio:048]: GPIO Switch 'internal_relay'
[13:42:50][C][switch.gpio:049]: Pin: GPIO12
[13:42:50][C][switch.gpio:071]: Restore Mode: Restore (Defaults to OFF)
[13:42:50][C][switch.gpio:048]: GPIO Switch 'relay1'
[13:42:50][C][switch.gpio:049]: Pin: 5 via MCP23XXX
[13:42:50][C][switch.gpio:071]: Restore Mode: Restore (Defaults to OFF)
[13:42:50][C][switch.gpio:073]: Interlocks:
[13:42:50][C][switch.gpio:077]: relay2
[13:42:50][C][switch.gpio:077]: relay3
[13:42:50][C][switch.gpio:048]: GPIO Switch 'relay2'
[13:42:50][C][switch.gpio:049]: Pin: 6 via MCP23XXX
[13:42:50][C][switch.gpio:071]: Restore Mode: Restore (Defaults to OFF)
[13:42:50][C][switch.gpio:073]: Interlocks:
[13:42:50][C][switch.gpio:077]: relay1
[13:42:50][C][switch.gpio:077]: relay3
[13:42:50][C][switch.gpio:048]: GPIO Switch 'relay3'
[13:42:50][C][switch.gpio:049]: Pin: 7 via MCP23XXX
[13:42:50][C][switch.gpio:071]: Restore Mode: Restore (Defaults to OFF)
[13:42:50][C][switch.gpio:073]: Interlocks:
[13:42:50][C][switch.gpio:077]: relay1
[13:42:50][C][switch.gpio:077]: relay2
[13:42:50][C][ota:082]: Over-The-Air Updates:
[13:42:50][C][ota:083]: Address: 198.162.1.5:8266
[13:42:50][C][api:134]: API Server:
[13:42:50][C][api:135]: Address: 198.162.1.5:6053
[13:42:50][C][api:139]: Using noise encryption: NO
[13:42:51][C][mdns:084]: mDNS:
[13:42:51][C][mdns:085]: Hostname: fan-flyttbar
Tommmii
December 19, 2021, 12:50pm
19
hmm…I would try to flash this skeleton config, and I would do it over the serial connection.
But take care, if you have no serial access, you could end up having real trouble accessing the Sonoff if it doesn’t sign on to your network over the wifi.
substitutions:
name: flyttbar
esphome:
name: fan-${name}
platform: ESP8266
board: esp01_1m
wifi:
ssid: !secret ssid
password: !secret wifi_password
logger:
api:
ota:
I started with just your code, but then it wouldnt connect to WiFi.
Tried that surely 5-6 times but no luck.
Then when I added manual_ip: then it connected to wifi, HA, and ESPHome but the little problem that its not visible in the router.
I have searched and found several problems with Sonoff Basic and that it dont connect to router without manual_ip:… but my problem that its not visible is something else.