Does ESPHome (try to) connect to HA by default?

I do run HA, but only for limited purposes – mainly for its ability to talk to my Zigbee thermostat. (Though I confess I’m getting hooked on its graphing capabilities as well!)

I’ve started deploying ESPHome on some small devices, for IR remote reception, and temperature sensing. The configs are pretty basic.

Without having to sniff the network, are the ESPHome devices busy trying to connect to HA? (I don’t have the HA integration configured.) For now, I’d rather they didn’t, or, at least, I’d like to have full control over whether they do or not.

What makes me suspicious are the log messages that look like this:

[09:13:10][D][sensor:126]: 'SHT40': Sending state 22.97856 °C with 1 decimals of accuracy

Where exactly is the state being “sent”?

My config for this module looks like this. Are the “api” and “ota” stanzas under “Enable Home Assistant API” significant?

  name: referee
  friendly_name: Temperature "Referee"

  board: huzzah

  sda: 4
  scl: 5
  scan: true

  - platform: sht4x
    update_interval: 10s
      accuracy_decimals: 1
      name: "SHT40"
      accuracy_decimals: 1
      name: "SHT40 Humidity"

# Enable logging
  level: debug

# Enable Home Assistant API
  password: "esphome_ota"

  password: "esphome_ota"

  port: 80
  local: true

  ssid: "YYYYY"
  password: "XXXXX"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
    ssid: "Referee Fallback Hotspot"
    password: "XXXXXXXX"


The api one certainly is. That says “please try to connect to HA”.

On the Used Car Lot:
“This car is like new. It was owned by a little old lady who only drove it to church”.

Wow, are you missing a lot! Are you setting the thermostat or simply reading the current values?

What are you running ESPHome on?


It’s pretty clear from the OTA update component page that the esphome tool needs to have that one enabled.
Will disabling “api” affect the device’s ability to communicate with the esphome command line tools?

No. It really won’t do any harm to have your devices reporting into HA though.

1 Like

I understand that I’m “missing a lot”. I have an RPi installation – seemed easiest, if a bit wasteful of hardware, for my purposes.

But before you think too little of me :slight_smile: , let me say that I’ve been rolling my own home automation for over 30 years. I have X10 modules everywhere (including on my thermostats, until recent upgrades), I have charts of inside and outside temperature, I have a DIY sensor on my power meter for keeping track of electricity consumption, I have whole house audio via piCorePlayer in 6 or 7 rooms, most of which also have IR receivers which drive my home automation menu system. The menu system responds to IR input via voice, and gives access to the weather forecast, temperatures, wakeup alarms, our home voicemail, control of the audio system, and other miscellaneous stuff.

So you’ll have to forgive me if I think of HA as just one more component, rather than the central feature. :slight_smile:


You’re dating yourself.

I sold all of my X-10 stuff on eBay years ago. (I did find a 4-switch wall plate you can have for the cost of shipping).

So, how are you controlling/monitoring all of those devices? I started with Node Red for about a year before being introduced to Home Assistant and quickly adopted HA as my primary host. Node Red is well integrated into Home Assistant as an Add On. There are some things that I just find easier in NR.

ESPHome started as a stand-alone program to run on ESP devices. The api: component is how ESPHome communicates with Home Assistant. You don’t need api as you could do everything over MQTT.

So, if you only need I2C to connect to your thermostat, you could easily do this with a Raspberry Pi Micro.

I won’t claim my system is beautiful – it’s not. It’s all very ad-hoc, mostly written in bash (these days – I’m not sure bash had been written yet when I started :wink: ). It uses Festival for text-to-speech, centralized lircd for handling the remotes, lots of ssh tunnels to get events from here to there, etc. The sprinklers and X10 are scheduled via easy to use scripts which generate crontabs to do the actual scheduling.

But it’s mine, and I’m not about to give it all up lightly.

And… not “thermometer”, but “thermostat”. I finally install smart thermostats for our steam boiler and the electric baseboards in our sun room. To keep them both open protocol, so I can stay cloud-free, one of them ended up being Zigbee, which is how I ended up with HA. I could have used the zigbee2mqtt, but HA seemed like it would offer more in the long run, so that’s were I am.

That’s where I was a few years ago. Mostly everything was controlled on Node-Red. It wasn’t until I bought a couple of Z-Wave switches that someone on the Node-Red forum suggested that Home Assistant was the easiest way to get my switches into Node-Red. Long story short, now 90% of my home is controlled by Home Assistant and 10% on Node-Red. I don’t use it often but having my Home Assistant on DuckDuck puts my dashboard on my phone anywhere.

Try it. You’ll like it.

1 Like

Back on topic. Home assistant will discover esphome devices on your network and offer to add the integration.

Thanks. So if I don’t want it to keep noticing a particular device, I should get rid of “api:”.

The discovery is via zeroconf and seems to be activated here esphome/ at 2622e59b0b6004f754e8ec7d0ce6129ef4b0b80c · esphome/esphome · GitHub so yes I think disabling api: will disable zeroconf.

Or you could disable zeroconf discovery in home assistant.

Or you could ignore the individual esphome devices when discovered in home assistant.

1 Like

API: is how the ESP device communicates with Home Assistant. I am pretty sure that you don’t need api: if you use MQTT from your ESP device.

Why is discovery an issue? There may be another possible solution that doesn’t even need Home Assistant, but you haven’t shared your device’s yaml code, and just what are you doing with the mystery device? “Thermostat” is pretty broad. What is the make and model? (Someone else here may have it as well).

My apologies. I seem to have confused things, and we got off topic, and that muddied the water further.

Starting over: the esphome device I’m working with currently is a temperature sensor (so, “thermometer”), and while I might want HA to see this one, in the more general case, I’d like to be able to control whether HA sees it or not. @nickrout has answered this, and I now know how to do it.

The reason I might not need HA to see the device is that it might have nothing to do with HA. For instance, I’m also working on an esphome-based IR receiver. HA knows nothing about my IR remotes, so there’s no point in HA hearing from that receiver. The device will publish its IR codes to my other systems directly, using HTTP POST. (At least, that’s my current plan.)

That’s it.

The API is not restricted to ha, you could use it with other systems. There is at least one other home automation system which implements the API.

You can also use mqtt to publish sensors. It is universal.

Anyway I have given you a number of ways to avoid discovery. Have fun. And good luck.

There’s no harm either.

Actually, if you’re running HA on a RPi from an SD card, and your ESP device is generating a lot of state changes, you would be spamming the Recorder database with things you don’t need. Recorder can fill and/or kill an SD card pretty quickly if you’re not careful. Sure, you can exclude them all, but not sending in the first place seems a better solution.

I was curious about the implications of leaving off the API, too. I haven’t run into the need yet, but it’s good to know my options. Thanks for an informative discussion!

I am running a ESPhome device indipendently from HA (because it is not located in my house).
It is configured without api: and (it seems) it not communicates with HA (no logs about it). I manage some behaviours via internal webserver. Perfect so far.

However I’m experiencing periodic reboots and can’t figure out why.
Wondering if even without api: there might be tentatives to connect to HA periodically.

Does it broadcast a zeroconf packet _esphomelib._tcp.local.?

I am not an expert, but this was based on my early experience with ESPHome. When I started using ESPHome, most of my WiFi devices were running Tasmota/MQTT, so naturally I put MQTT on my devices. However I quickly discovered how well integrated ESPHome is with HA over the HAOS API and have flashed all of my Tasmota devices with ESPHome.