Hi I'm trying to get at waste sensor state date from 2020-8-4 to: Tuesday 04 August 2020
This works in devoper tools template:
> *{{strptime(states("sensor.non_recyclable_waste_pickup"), '%Y-%m-%d').strftime('%A %d %B %Y')}}*
result: Tuesday 04 August 2020 :+1:
So that works and gives wanted result.
Then the I configured this:
*- platform: template*
* sensors:*
* grijzebak_waste:*
* friendly_name: 'Grijzebak'*
* value_template: " {{strptime(states("sensor.non_recyclable_waste_pickup"), '%Y-%m-%d').strftime('%A %d %B %Y')}}"*
This gives an error.
*Configuration invalidCHECK CONFIGURATION*
> *Error loading /config/configuration.yaml: while parsing a block mapping in "/config/sensor.yaml", line 12, column 7 expected <block end>, but found '<scalar>' in "/config/sensor.yaml", line 13, column 44*
Can anybody help me out?
Thanks
You have nested double quotes in your value_template
line.
value_template: "{{strptime(states("sensor.non_recyclable_waste_pickup"), '%Y-%m-%d').strftime('%A %d %B %Y')}}"
^ ^
Turn those into single quotes:
value_template: "{{strptime(states('sensor.non_recyclable_waste_pickup'), '%Y-%m-%d').strftime('%A %d %B %Y')}}"
Please format your posts properly .
Thanks Troon, That helped! You are great!
1 Like