This seems to be two errors, one in HA and one in the astral library:
I live above the arctic circle and some parts of the year the sun is always above the horizon and other parts it is always above.
Right now it is above horizon all day, but I get this stack trace in HA:
16-05-16 15:41:28 homeassistant.bootstrap: Error during setup of component sun
Traceback (most recent call last):
File "/home/vidar/.homeassistant/deps/astral.py", line 1464, in sunrise_utc
return self._calc_time(90 + 0.833, SUN_RISING, date, latitude, longitude)
File "/home/vidar/.homeassistant/deps/astral.py", line 2120, in _calc_time
hourangle = self._hour_angle(latitude, solarDec, depression)
File "/home/vidar/.homeassistant/deps/astral.py", line 2093, in _hour_angle
HA = acos(h)
ValueError: math domain error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/bootstrap.py", line 157, in _setup_component
if not component.setup(hass, config):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/sun.py", line 118, in setup
sun.point_in_time_listener(dt_util.utcnow())
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/sun.py", line 194, in point_in_time_listener
self.update_as_of(now)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/sun.py", line 176, in update_as_of
utc_point_in_time + timedelta(days=mod), local=False)
File "/home/vidar/.homeassistant/deps/astral.py", line 769, in sunrise
sunrise = self.astral.sunrise_utc(date, self.latitude, self.longitude)
File "/home/vidar/.homeassistant/deps/astral.py", line 1466, in sunrise_utc
raise AstralError(('Sun remains below the horizon on this day, '
astral.AstralError: Sun remains below the horizon on this day, at this location.
Problem 1: HA should maybe handle this better?
Probem 2: The error says "Sun remains BELOW the horizon", but it is above.
While running this also triggers:
ERROR:homeassistant.core:BusHandler:Exception doing job
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 801, in job_handler
func(arg)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/event.py", line 179, in pattern_time_change_listener
action(now)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/sun.py", line 204, in timer_update
self.update_ha_state()
File "/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity.py", line 147, in update_ha_state
state = STATE_UNKNOWN if self.state is None else str(self.state)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/sun.py", line 143, in state
if self.next_rising > self.next_setting:
TypeError: unorderable types: NoneType() > NoneType()
Ha, that's funny. Never tested it without the sun setting. I wonder what else is broken
Lat 69.6 and long 18.8 ought to make it reproducible. Or we wold have to crowdfund a developer to travel up here ;)
I've actually been there, actually a bit more north, at the Nordkapp. Even am a member of the Royal Nordkapp Club 👍
It no longer crashes, but it now says "below horizon" while in fact it is above. Seems you have something inverted (will be always above in June/July, and always below during December/January)
What are your next rising and setting values in the more info dialog for the sun?
Rising in 2 months
1:33 AM
Setting in 2 months
12:09 AM
Elevation
29.26
So it might be waiting for a "rise" event? It clearly knows it's above since elevation is 30 deg.
Could you look the sun up in the state machine and get the exact dates?
On Wed, Jun 8, 2016, 08:14 Vidar Tyldum [email protected] wrote:
Rising in 2 months
1:33 AM
Setting in 2 months
12:09 AM
Elevation
29.26So it might be waiting for a "rise" event? It clearly knows it's above
since elevation is 30 deg.—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/home-assistant/home-assistant/issues/2090#issuecomment-224621672,
or mute the thread
https://github.com/notifications/unsubscribe/ABYJ2iFTbghtoqRJ-XDfcr3OOE6GMwCRks5qJtxagaJpZM4IfVh0
.
{
"elevation": 24.01,
"friendly_name": "Sun",
"next_rising": "2016-07-25T23:33:35+00:00",
"next_setting": "2016-07-26T22:09:19+00:00",
"azimuth": 271.5
}
Does the next rising and setting dates match your location? Because the
next setting is AFTER the next rising which is what is causing Home
Assistant to think that the sun is below the horizon.
On Wed, Jun 8, 2016 at 9:16 AM, Vidar Tyldum [email protected]
wrote:
{
"elevation": 24.01,
"friendly_name": "Sun",
"next_rising": "2016-07-25T23:33:35+00:00",
"next_setting": "2016-07-26T22:09:19+00:00",
"azimuth": 271.5
}—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/home-assistant/home-assistant/issues/2090#issuecomment-224643866,
or mute the thread
https://github.com/notifications/unsubscribe/ABYJ2o6z6Bt8xKCQk-75FXGSm8Uo40D9ks5qJur7gaJpZM4IfVh0
.
PaulusSchoutsen.nl
It's nice to be important but it's more important to be nice.
They are correct enough. My comparison calculation says sunset 0030 and rise 0130 on the 25th.
The date and times will usually differ from different calculations as it depends if you take atmospheric refraction into account or not, and also if your definition of sun set is "completely below" or "center below".
The problem might be that the first time the sun goes below and up again is on the same day, not crossing midnight. I guess that is because of daylight savings... If I remove daylight savings from the other calculation it turns into 2330 and 0030.
On mobile, used app sun surveyor for calculations.
On Jun 9, 2016 01:47, Paulus Schoutsen [email protected] wrote:Does the next rising and setting dates match your location? Because the
next setting is AFTER the next rising which is what is causing Home
Assistant to think that the sun is below the horizon.
On Wed, Jun 8, 2016 at 9:16 AM, Vidar Tyldum [email protected]
wrote:
{
"elevation": 24.01,
"friendly_name": "Sun",
"next_rising": "2016-07-25T23:33:35+00:00",
"next_setting": "2016-07-26T22:09:19+00:00",
"azimuth": 271.5
}—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/home-assistant/home-assistant/issues/2090#issuecomment-224643866,
or mute the thread
https://github.com/notifications/unsubscribe/ABYJ2o6z6Bt8xKCQk-75FXGSm8Uo40D9ks5qJur7gaJpZM4IfVh0
.
PaulusSchoutsen.nl
It's nice to be important but it's more important to be nice.
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread.
Most helpful comment
I've actually been there, actually a bit more north, at the Nordkapp. Even am a member of the Royal Nordkapp Club 👍