Hello,
i am new to HA, but i did some changes, for example i actually changed the configuration structure from configuration.yaml to folder.
So i have a folder named sensor and a folder named template.
There i have my waste_collection in it in different .yaml files and they are working perfect.
I added them with the following lines to my configuration.yaml
sensor: !include_dir_list sensor
template: !include_dir_list template
So far, so good.
Now i started creating a new sensor for my eg export “cost/earning”.
So i added a earn.yaml to my sensor folder with the following lines:
- platform: template
sensors:
entity_1:
friendly_name: "STR1"
value_template: "{{ states('sensor.growatt_today_s_grid_export1') | float }}" # Wert von Entity 1
entity_2:
friendly_name: "STR2"
value_template: "{{ states('input_number.aktueller_strompreis_export') | float }}" # Wert von Entity 2
multiplication_result:
friendly_name: "STRResult"
value_template: "{{ state_attr('sensor.entity_1', 'value') * state_attr('sensor.entity_2', 'value') | round(2) }}"
But i receive a warning when i do the .yaml check.
Konfigurationswarnungen
Invalid config for 'sensor' at sensor/strreult.yaml, line 1: expected a dictionary '', got [{'platform': 'template', 'sensors': {'entity_1': {'friendly_name': 'STR1', 'value_template': "{{ states('sensor.growatt_today_s_grid_export1') | float }}"}, 'entity_2': {'friendly_name': 'STR2', 'value_template': "{{ states('input_number.aktueller_strompreis_export') | float }}"}, 'multiplication_result': {'friendly_name': 'STRResult', 'value_template': "{{ state_attr('sensor.entity_1', 'value') * state_attr('sensor.entity_2', 'value') | round(2) }}"}}}]
I have created a helper with “input_number.aktueller_strompreis_export” there i have a value “0,081 EUR” inside.
Then i have the entit from my inverter named “sensor.growatt_today_s_grid_export” with the Value 59,1 kWh eg for today.
I dont get it working to multiply the two numbers and getting a new entity to use for my dashboard.
Does anyone have an idea what is wrong here ?
Thank you in advance.