Using sun.sun attributes not state

Hey all,

New to Home assistant, i am trying to code up and basic panel that shows some things going on from day to day, like time date sun rise and sun set.

My question is when i use “platform: template” is it only able to be used under sensor: or can i use it directly in groups.yaml?

was trying to do something like below in my groups.yaml files, but i cant get it to work.

almanac:
    name: Almanac
    view: no
    entities:
        - sensor.date_now
        - sensor.time_now
        - sensor.yr_symbol
        - platform: template
            sensors:
                next_sunrise:
                    friendly_name: "next sunrise"
                    value_template: "{{ as_timestamp(states.sun.sun.attributes.next_rising) |timestamp_custom('%I:%M %p') }}"
1 Like

This will not work, you need a template sensor for it.

This should give you the idea:

1 Like

Ok, thanks, guys i just was seeing if there was a way i didn’t have to write it to a sensor first.

1 Like