I have a sensor, that has this attribute:
next_best_at: 15, 14, 16, 23, 17, 22, 13, 12, 11, 18, 21, 19, 20
and I save in a variable the first position:
{% set hora = state_attr('sensor.pvpc', 'next_best_at')[0] %}
This saves for example the value 15
And then I have and attribute like this
price_15h: 0.24234
Is is it possible to replace the number in the the attribute name (15 in price_15h), with the variable value set before.
Thank you!