Hours of Daylight

Today I have for my lat/lon

Your sun.sun - 26.36
suncalc.org - 26.18

Thanks. But itā€™s not the values themselves so much as if max_elevation changes only at midnight and agrees with the actual max value of elevation throughout that day, especially at the time indicated by next_noon. (Note I mean the value of next_noon before that time, because like the other next_xxx attributes, they change at the time they indicate.)

The fact that this doesnā€™t match a value provided by another source isnā€™t surprising. HAā€™s sun component (which, of course, my custom version is based on), uses astral from PyPI.

Yes, I most certainly wasnā€™t ā€˜complainingā€™ in any way that the values donā€™t match.

I hadnā€™t realised this was useful information for you thoughā€¦

Iā€™ll try to have a look in the next few days but it wonā€™t be tomorrow as I wonā€™t be around at noon.

Ok, so I was here at noon at it looks spot onā€¦

Here are my sun.sun attributes today at 12:15

2 Likes

@klogg

Version with new max_elevation option now released as 1.1.0.

1 Like

Custom Updater only shows version 1.0 - did you update the version json yet?

Yes, I did. You probably need to run the custom_updater.check_all service manually to see it, because I think that only runs automatically at startup, then once a day after that.

Yeah I think the card takes up yo an hour to show it and I realise now 2 minutes is not an hour lol/ I only just got a bunch of updates so Iā€™m sure sun will show soon.

He also made a change in the way it works I think. Something about some process that updates his own json file once an hour from individual json files rather than having the component use the individual json files directly as it used to. Honestly, Iā€™m not sure I like the change, and I havenā€™t updated custom_updater myself in quite a while. In fact, Iā€™m thinking of removing it from my system because the only custom components Iā€™m using are my own and the only reason I installed custom_updater in the first place was to make sure it worked with my custom components. :slight_smile:

Just got it now. New updater works greatā€¦

1 Like

Hi, I am trying to set up the enhanced sun component on 0.88 but get the following error. Is this something I am doing wrong? sun.py is in config/custom_components/sun.py
Cheers,
James

Log Details (ERROR)

Sat Feb 23 2019 09:06:43 GMT+0000 (Greenwich Mean Time)

Error loading custom_components.sun.automation. Make sure all dependencies are installed

Traceback (most recent call last): File ā€œ/usr/src/app/homeassistant/loader.pyā€, line 147, in _load_file module = importlib.import_module(path) File ā€œ/usr/local/lib/python3.7/importlib/init.pyā€, line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File ā€œ<frozen importlib._bootstrap>ā€, line 1006, in _gcd_import File ā€œ<frozen importlib._bootstrap>ā€, line 983, in _find_and_load File ā€œ<frozen importlib._bootstrap>ā€, line 962, in _find_and_load_unlocked ModuleNotFoundError: No module named ā€˜custom_components.sun.automationā€™; ā€˜custom_components.sunā€™ is not a package

Do you still get the error after you restart?

See this post for more discussion on this topic.

Yes even after a restart. I was not getting all the monitored attributes either just the standard sun component ones. Actually, I just saw the linked thread and tried someoneā€™s suggestion to create init.py & after a restart the monitored attributes finally showed up, but the error still exists.

Interesting. I did not experience that on the 0.89 dev branch. But apparently I didnā€™t test enough. :frowning: The automation was getting turned off. When I tried to turn it back on I saw the errors again.

You could try the following if youā€™d like. (I tried this on my dev checkout and it seems to work. Of course, I thought it was working before, too.) You may have to adjust depending on how you installed HA. If you do, let me know how it goes. BTW, this assumes my sun.py is now located in custom_components/sun/__init__.py.

cd custom_components
sudo -u homeassistant ln -s /srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/automation/sun.py sun/automation.py

Hi, this has been very useful for me. However i am now after the time minus next sunrise and sunset. i.e. how many hours:minutes are remaining till next one. has anyone tried that please?

Sorry, itā€™s not quite clear what youā€™re asking. Can you try asking a different way maybe?

Hello how did you get those ā€˜sunriseā€™ and ā€˜sunsetā€™ values?

Iā€™ve installed the custom sun component on this page and it does not appear for me:

If there is a way of getting todays sunrise and sunset, not the next one, that would be what Iā€™m after.

There are setup options you need to configureā€¦ did you follow the instructions?

2 Likes

Thanks, that was it. My config was still using the old sun settings, after a Git Pull and a reboot itā€™s all working as intended. :slight_smile:

Thanks pnbruckner for this enhancement, really handy to be able to use todays sunrise and sunset for solar stats

I am curious on what you came up with the WU API since I have had mine for years now. What type of sensors did you come up with?