Extract the time of sunset from sun attributes using Value Template Sensor

I did some reading and found that Hass.io doesn’t like the timestamp_local("%-I:%M %p") but how can I build a sensor that outputs the sunset time to use with automations?

When I remove the timestamp_local("%-I:%M %p") I get an output of 10 digits with .0 at the end right now it’s showing: 1518398670.0

        value_template: '{{ as_timestamp(states.sun.sun.attributes.next_dusk)}}'

My old value template using AIO that used to work fine looked like this:

        value_template: '{{ as_timestamp(states.sun.sun.attributes.next_dusk)'  | timestamp_local("%-I:%M %p") }}'
1 Like