New device won't show in HA?

I just flashed a new s31 smart plug - something I’ve done a dozen times before. Copy the YAML file, find-replace change the name of the device, installed the firmware, put it together, plug it in.

But this time its not being detected in HA?

I can see it in ESPHome, I can view its logs in ESPHome, it says its sending, I’ve restarted HA, I’ve restarted ESPHome, I can see (and ping) it by DNS name…I’m not sure where else to go?

What would cause a new plug to not register with HA but show everywhere else? Did something change from how it used to detect new devices?

1 Like

Go to settings - devices and services and there it should be ready to integrate.

I’m not seeing it, and under the integration for ESPHome only the old ones are showing.

Under ESPHome it looks like its sending stuff though

try adding a new esphome integration, by clicking add integration button.

Doesn’t seem to let me, maybe because I already have it? I don’t understand why I’d need a second integration all of a sudden?

you don’t need a second integration, just a new device.
check your code too.

I don’t understand what “new device” would be, it was set up inside ESPHome and shows fine on the ESPHome dashboard.

YAML is just a replace name on one I already had that was working.

Not working new plug:

esphome:
  name: s31_snake_light_2
  platform: ESP8266
  board: esp01_1m

wifi:
  # Create a file /config/esphome/secrets.yaml
  # and put the following (not commented, not indented):
  # ssid: "Your_Network_SSID_Name"
  # password: "YourSuperSecretPassword"
  networks:
  - ssid: !secret ssid
    password: !secret password
    bssid: !secret bssid_basement_front-EWS377AP-local
    priority: 2
  - ssid: !secret ssid
    password: !secret password
    priority: 1
  domain: !secret dns_suffix

  #power_save_mode: none

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "s31_snake_light_2 setup"

captive_portal:

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:

ota:

uart:
  rx_pin: RX
  baud_rate: 4800

sensor:
  - platform: cse7766
    update_interval: 0.25s
    current:
      name: "s31_snake_light_2 Current"
      filters:
        - or:
            - throttle: 20s
            - delta: 0.1
    voltage:
      name: "s31_snake_light_2 Voltage"
      filters:
        - calibrate_linear:
            - 0.0 -> 0.0
            - 125.0 -> 125.6
        - or:
            - throttle: 20s
            - delta: 0.5
    power:
      name: "s31_snake_light_2 Power"
      filters:
        - or:
            - throttle: 20s
            - delta: 5.0
      
switch:
  - platform: gpio
    name: "s31_snake_light_2 Relay"
    pin: GPIO12
    id: relay
  - platform: restart
    name: "s31_snake_light_2 Restart"


binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "s31_snake_light_2 Button"
    on_press:
      - switch.toggle: relay
    filters:
      - delayed_on_off: 100ms

status_led:
  pin:
    number: GPIO13
    inverted: yes

Working existing plug:

esphome:
  name: s31_snake_light
  platform: ESP8266
  board: esp01_1m

wifi:
  # Create a file /config/esphome/secrets.yaml
  # and put the following (not commented, not indented):
  # ssid: "Your_Network_SSID_Name"
  # password: "YourSuperSecretPassword"
  networks:
  - ssid: !secret ssid
    password: !secret password
    bssid: !secret bssid_basement_front-EWS377AP-local
    priority: 2
  - ssid: !secret ssid
    password: !secret password
    priority: 1
  domain: !secret dns_suffix

  #power_save_mode: none

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "s31_snake_light setup"

captive_portal:

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:

ota:

uart:
  rx_pin: RX
  baud_rate: 4800

sensor:
  - platform: cse7766
    update_interval: 0.25s
    current:
      name: "s31_snake_light Current"
      filters:
        - or:
            - throttle: 20s
            - delta: 0.1
    voltage:
      name: "s31_snake_light Voltage"
      filters:
        - calibrate_linear:
            - 0.0 -> 0.0
            - 124.1 -> 125.0
        - or:
            - throttle: 20s
            - delta: 0.5
    power:
      name: "s31_snake_light Power"
      filters:
        - or:
            - throttle: 20s
            - delta: 5.0
      
switch:
  - platform: gpio
    name: "s31_snake_light Relay"
    pin: GPIO12
    id: relay
  - platform: restart
    name: "s31_snake_light Restart"

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "s31_snake_light Button"
    on_press:
      - switch.toggle: relay
    filters:
      - delayed_on_off: 100ms

status_led:
  pin:
    number: GPIO13
    inverted: yes

Can you ping the mDNS hostname (.local)?

I don’t use mDNS because its never worked reliably across VLANs, but I have the dns suffix specified in the config and all the others work fine with the DNS name…but this one looks like it is working both ways from the HA server

