I’m trying to get the value of an attribute of an HA entity and display it in a LCD display. Here the code:
text_sensor:
- platform: homeassistant
entity_id: light.luce_studio
attribute: brightness
id: ha_slider_luce_studio
internal: 'true'
display:
- platform: ili9xxx
id: touch_template_display
model: ST7796
cs_pin: GPIO15
dc_pin: GPIO21
reset_pin: GPIO22
rotation: 90
pages:
- id: home
lambda: |2-
ESP_LOGD("custom", "The value of attribute is: %f", id(ha_slider_luce_studio).state);
Log output:
[D][custom:142]: The value of attribute is: 0.000000
I always get 0 as value and try to debug. I wonder how the attributes are stored in the sensor object and since I’m new to c++ I have hard time to even debug data types. Maybe someone can help with this.