How can I get sunrise/set for next day of week (say, next Monday), no matter which current DOW it is?

Is there a way to get the sunrise for, say, next Monday (no matter which day of the week it currently is)? Everything I am seeing is to get the next sunrise/sunset, not the next on a particular day of the week, or date, for that matter. I would like to post this for each Monday on lovelace, but have not been able to find any way to look ahead to sun rise/set on the next particular day of week.

If there isn’t a way to do it with the built in functions of HA there is this https://sunrise-sunset.org/api

3 Likes

If you wish to have the calculations or a spreadsheet you can go here:

https://gml.noaa.gov/grad/solcalc/calcdetails.html

1 Like

Thank you for the suggestion, @nickrout. However, I have no idea how to use the api to pull the relevant data into HomeAssist. Could someone point me in the right direction? I’ve no experience with that, and though I’ve read up on the indicated api, and understand how it works, I’m not sure hot to implement this within HomeAssist, and have completely failed at finding any relevant documentation. Thanks!

Oh man I thought I was clever enough finding the api. Now you want some example code. Damn.

How versatile do you need to be? Is it always for next Monday? Or should the code be more general?

LOL…sorry!
I’m probably fine with general understanding of how to integrate the API. Once I understand how that’s done, I should be able to take it from there. however, I will always be looking at a specific day (or days) of the week, and that algorithm I can figure out. So if it’s currently Tuesday, and I want to know for the next Saturday, I just add the appropriate # of days to get the date for Saturday and feed that to the API. Just don’t know how to interact with an API (that doesn’t have direct integration) from within HA. Does that make sense? I may not have been clear enough, but I want to have the result viewable on my Lovelace dashboard.

I think the best bet to get the data is with the restful integration RESTful - Home Assistant

If you want to be able to select a date in lovelace and then get the sunrise/set I would use a date/time helper that sets the date and triggers the rest sensors to update.

Or something like that!

1 Like

Thanks,

I was of the impression that the RESTful integration was only for inbound HA access. Didn’t know if was for reaching out to other systems as well. Thanks! I’ll look into that.