ESPHome on production and test HA

Hi all

I would like to have ESPHome on two different HA, one for production and one for test.

I’ve installed both, flashed from the test environment, but I don’t see the entity defined in the ESPHome yaml

I don’t see them neither in the production environment.

My yaml is like this

#==================
#=== Substitutions
#==================
substitutions:
  device_name: esphome_irrigation_controller
  friendly_name: ESPHome Irrigation Controller
#==================


# Board
esphome:
  name: ${device_name}
  platform: ESP8266
  board: nodemcuv2
  on_boot:
    - switch.turn_off: relay1
    - switch.turn_off: relay2
    - switch.turn_off: relay3
    - switch.turn_off: relay4


# WiFi
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_pwd
  fast_connect: True
  ap:
    ssid: Irrigation Fallback Hotspot
    password: !secret wifi_pwd2

# Fallback portal 
captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

# Enable Over-The-Air updates
ota:

# # Enable Web server.
# web_server:
#   port: 80
mqtt:
  broker: !secret mqtt_ip
  username: !secret mqtt_user
  password: !secret mqtt_pwd

web_server:
  port: 80
    
#=== Sensors
sensor:
  #=== Uptime
  - platform: uptime
    name: ${friendly_name} Uptime

  #=== WiFi Signal
  - platform: wifi_signal
    name: esphome_irrigation_controller_wifi_signal
    update_interval: 60s

  #=== Failsafe time
  - platform: homeassistant
    id: failsafe_time
    name: ${friendly_name} Failsafe Time
    entity_id: input_number.irrigation_failsafe_time_in_seconds

  #=== Temperature Sensor DHT
  - platform: dht
    pin: 14
    temperature:
      name: "Temperatura Patio"
    humidity:
      name: "Umidità Patio"
    update_interval: 60s


#=== Switches
switch:
  #=== Zone Relay 1
  - platform: gpio
    pin: 
      number: 0
      inverted: True
    name: Garden Irrigation Relay Zone1
    id: relay1
    restore_mode : ALWAYS_OFF
    interlock: &interlock_group [relay1, relay2, relay3, relay4]
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe

  #=== Zone Relay 2
  - platform: gpio
    name: Garden Irrigation Relay Zone2
    id: relay2
    pin: 
      number: 4
      inverted: True
    restore_mode : ALWAYS_OFF
    interlock: *interlock_group
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe
      
  #=== Zone Relay 3
  - platform: gpio
    name: Garden Irrigation Relay Zone3
    id: relay3
    pin: 
      number: 12
      inverted: True
    restore_mode : ALWAYS_OFF
    interlock: *interlock_group
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe
      
  #=== Zone Relay 4
  - platform: gpio
    name: Garden Irrigation Relay Zone4
    id: relay4
    pin: 
      number: 13
      inverted: True
    restore_mode : ALWAYS_OFF
    interlock: *interlock_group
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe


  #=== Reboot
  - platform: restart
    name: ${friendly_name} Reboot
    id: reboot


#=== Scripts
script:

  #=== Set failsafe time converted to milliseconds
  - id: failsafe
    then:
      - delay: !lambda |-
          return id(failsafe_time).state * 1000;
      - switch.turn_off: relay1
      - switch.turn_off: relay2
      - switch.turn_off: relay3
      - switch.turn_off: relay4

Is there anything I should do in this situation to have it point to the correct HA?

Thanks

The ESPHome configuration does not point to Home Assistant, but you point Home Assistant to each ESPHome device, available via the “Integrations” page.

When I had only one HA (and ESPHome), I haven’t done the integration and it was working fine,

I see that in the integration is requested an host ( IP address of HA ? ) and a port, 6053.
In the ESPHome configuration there is another port, 6052, they should be like this, not the same?

After the integration part, should I do something in the yaml code of the ESP ?

Thanks!

Alright, I noticed that you have api and mqtt defined - probably HA auto-discovered the device via MQTT then.

If you use the HA integration, the connection will be established to the ESP device on port 6053 (Native API Component — ESPHome).

The host there is the ESP device’s hostname or IP address.

Sorry, I can’t find port 6052 in the configuration you posted.

When configuring the device in HA via the integration, HA immediately tried to connect, generates entities, etc. Nothing else required in the ESP device’s configuration.

So, for every device I want to use with that specific HA i have to create an integration with the IP of the device, correct? If yes, I didn’t know it and make a lot of sense.

It is in the addon page, when you install ESPHome in HA.

Now it works really fine.

Thanks

1 Like

That is correct.

1 Like