M
M
Michael2021-04-07 16:38:15
Internet of Things
Michael, 2021-04-07 16:38:15

Does Home Assistant give an error when trying to connect a new device?

Read about Home Assistant. See how easy it is. I decided to do something on my own and immediately ran into a bunch of problems.

With difficulty, I connected one nodemcu board, which controls the temperature sensor and the pir sensor. I connected via IP, because I couldn’t do it otherwise. When I tried to connect directly via Home Assistant in conjunction with ESPHome, I got an error like: "could not find the ip of the device, are you sure it's online?"

code for the first board:

esphome:
  name: maingatenode1
  platform: ESP8266
  board: nodemcuv2
  

wifi:
  ssid: "mywifi"
  password: "mypass"
  # manual_ip:
  #   # Set this to the IP of the ESP
  #   static_ip: 10.0.0.42
  #   # Set this to the IP address of the router. Often ends with .1
  #   gateway: 10.0.0.1
  #   # The subnet of the network. 255.255.255.0 works for most home networks.
  #   subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "ap_ssid"
    password: "ap_pass"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

sensor:
  platform: dht
  pin: D8
  temperature:
    name: "Temperature"
  humidity:
    name: "Humidity"

#move sensor
binary_sensor:
  - platform: gpio
    pin: D7
    name: "PIR Sensor"
    device_class: motion


With difficulty, I connected it by adding an ip address to the host name.

I tried to do the same with the second nodemcu, it gave me a static ip address error.
606db472df4cb790350901.png

Set static ip:
manual_ip:
    # Set this to the IP of the ESP
    static_ip: 10.0.0.43
    # Set this to the IP address of the router. Often ends with .1
    gateway: 10.0.0.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

And it started throwing an error:

Unable to connect to ESP. Please make sure your YAML file contains the string 'api:'.


second board code:
esphome:
  name: el_marta_socket
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "mywifi"
  password: "mypass"
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 10.0.0.43
    # Set this to the IP address of the router. Often ends with .1
    gateway: 10.0.0.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "ap_ssid"
    password: "ap_pass"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "*****"

ota:
  password: "*****"

switch:
  - platform: gpio
    name: "Socket_relay_1"
    pin: D0
    inverted: True
    restore_mode: RESTORE_DEFAULT_OFF


How to fix it? The second day I suffer

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Zaitsev, 2021-04-07
@KonstantineZ

There is a great YouTube channel with HA tutorials by Alex Kvazis

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question