I want to put my sensors in templmate.yaml file but I get a lot off errors.
# EMHASS integreer Solcast Forcast oost en west samengevoegd
- platform: rest
name: "Solcast Forecast Zonnetje Z/O"
json_attributes:
- forecasts
resource: https://api.solcast.com.au/rooftop_sites/2b55-56d8-7046-a4d8/forecasts?format=json&api_key=jKQ62J688md1XW-nSabOg81SZcVAblIQ&hours=24
method: GET
value_template: "{{ (value_json.forecasts[0].pv_estimate)|round(2) }}"
unit_of_measurement: "kW"
device_class: power
scan_interval: 86400
force_update: true
- platform: rest
name: "Solcast Forecast Zonnetje Z/W"
json_attributes:
- forecasts
resource: https://api.solcast.com.au/rooftop_sites/521d-2dc0-0583-a262/forecasts?format=json&api_key=jKQ62J688md1XW-nSabOg81SZcVAblIQ&hours=24
method: GET
value_template: "{{ (value_json.forecasts[0].pv_estimate)|round(2) }}"
unit_of_measurement: "kW"
device_class: power
scan_interval: 86400
force_update: true
- platform: template
sensors:
solcast_24hrs_forecast_zonnetje_z_o:
value_template: >-
{%- set power = state_attr('sensor.solcast_forecast_zonnetje_z_o', 'forecasts') | map(attribute='pv_estimate') | list %}
{%- set values_all = namespace(all=[]) %}
{% for i in range(power | length) %}
{%- set v = (power[i] | float |multiply(1000) ) | int(0) %}
{%- set values_all.all = values_all.all + [ v ] %}
{%- endfor %} {{ (values_all.all)[:48] }}
solcast_24hrs_forecast_zonnetje_z_w:
value_template: >-
{%- set power = state_attr('sensor.solcast_forecast_zonnetje_z_w', 'forecasts') | map(attribute='pv_estimate') | list %}
{%- set values_all = namespace(all=[]) %}
{% for i in range(power | length) %}
{%- set v = (power[i] | float |multiply(1000) ) | int(0) %}
{%- set values_all.all = values_all.all + [ v ] %}
{%- endfor %} {{ (values_all.all)[:48] }}
solcast_24hrs_forecast:
value_template: >-
{% set a = states("sensor.solcast_24hrs_forecast_zonnetje_z_o")[1:-1].split(',') | map('int') | list %}
{% set b = states("sensor.solcast_24hrs_forecast_zonnetje_z_w")[1:-1].split(',') | map('int') | list %}
{% set ns = namespace(items = []) %}
{% for i in range(a | length) %}
{% set ns.items = ns.items + [ a[i] + b[i] ] %}
{% endfor %}
{{ ns.items }}
Logger: homeassistant.config
Bron: config.py:609
First occurred: 09:19:42 (35 gebeurtenissen)
Laatst gelogd: 16:45:47
- Invalid config for ‘template’ at templates.yaml, line 63: ‘platform’ is an invalid option for ‘template’, check: platform Invalid config for ‘template’ at templates.yaml, line 64: ‘name’ is an invalid option for ‘template’, check: name Invalid config for ‘template’ at templates.yaml, line 65: ‘json_attributes’ is an invalid option for ‘template’, check: json_attributes Invalid config for ‘template’ at templates.yaml, line 67: ‘resource’ is an invalid option for ‘template’, check: resource Invalid config for ‘template’ at templates.yaml, line 68: ‘method’ is an invalid option for ‘template’, check: method Invalid config for ‘template’ at templates.yaml, line 69: ‘value_template’ is an invalid option for ‘template’, check: value_template Invalid config for ‘template’ at templates.yaml, line 70: ‘unit_of_measurement’ is an invalid option for ‘template’, check: unit_of_measurement Invalid config for ‘template’ at templates.yaml, line 71: ‘device_class’ is an invalid option for ‘template’, check: device_class Invalid config for ‘template’ at templates.yaml, line 72: ‘scan_interval’ is an invalid option for ‘template’, check: scan_interval Invalid config for ‘template’ at templates.yaml, line 73: ‘force_update’ is an invalid option for ‘template’, check: force_update
- Invalid config for ‘template’ at templates.yaml, line 75: ‘platform’ is an invalid option for ‘template’, check: platform Invalid config for ‘template’ at templates.yaml, line 76: ‘name’ is an invalid option for ‘template’, check: name Invalid config for ‘template’ at templates.yaml, line 77: ‘json_attributes’ is an invalid option for ‘template’, check: json_attributes Invalid config for ‘template’ at templates.yaml, line 79: ‘resource’ is an invalid option for ‘template’, check: resource Invalid config for ‘template’ at templates.yaml, line 80: ‘method’ is an invalid option for ‘template’, check: method Invalid config for ‘template’ at templates.yaml, line 81: ‘value_template’ is an invalid option for ‘template’, check: value_template Invalid config for ‘template’ at templates.yaml, line 82: ‘unit_of_measurement’ is an invalid option for ‘template’, check: unit_of_measurement Invalid config for ‘template’ at templates.yaml, line 83: ‘device_class’ is an invalid option for ‘template’, check: device_class Invalid config for ‘template’ at templates.yaml, line 84: ‘scan_interval’ is an invalid option for ‘template’, check: scan_interval Invalid config for ‘template’ at templates.yaml, line 85: ‘force_update’ is an invalid option for ‘template’, check: force_update
- Invalid config for ‘template’ at templates.yaml, line 87: ‘platform’ is an invalid option for ‘template’, check: platform
- Invalid config for ‘template’ at templates.yaml, line 122: invalid template (TemplateSyntaxError: expected token ‘end of print statement’, got ‘HKZ681’) for dictionary value ‘sensors->plate_recognizer->value_template’, got “{{ state_attr(‘image_processing.platerecognizer_q3538_lve_0’, ‘watched_plates’).1HKZ681 }}”
- Invalid config for ‘template’ at templates.yaml, line 127: invalid template (TemplateSyntaxError: expected token ‘end of print statement’, got ‘EHS016’) for dictionary value ‘sensors->plate_recognizer->value_template’, got “{{ state_attr(‘image_processing.platerecognizer_q3538_lve_0’, ‘watched_plates’).2EHS016 }}”