[core-ssh esphome]$ ping s31_snake_light_2.local
PING s31_snake_light_2.local (192.168.3.145): 56 data bytes
64 bytes from 192.168.3.145: seq=0 ttl=254 time=2.803 ms
64 bytes from 192.168.3.145: seq=1 ttl=254 time=4.845 ms
64 bytes from 192.168.3.145: seq=2 ttl=254 time=2.647 ms
64 bytes from 192.168.3.145: seq=3 ttl=254 time=2.340 ms
64 bytes from 192.168.3.145: seq=4 ttl=254 time=2.509 ms
64 bytes from 192.168.3.145: seq=5 ttl=254 time=2.650 ms
^C
--- s31_snake_light_2.local ping statistics ---
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max = 2.340/2.965/4.845 ms
[core-ssh esphome]$ ping s31_snake_light_2.apt
PING s31_snake_light_2.apt (192.168.3.145): 56 data bytes
64 bytes from 192.168.3.145: seq=0 ttl=254 time=11.960 ms
64 bytes from 192.168.3.145: seq=1 ttl=254 time=2.481 ms
64 bytes from 192.168.3.145: seq=2 ttl=254 time=2.452 ms
64 bytes from 192.168.3.145: seq=3 ttl=254 time=7.281 ms
64 bytes from 192.168.3.145: seq=4 ttl=254 time=7.501 ms
64 bytes from 192.168.3.145: seq=5 ttl=254 time=2.212 ms
^C
--- s31_snake_light_2.apt ping statistics ---
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max = 2.212/5.647/11.960 ms
[core-ssh esphome]$ 

It also shows up as online in ESPHome dashboard

So did the auto discovery in ha to add the new esphome nodes ever worked then? I think it solely utilizes mDNS and if that doesn’t do you need to add the device yourself by it’s IP (normal hostnames are not allowed) and that’s somewhat a PITA together with DHCP because once a device gets a new IP for some reason it needs to be added again to ha :thinking:

1 Like

each and every esphome node has it’s own ha integration. I can spot already three in your setup :point_down:

The IP here :point_up: is .1.221 on the other hand the IP here :point_down: is .3.145

Which one should it be? And what happens if you add a new integration to ha, choose esphome and enter the correct IP?

221 is the static HassOS Home Assistant machine where ESPHome addon and integration runs.

145 is the DHCP smart-plug flashed to ESPHome firmware I’m trying to connect to

I’ve never had to try and put in the address of the plug before anywhere, it “just works”

So somewhat mDNS than worked in the past for you :thinking:

Or just click this Link to Integrations: add integration – My Home Assistant and enter 192.168.3.145

3 Likes

Yeah, mDNS seems to randomly start/stop working for reasons I’ve never figured out why.

I’ve also had the opposite in the past where the HA shows the plugs and ESPHome says they are all offline inexplicably (but didn’t care because it all worked fine that way).

Seems it now is suddenly finding the plug after adding that as an integration, that’s rather confusing with the UI that shows it as 1 but its many? Anyway it shows and responds now (and I was able to use hostname.dns_suffix so DHCP won’t break it later)

3 Likes

If you added it manually it wasn’t found with it’s mDNS hostname (automagically).

That’s great :tada: and I think this possibility was just added very recently (maybe in ha 2022.7?) because before you were only able to add ether the mDNS hostname or the IP. (Maybe this PR includes it ESPHome use dhcp responses to update connection host of known devices by jesserockz · Pull Request #74206 · home-assistant/core · GitHub)

1 Like

I am just curious, personally never used ESPHome, but from what I remember, isn’t it like a Tasmota alternative? I know in order for devices to show from Tasmota you need to insert the 19 command into the command line. Does ESPHome not use something similar?

The part I’m curious about is the advantage of ESPHome over Tasmota, used Tasmota for years with no issues. I could just be completely wrong about them being alts of each other.

Honestly I don’t know the differences between ESPHome and Tasmota but they’re both alternative firmware for the cheap WiFi based devices…I went with ESPHome and Sonoff S31 plugs because I had a friend using HA and could help me figure out how to get it working, and it all “just worked” like magic after flashing the firmware onto it.

This is the first time I have ever experienced this issue where it didn’t “just work” out of the box immediately.

Is ESPHome based on MQTT or another protocol? I’m guessing that may be the major difference after you had to choose between hostname and mDNS. Tasmota, teach the device the topic and login via MQTT, tell it to broadcast and like you said “It Just Works”.

Lot’s of the advantages you will get with the native api :rocket: (but it still supports mqtt)

Advantages over MQTT

The ESPHome native API has many advantages over using MQTT for communication with Home Automation software (currently only Home Assistant). But MQTT is a great protocol and will never be removed. Features of native API (vs. MQTT):

  • Much more efficient: ESPHome encodes all messages in a highly optimized format with protocol buffers - for example binary sensor state messages are about 1/10 of the size.
  • One-click configuration: ESPHome just needs one click to set up in Home Assistant - no more messing around with retained MQTT discovery messages and alike.
  • One less single point of failure: In the ESPHome native API each ESP is its own server. With MQTT, when the broker shuts off nothing can communicate anymore.
  • Stability: Since ESPHome has far more control over the protocol than with MQTT, it’s really easy for us to roll out stability improvements.
  • Low Latency: The native API is optimized for very low latency, usually this is only a couple of milliseconds and far less than can be noticed by the eye.

For the native api that’s not necessary and also there is no (extra) point of failure (or “weak link”) needed like a mqtt broker :raised_hands:

Sounds like me clicking the update-all button and having a cold beer :beer: while all of my ~95 esphome devices get their over-the-air update :tada:

1 Like

Bruh, do I need to switch my Tasmos to ESPH? My garage door opener could be faster. I guess the important question here is do they by any chance have an OTA Flash like Tasmota used to? [Obviously near impossible to find eq that works with the OTA Tas now.]

ALSO, THANK YOU FOR THAT!