Host Platform: how to?

Hi everybody,

I tried setting up Host Platform, but it doesn’t seem to do anything. Below is my config as well as the debug log.

esphome:
  name: hosttest
  friendly_name: HOSTTEST
  area: Arbeitszimmer

# Example configuration entry
host:

button:
  - platform: template
    name: Testbutton
    on_press:
      then:
        - logger.log: Button Pressed

# Enable logging
logger:


# Enable Home Assistant API
api: 
  encryption:
    key: !secret encryption_key

I ran this on my desktop via esphome run hosttest.yaml.

INFO Successfully compiled program.
DEBUG Running:  /mnt/hass/esphome/.esphome/build/hosttest/.pioenvs/hosttest/program
[13:06:58][I][app:029]: Running through setup()...
[13:06:58][C][api:026]: Setting up Home Assistant API server...
[13:06:58][I][app:062]: setup() finished successfully!
[13:06:58][W][component:157]: Component api set Warning flag: unspecified
[13:06:58][I][app:100]: ESPHome version 2024.10.3 compiled on Nov 15 2024, 13:06:47
[13:06:58][C][logger:185]: Logger:
[13:06:58][C][logger:186]:   Level: DEBUG
[13:06:58][C][mdns:116]: mDNS:
[13:06:58][C][mdns:117]:   Hostname: hosttest
[13:06:58][C][api:140]: API Server:
[13:06:58][C][api:141]:   Address: :6053
[13:06:58][C][api:143]:   Using noise encryption: YES

That’s it. There will be no further output.

My host computer is on the same network as Home Assistant. I made sure to disable my firewall, in case it interfered with this. No difference. I ran esphome clean hosttest.yaml in between tries.

Perhaps this is related to the API component, but unspecified doesn’t help me much. Have any of you successfully gotten this to run?

Thanks in advance :slight_smile:

What are your expectations?
This should create an ESPHome instance on your desktop/laptop computer that you can add to HA. The only exposed entity will be a button.

How far did you go?

I have the same question as @koying , what do you want to do? Or more specifically, why do you think you need the Host Platform?

In three years of programming ESPHome projects, this is the first time I had ever heard of Host Platform.

1 Like

Did you add your desktop as a device in the HA ESPHome integration? It won’t find it automatically.

1 Like

Thank you @clydebarrow
That did it. I assumed it would be auto-discovered, because I haven’t had any device not being auto-discovered yet… but manually adding it worked just fine.

@koying

How far did you go?

I did as far as I described in my initial post. It included my steps and the log. My error was not to add the device to Home Assistant manually.

What are your expectations?
(…)
The only exposed entity will be a button.

This. I wanted this button in Home Assistant to see whether this worked. I did not see the button because the device had not automatically been discovered by Home Assistant. Now that I added it, I do see the button and get the desired output when pressing it (log in command line on Host PC, registered button press within Home Assistant).

I can build from there.

@stevemann I don’t know if/how much you experiment with ESPHome, but I find it much easier to do it this way than to flash an ESP, test something, change something, re-flash it, test again, re-flash again, etc. etc.

Now I can try things (custom_components, lambda stuff) without all these steps. Edit my yaml, run it locally, have it in Home Assistant. No ESP device needed, no flashing.

I have also found that some ESPs don’t like being flashed countless times. Some would not respond after a while, others would not (seem to) accept the changes. So I’d change a bunch of things in my yaml, flash it wirelessly, get the “success” output, but nothing had changed - the ESP was still flashed with the previous firmware (or rather, some previous firmware, perhaps one four flashes ago). This could be circumvented by erasing the flash before flashing the new firmware, which, as you can imagine, is also quite bothersome.

This allows me to test stuff without all these steps, and, in fact, without even having to have a spare ESP that I can test stuff on.

this is the first time I had ever heard of Host Platform.

Have you heard of the tankerkönig integration? It will show you gas prices for German gas stations. Unless you live in Germany and like to keep track of such things, you might have never heard of it. Doesn’t mean it isn’t helpful if one needs it :wink: