Page 1 of 1

SunMoon plugin raises AlwaysUpError since two days

Posted: Tuesday 18 May 2021 7:08
by Stratos
I'm using Xorfor's Domoticz-SunMoon-Plugin for several month now witout any problems.
SunMoon and pyephem are the actual versions.

Since two days the log is flooded with error messages every minute:

2021-05-18 06:01:07.515 Error: (SunMoon) 'onHeartbeat' failed 'AlwaysUpError'.
2021-05-18 06:01:07.515 Error: (SunMoon) ----> Line 687 in '/home/pi/domoticz/plugins/Domoticz-SunMoon-Plugin/plugin.py', function onHeartbeat
2021-05-18 06:01:07.515 Error: (SunMoon) ----> Line 427 in '/home/pi/domoticz/plugins/Domoticz-SunMoon-Plugin/plugin.py', function onHeartbeat
2021-05-18 06:01:07.515 Error: (SunMoon) ----> Line 497 in '/usr/local/lib/python3.7/dist-packages/ephem/__init__.py', function next_rising
2021-05-18 06:01:07.515 Error: (SunMoon) ----> Line 482 in '/usr/local/lib/python3.7/dist-packages/ephem/__init__.py', function _riset_helper
2021-05-18 06:01:07.515 Error: (SunMoon) ----> Line 422 in '/usr/local/lib/python3.7/dist-packages/ephem/__init__.py', function visit_antitransit

I have no clue what is the reason of it.
Think that is location related and depends on sun or moon transitions.
Also there is one hint from the Domoticz system with this message: "There is no astronomical twilight in the space of 24 hours"

Is anyone encountering the same and maybe has a solution?
Happens on two systems, V4.11724 and 2021.1

Re: SunMoon plugin raises AlwaysUpError since two days

Posted: Tuesday 18 May 2021 14:34
by waltervl
What have you done so far to try to fix it?
Reboot? Restart of plugin, reset your location?
What is your location so we can test too if we get the no astronomical twilight message...

Re: SunMoon plugin raises AlwaysUpError since two days

Posted: Tuesday 18 May 2021 15:39
by Stratos
Hi,
i have restarted domoticz , rebooted the two systems.
I have reentered my location in the settings tab, slightly changed the location to be sure that it is saved.
My location is 52.2445 / 13.2357 (location before was 52.4125 / 13.3996 , also tested lon +-2.0 and lat +-2.0)
As far as i can see the generated values from the plugin are still updated at change.

Also i'm not really sure if the error 'AlwaysUpError' is coming from ephem or sunmoon plugin.

I'm no astronomical guy so i can not really interpret the message and why it is running since month , starting
spamming the error messages two days ago.
Maybe the astronomical constellation is a special one in year.
Maybe it is in conjuntion with domoticz message "There is no astronomical twilight in the space of 24 hours"
I cannot say if i have seen this before.

Re: SunMoon plugin raises AlwaysUpError since two days

Posted: Tuesday 18 May 2021 16:32
by FireWizard
Hi @Stratos

You wrote:
I have no clue what is the reason of it.
Think that is location related and depends on sun or moon transitions.
Also there is one hint from the Domoticz system with this message: "There is no astronomical twilight in the space of 24 hours"
The astronomical twilight is the time between the moment that the center of the sun is between 18 degrees below the horizon and the horizon.
It happens two times a day. The morning period is also called dawn and the evening period is also called dusk.

However from certain latitude degrees north (on the northern hemisphere) there are days that the sun will not pass 18 degrees below the horizon.
(On the Arctic circle the sun will touch the horizon on June 21/22) Today it happens at approx 70 degrees North.

So if some of your programs has the wrong latitude, you might get that message, because in that case the sun will never touch the 18 degrees below horizon, within a 24 h window.

So check you co-ordinates and in particular the latitude.

Regards

Re: SunMoon plugin raises AlwaysUpError since two days

Posted: Tuesday 18 May 2021 16:42
by waltervl
When I tried your location and restart the system I get so no missing twilight message. see below

Code: Select all

2021-05-18 16:37:03.760 Sunrise: 05:07:00 SunSet: 21:00:00
2021-05-18 16:37:03.760 Day length: 15:53:00 Sun at south: 13:04:00
2021-05-18 16:37:03.760 Civil twilight start: 04:24:00 Civil twilight end: 21:43:00
2021-05-18 16:37:03.760 Nautical twilight start: 03:22:00 Nautical twilight end: 22:45:00
2021-05-18 16:37:03.760 Astronomical twilight start: 01:21:00 Astronomical twilight end: 00:46:00 

