pcon
(Patrick Connelly)
April 9, 2021, 3:57pm
1
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?
pcon
(Patrick Connelly)
April 9, 2021, 4:38pm
3
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.
pcon
(Patrick Connelly)
April 9, 2021, 6:20pm
4
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);
d_tech
(Danny Yeadon)
October 9, 2021, 12:25pm
5
Did you get this print. I get an error when I put the it.printf in front of it
pcon
(Patrick Connelly)
October 12, 2021, 4:59pm
6
Yes, by removing name
from the sensor definition, everything worked. I haven’t tried with it.printf
so I can’t speak to that