Hi community,
I trust I am not the only one struggling with templating sometimes.
here is yet another case that I cannot figure out despite quite the internet research…
I want to update my sensor.yaml from the legacy format of templating sensors to new format.
OLD Format Example:
- platform: template
sensors:
outside_temp:
friendly_name: "Outside temperature"
unit_of_measurement: "°C"
value_template: "{{ state_attr('weather.myweather', 'temperature') }}"
outside_humidity:
friendly_name: "Outside humidity"
unit_of_measurement: "%"
value_template: "{{ state_attr('weather.myweather', 'humidity') }}"
I have updated according to the documentation of homeassistant to this:
- platform: template
sensors:
outside_temp:
friendly_name: "Outside temperature"
unit_of_measurement: "°C"
value_template: "{{ state_attr('weather.myweather', 'temperature') }}"
outside_humidity:
friendly_name: "Outside humidity"
unit_of_measurement: "%"
value_template: "{{ state_attr('weather.myweather', 'humidity') }}"
if I do I will get the below error:
Invalid config for [sensor]: required key not provided @ data[‘platform’]. Got None. (See /config/configuration.yaml, line 10).
I will most certainly continue to investigate myself, but maybe someone can boost this transformation.
happy sunday ya’ll!
Holger