Re: SunMoon plugin raises AlwaysUpError since two days

Posted: Tuesday 18 May 2021 17:31
by waaren
Stratos wrote: Tuesday 18 May 2021 7:08 Is anyone encountering the same and maybe has a solution?
I tested this plugin with your lon/lat settings on build 13266 and do not see these errors. Have you tried updating to the latest version of ephem

Code: Select all

sudo pip3 uninstall ephem
sudo pip3 install ephem
and to the most recent version of the plugin

Code: Select all

cd <domoticz dir>/plugins/Domoticz-SunMoon-Plugin
sudo git pull
You could also activate debug for this plugin on the hardware tab

Re: SunMoon plugin raises AlwaysUpError since two days

Posted: Tuesday 18 May 2021 17:59
by Stratos
Hi FireWizard,

thank you for explaining, learned a bit more about it now.

Hi walterlv,
i can confirm that i get also no missing twilight message by entering the coordinates i wrote in text.
(The SunMoon plugin errors remains)

I first see the message before i changed the coordinates for testing.
If i get the coordinates by "find your location" in settings page
i get 52.41241 / 13.39977 (so one decimal digit more) which results in

Code: Select all

2021-05-18 17:13:22.164 Sunrise: 05:06:00 SunSet: 21:00:00
2021-05-18 17:13:22.164 Day length: 15:55:00 Sun at south: 13:03:00
2021-05-18 17:13:22.164 Civil twilight start: 04:22:00 Civil twilight end: 21:44:00
2021-05-18 17:13:22.164 Nautical twilight start: 03:20:00 Nautical twilight end: 22:46:00
2021-05-18 17:13:22.164 There is no astronomical twilight in the space of 24 hours 
So maybe it is a glitch because the other times are nearly the same. (happens in both V4.11724 and 2021.1)

Because of the remaining errors in SunMoon plugin (or ephem) i have to evaluate if this is a similiar effect and i have entered the location with 5 decimals.

Any other hint where can it come from?

thank you for the effort

Re: SunMoon plugin raises AlwaysUpError since two days

Posted: Tuesday 18 May 2021 19:44
by waltervl
Did you try to update ephem library as @waaren suggested?

Re: SunMoon plugin raises AlwaysUpError since two days

Posted: Tuesday 18 May 2021 22:21
by Xorfor
I am not really maintaining this plugin anymore, but I saw this post and it was easy for me to make this plugin more stable. Please get the latest version and you don't get the error any more and "No time available" will be shown, if a twiligth zone can not be calculated.

If you have any problems with one of my plugins, please submit an issue on Github for that plugin, and I will see what I can do for you. No garantee!!!

Re: SunMoon plugin raises AlwaysUpError since two days

Posted: Wednesday 19 May 2021 8:02
by Stratos
waaren wrote: Tuesday 18 May 2021 17:31
Stratos wrote: Tuesday 18 May 2021 7:08 Is anyone encountering the same and maybe has a solution?
I tested this plugin with your lon/lat settings on build 13266 and do not see these errors. Have you tried updating to the latest version of ephem

Code: Select all

sudo pip3 uninstall ephem
sudo pip3 install ephem
and to the most recent version of the plugin

Code: Select all

cd <domoticz dir>/plugins/Domoticz-SunMoon-Plugin
sudo git pull
You could also activate debug for this plugin on the hardware tab
Hi waaren,
done both updates, (was actual) nothing changed, sunmoon error remains. (before Xorfor updated it)
After Xorfor reply and update the SunMoon Error ist gone.
Thank you for your effort.
waltervl wrote: Tuesday 18 May 2021 19:44 Did you try to update ephem library as @waaren suggested?
Hi waltervl,
yes, done it, result see above.
Thank you.
Xorfor wrote: Tuesday 18 May 2021 22:21 I am not really maintaining this plugin anymore, but I saw this post and it was easy for me to make this plugin more stable. Please get the latest version and you don't get the error any more and "No time available" will be shown, if a twiligth zone can not be calculated.

If you have any problems with one of my plugins, please submit an issue on Github for that plugin, and I will see what I can do for you. No garantee!!!
Hi Xorfor,
after updating the changed version, the error messages are gone.
Thank you for your effort.