Good afternoon,
I have been messing around with some copy and pasting in my yaml and well, things work. However, I feel that there is already some degree of mess in my file when looking at other config files and would like to bring more structure in it. Moreover, I do receive a notification saying
Invalid config for [template]: [platform] is an invalid option for [template]. Check: template->sensor->0->platform. (See /config/configuration.yaml, line 33).
I’ve tried to structure it the way I though it would be right but that took me way deeper in the rabbit hole. Can someone please give me guidance what the right structure would be to make the file more future proof for template sensors and binary sensor?
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
group: !include groups.yaml
template:
#Photovoltaik Sensoren für Energy Dashboard
- sensor:
- name: "Battery Power Charging"
unit_of_measurement: W
device_class: power
state: "{{ max(0, 0 - states('sensor.solarnet_power_battery') | float(default=0)) }}"
- name: "Battery Power Discharging"
unit_of_measurement: W
device_class: power
state: "{{ max(0, states('sensor.solarnet_power_battery') | float(default=0)) }}"
- name: "Power Photovoltaics"
unit_of_measurement: W
device_class: power
state: "{{ states('sensor.solarnet_power_photovoltaics') | float(default=0) }}"
- sensor:
- platform: integration
source: sensor.battery_power_charging
name: "Total Batterie geladen"
method: left
- platform: integration
source: sensor.battery_power_discharging
name: "Total Batterie entladen"
method: left
- platform: integration
source: sensor.power_photovoltaics
name: "Total Photovoltaik"
method: left
binary_sensor:
- platform: template
sensors:
someone_home:
friendly_name: Someone Home
icon_template: >-
{% if is_state('binary_sensor.someone_home','on') %}
mdi:home-account
{% else %}
mdi:home-outline
{% endif %}
value_template: "{{ is_state('person.2','home') or is_state('person.1','home') }}"
Thank you very much in advance!