ESPHome built-in homeassistant variables

Hello. I’m new to ESPHome.
I’m interested in the built-in ids for the platforms.

Homeassistant has an id called “esptime” . I found it by accident, but I cannot find it documented anywhere, and I wonder what other homeassistant ids are available.

I’ve tried the obvious places, but I get the impression that the ESPHome documentation is a work in progress.

I get that most ids will be entities in homeassistant, but esptime seems “special”, and I wonder if there are others.

Can anyone point me in the right direction?

Thanks!

Do you have this in your ESPHome device config?

time:
  - platform: homeassistant
    id: esptime

https://esphome.io/index.html#time-components

Hi,

many thanks for that pointer! One thing though - (remember I’m a newbie to ESPHome)
Why does the example show this

time:

  • platform: homeassistant
    id: homeassistant_time
    Instead of
  • platform: homeassistant
    id: esptime

?
Was there a change and the documentation didn’t keep up, or is the esptime a deprecated version of homeassistant_time?

Thanks!

ID defines only an identifier to access a sensor in ESPHome.

The platform argument defines the type or better source platform. Both: homeassistant.

This means: It is the same but addressable at different names.
From my point of view, the better name will be homeassistant_time or ha_time whatever because than its more clear that the source of the timestamp is homeassistant.

The goal is to get the same timestamp on ESP defined by Home Assistant.

PS: you will see at ESPHome multiple different examples at one page using different platform values.
For example the ethernet component (Ethernet Component — ESPHome) because of different chipsets can be used.

Thank you. The penny has dropped! (der Groschen ist gefallen?)

So in this:

time:

  • platform: homeassistant
    id: homeassistant_time

the “time:” specifier is the important keyword and the id can be absolutely anything, referred to later.

Thanks again!

B.

PS I did say that I was new to this!

Yes, id can be anything but has to be unique. You can access the sensor state for example via id(mysensorid).state in a lambda later on. If your sensor has mysensorid set at the id configuration.

The ESPHome documentation is well done, it could be a bit overwhelming because of the huge amount of possibilities.

From my point of view, ESPHome is nicely done because your firmware only contains the code which is needed instead of Tasmota for example. But it has a steeper learning curve.