Can't get a sensor value from the homeassistant "text_sensor" or from "sensor"

I have a template sensor that takes in input_datetime and returns the number of days remaining until that date. However, I cannot event get output the state to log out. (I eventually will printf this out to the tm1637)

I’ve tried this for the text_sensor

text_sensor:
  - platform: homeassistant
    name: "Countdown"
    id: countdown
    entity_id: sensor.days_remaining

display:
  platform: tm1637
  id: tm1637_display
  clk_pin: GPIO12
  dio_pin: GPIO13
  update_interval: 10s
  intensity: 1
  lambda: |-
    ESP_LOGD("main", "state %s", id(countdown).state.c_str());

and this just returns state

And I’ve tried this for sensor

sensor:
  - platform: homeassistant
    name: "Countdown"
    id: countdown
    entity_id: sensor.days_remaining

display:
  platform: tm1637
  id: tm1637_display
  clk_pin: GPIO12
  dio_pin: GPIO13
  update_interval: 10s
  intensity: 1
  lambda: |-
    ESP_LOGD("main", "state %d", id(countdown).state);

And it just returns state 0 even though the current value is 7

I feel like I’m missing something simple, but I can’t find it.

Are you sure that the device is added in esphome integration?

Yes, the device was configured and flashed via the esphome add-on and I can see the device listed under integrations for ESPHome. Unless there some other integration point I’m missing. This is the first ESPHome device I’ve setup that pulls data to Home Assistant rather than push data to it.

Not quite sure what to make of it, but removing the name and switching to a float for the output solved the issue

sensor:
  - platform: homeassistant
    id: countdown
    entity_id: sensor.days_remaining

display:
  platform: tm1637
  id: tm1637_display
  clk_pin: GPIO12
  dio_pin: GPIO13
  update_interval: 10s
  intensity: 1
  lambda: |-
    ESP_LOGD("main", "state %f", id(countdown).state);

Did you get this print. I get an error when I put the it.printf in front of it

Yes, by removing name from the sensor definition, everything worked. I haven’t tried with it.printf so I can’t speak to that