dannerph / homeassistant-solcast

Apache License 2.0
19 stars 3 forks source link

History attributes as template sensors #7

Closed BeyondPixels closed 3 years ago

BeyondPixels commented 3 years ago

Hello,

Sorry to bother you with this but I feel like a tried a millions ways and it doesn't work.

I'd like the values from "Tomorrow" and "The day after tomorrow" as sensors to be displayed in lovelace but I can't figure out how to do it.

Here is what I've written:

"value_template: {{ states.sensor.solcast_forecast_2.attributes.tomorrow }}" returns an error: "invalid key: "OrderedDict([('states.sensor.solcast_forecast_2.attributes.Tomorrow', None)])" in "/config/sensors/sensors_solcast.yaml", line 12, column 0"

...And it displays "Unknown" on Lovelace.

"value_template: "{{ state_attr('sensor.solcast_forecast_2','Tomorrow') }}" doesn't return an error but still displays "Unknown" in Lovelace.

image

image

Any idea why? Thanks in advance

dannerph commented 3 years ago

Hi there,

{{ state_attr('sensor.solcast_forecast','tomorrow') }} and {{ state_attr('sensor.solcast_forecast','the day after tomorrow') }} is working for me. This is actually the way you should retrieve attribute values.

Your issue might be becuase you have bit letter of T insted of a small one?

You can try it using the template section of the development tools.