Hello there
I would like to read the message of a calendar and convert it into an input_number. The calendar entries and input_numbers are already defined and are following the same nomenclature. For example, the message in the calendar “Low Demand Season - Standard” should be converted to “input_number.low_demand_season_standard”. So it should be possible to do this:
- variables:
current_event: "{{ state_attr('calendar.eskom_ruraflex', 'message') }}"
formatted_event: "{{ current_event | replace(' ', '_') | replace(' - ', '_') | lower }}"
input_number_entity: "input_number.{{ formatted_event }}"
But all I am getting in the editor is:
action:
- variables:
current_event: "Low Demand Season - Standard"
formatted_event: ""
input_number_entity: "input_number."
with the error ‘formatted_event’ undefined. I am puzzled, since the event is actually defined.
The big picture: I have a tariff schedule in the calendar, the name of the current entry should be taken to copy the tariff which is given in the input_number to an input_number.current_tariff. This is used to calculate the power bill.