I want some attributes, that derive from the long template and the variables created.
But the problem is, that attributes has a different rendering compared to state and the sensor with attributes does not render and is not available
Invalid config for 'template' at template/solar_grandl_math.yaml, line 9: expected a dictionary for dictionary value 'sensor->0->attributes', got ' {% set Albedo = 0.2 |float -%} Albedo: {{ Albedo }}'
Even the creation of a dictionary did not solve the error.
My plan was to reuse the long calculation as a macro.
This macro can return the status
AND it can return a dictionary like structure or two lists.
Create the attributes with {% for key, value in dict %)
…
{{key}}: {{value}}
sensor:
- name: solar_grandl_math
unique_id: solar_grandl_math
icon: mdi:solar-power-variant-outline
state: 'Attribute für Kalkulation der Solarstrahlung abhängig vom Sonnenstand'
attributes:
{'Albedo': 0.2}
Result:
icon: mdi:solar-power-variant-outline
friendly_name: solar_grandl_math
Albedo: 0.2
re-usable Template / macro is solved.
What is not:
in section attributeS, not attribute!, a template is not rendered.
Gives an error.
Is that solvable?
Thank you!
RT