Home assistant next sunrise date format


Sun

The sun integrationIntegrations attach and integrate Home Assistant with your devices, services, and more. [Learn more] calculates all sun-related times (sunrise, sunset, dawn, dusk, etc.) based on your configured home location. This means that all time-based calculations and triggers will be accurate for your specific location, as defined in your basic configuration.

The sun integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] will utilize the location as configured in your Home Assistant configuration to track if the sun is above or below the horizon. The sun can be used within automations as a initiate with an optional offset to simulate dawn/dusk or as a condition with an optional offset to test if the daystar has already set or risen.

Configured by default

This integrationIntegrations link and integrate Home Assistant with your devices, services, and more. [Learn more] is by default configured and installed, and you don’t need to configure it yourself, unless you’ve disabled or removed the line from your YAML configuration.

If that is the case, you can configure it as described in the next paragraphs.

Confi

Date formatting

tomoqv (Tomas) 21

@petro
Much more elegant solution, thank you!

ssaavedra (Simón Saavedra) 22

Its works!!! Thanksss

ssaavedra (Simón Saavedra) 23

Wow luv it! Thanksss @petro

DavidFW1960 (David) 24

Where in config can I add the Next Sunrise and Next Sunset? Just not sure where to add in configuration.yaml…

Sunonline (Sun K) 25

Probably template sensor.

DavidFW1960 (David) 26

Yeah it was… I had a -H in there which Hassio hates. Also wanted to use AM and PM so it was pretty convoluted but I’m using this:

petro (Petro) 27

FYI, you can simplify this. In strfttime, characters that are between the ‘date idenfitiers’ are written as is.

In your use case you have the following string in strfttime:

‘(%I/%M%p)’

The characters that are ‘date identifiers’ are: %I for hour (12 hr format), %M for minute, and %p for AM/PM. This means all your characters between them can be changed without impacting your date format. So if you wanted you could have this as your date format for strftime:

‘The hour is %I, The Minute is %M, the AM/PM is %p’

the result would be:

The hour is 05, The Minute is 45, the AM/PM is AM

So in your case, you

Blog


Last time out, we got our TMS WEB Core app up and running, using the Miletus Framework. The basic layout of the app was created, and we sorted out the WebSocket API connection to the Home Assistant server. This time out, we're going to deal with the rest of the data returned by the Home Assistant server, resulting from the "get_states" and "subscribe_events" calls. We'll also wrap up the Configuration pages of our UI and add a bit more to the overall structure of our app in preparation for the posts that follow.

About Those Buttons.

Once we got connected to the Home Assistant server, we enabled the three buttons at the bottom of the Configuration page. But we never really covered what they were for. We'll get to all three in this post, but first, let's ease into things by having a look at the buttons themselves.



Configuration Buttons.

There's a little more going on there than just a standard button. Two icons. Different colors. Left-aligned multi-line text. And, in fact, icons from entirely different sources. The arrows come courtesy of Font Awesome. But for some reason, there isn't a Home Assistant icon in Font Awesome. Home Assistant itself uses primari

Automations: show time and date of next sheduled action

frankn66 (frankn66) 1

Hi,

I noticed that the Setting/Automations tab shows a column for when an automation was “last run”. It would be helpful to add a column that also shows when the automation is scheduled to trigger “next”. For example, this is very useful if you have a sprinkler automation that is dependant on a time or time related action like “sunrise”. The idea is that you can see in one single screen, the automation name, a column when the automation was “last” run and one column when the automation is scheduled to run “next”.

Can this be added to the HA UI? It would seem logical to add this by default in the UIl there is enough space available for one more column.

Thank you,

code-in-progress (Bill - I write code.) 2

This seems like it should be a feature request (and don’t forget to vote for your own feature request).

1 Like

Didgeridrew3

While “last run” is a known fact, “next run” is, at best, a guess… and only kind-of-feasible for a very limited number of time-related triggers. The vast majority of triggers are not strictly time-based, they are based on events that can occur at any time.


Date formatting

tomoqv (Tomas) 1

Hi,
I would like to display date and time like: May 10, 2017

Is there a simple way to do that?

Thanks,
Tomas

1 Like

rpitera (Robert Pitera) 2

This may help: http://strftime.org/ (Python strftime reference). It helped me to get proper formatting on things like this:

10 Likes

tomoqv (Tomas) 3

Thanks. I played with it a little, but haven’t been able to figure out the formatting mysteries yet. What I am after is a long date format such as “Feb 11, 2017” or “February 11, 2017”. I have tried %MMM %DD %YYYY, but I only get unknown as a result.

rendili4

Hi, have you tried:

%b %d, %Y
Or
%B %d, %Y

1 Like

tomoqv (Tomas) 5

I tried the following, but it generates errors as “unknown” or “none”:

What am I doing wrong?

happyleaves6

Use wherever you use .

ih8gates (Scott Reston) 7

Also - use the template dev tool. It’ll let you test templates without having to repeatedly restart.

tomoqv (Tomas) 8

Where do I find the templates dev tool?

Also, does anybody have a complete template example of this. I tried with the above, but it didn’t work.

ih8gates (Scott Reston) 9

Open left toolbar. Bottom row
home assistant next sunrise date format