Problem with text_sensor

I have got a ESP8266 with an attached OLED display. I like to display data from my home assistant system. So i tried this:

  - platform: homeassistant
    name: Ausgabetext
    id: my_sensor
    entity_id: sensor.moon

  - platform: ssd1306_spi
    model: "SSD1306 128x64"
    cs_pin: D5
    dc_pin: D4
    reset_pin: D3
    lambda: |-
      std::string val = id(my_sensor).state;
      ESP_LOGI("main", "Value: %s", val.c_str());

Everything works fine but i cant get any text from home assistant. id(my_sensor).state; is empty. A quick test with a numeric value did not work also “nan”. I am on the latest and esphome addon. The communication between the ESP is working sensor data from the esp ist transmitted to the host.

Where is my/the problem?

Greeting from germany


Hey. I have the same problem. Did you manage to solve?

I think this will be fixed in the next HA release

Sorry, i think i posted the question in the wrong topic :frowning:

Yeah that was my original thread. The fix does work for sending state vs the HA state object, which was the cause of NaN for me. It’s not in the release of HA yet but it’s only a few lines to patch.

Check out: