Scraper Sensor combine with Template Sensor

Hi lolouk44

I have tried your solution. I am sorry, it doesnt work. Same result like before.
I have tested:

  • your code
  • deleted everything in the configuration.yaml file except this 4 test sensors
  • i have installed the sqlite plugin to read the database: the state value is “Open” or “Closed”. No spaces.
  • And it is always the same. It works in the template editor, but not in real.

An interesting hint: If I add this simple binary_sensor, I have the same problem. Correct value in the template editor, but always the value “off” in real.

binary_sensor:
  - platform: template
    sensors:
      sun_up:
        friendly_name: "Sun is up"
        value_template: "{{ states.sun.sun.attributes.elevation}}"

So it looks that something with my template engine is not working. But only with the binary_sensors. For the entity “sensor” the templates work.

A basic question, what is correct?

binary_sensor:
  - platform: template
    sensors:
      sun_up1:
        value_template: "{{ states.sun.sun.attributes.elevation}}"
      sun_up2:
        value_template: "{{ states.sun.sun.attributes.elevation}}"
      sun_up3:
        value_template: "{{ states.sun.sun.attributes.elevation}}"

or

binary_sensor:
  - platform: template
    sensors:
      sun_up1:
        value_template: "{{ states.sun.sun.attributes.elevation}}"
  - platform: template
    sensors:
      sun_up2:
        value_template: "{{ states.sun.sun.attributes.elevation}}"
  - platform: template
    sensors:
      sun_up3:
        value_template: "{{ states.sun.sun.attributes.elevation}}"