Sensor platform homeassistant question

I have an entity in Home Assistant that I want to use in ESPHome. I tried making a sensor from it using (in sensors.yaml):

sensor:
  - platform: homeassistant
    name: "steve-glucose"
    entity_id: sensor.dexcom_stevermann_glucose_value

But after restarting Home Assistant, I don’t see “sensor.steve-glucose” in dev tools → states.

Any tips would be appreciated.

The answer is in the ESPHome documentation:

https://esphome.io/components/sensor/homeassistant

Screenshot 2024-03-10 at 18-17-03 Home Assistant Sensor

1 Like

And to see if the sensor made it to ESPHome, you could check the esp logs, or use its web-interface

Pardon me for hijacking your post but, speaking of HA sensors. If possible, what is the correct syntax for multiple sensor attributes?

sensor:
  - platform: homeassistant
    id: current_temperature
    entity_id: climate.living_room
    attribute: current_temperature

Since the thread is marked “solved”, you should start a new thread. Your question will get more views then.

I think this is correct. (I am NOT an expert). I am pretty sure that you can only specify ONE attribute of a sensor. If you don’t specify an attribute, you get the state.

Using your example:

sensor:
  - platform: homeassistant
    id: current_temperature
    entity_id: climate.living_room

returns the state of the entity, and

sensor:
  - platform: homeassistant
    id: current_temperature
    entity_id: climate.living_room
    attribute: current_temperature

returns the value of the attribute.
As I said, I think you can only get the state or one attribute.

For multiple attributes, you need multiple sensors:

sensor:
  - platform: homeassistant
    id: current_temperature
    entity_id: climate.living_room
    attribute: current_temperature
  - platform: homeassistant
    id: current_humidity 
   entity_id: climate.living_room 
   attribute: current_humidity
1 Like

There are some old posts for this topic and there’s no need to for another one. More specifically I was curious if adding multiple attributes was a native configuration available in Esphome now or in the future.

There’s posts going back to 2021 that have solutions for combining multiple attributes in 1 sensor, I already knew it was possible but, it requires a few steps and a semi-complicated lambda/C++.

Seeking a native esphome configuration if available.