Hi all,
I’m new to HA, trying to implement some basic custom stuff I’d done successfully in OpenHAB.
First task is to create “template sensor” which “allows creating entities which derive their values from other data”, so I am following this basic example in the Template docs
I created config/sensors.yaml and and am including it.
But when I Check Configuration in Developer Tools > YAML, I keep getting this error:
Invalid config for [sensor]: required key not provided @ data[‘platform’]. Got None. (See /config/configuration.yaml, line 11).
But any examples I can find that include platform
(platform: template
) seem to be legacy syntax we should avoid… right?
So why doesn’t the “correct” “modern” syntax validate? Do I ignore the docs and use platform
?
Versions:
Home Assistant 2023.5.4
Supervisor 2023.04.1
Operating System 10.2
Frontend 20230503.3 - latest
(on Raspberry Pi 3 32-bit)
Here’s my exact variation of the example YAML:
template:
- sensor:
- name: "Temp Diff Outdoors Cooler"
unit_of_measurement: "°F"
state: >
{% set int = states('sensor.office_temperature') | float %}
{% set ext = states('weather.forecast_home.temperature') | float %}
{{ (int - ext) | round(1, default=0)}}
Oh, I’m editing in vim
via ssh; this does not involve VS Code.
Thanks for any tips!