Page 1 of 1

python plugin: sunset/sunrise times

Posted: Monday 29 May 2017 19:05
by elgringo
Is it possible to get sunrise/sunset times from Domoticz within a python plugin?

Or the user variables?

Re: python plugin: sunset/sunrise times

Posted: Wednesday 31 May 2017 7:16
by elgringo
I hope there are some better option to implment it by my own. There are examples how to do it:
http://thorpesoftware.com/calculating-s ... nd-sunset/
https://www.raspberrypi.org/forums/view ... 2&t=114745

It's like reinventing hte wheel :shock:

Re: python plugin: sunset/sunrise times

Posted: Wednesday 31 May 2017 11:28
by Hesmink

Re: python plugin: sunset/sunrise times

Posted: Wednesday 31 May 2017 11:45
by elgringo
Yes its possible, I thought of it. But is doesn't make sense to call the domoticz API from a plugin.
I assume it is available within the plugin context since all settings also can be retrieved.

Re: python plugin: sunset/sunrise times

Posted: Wednesday 12 April 2023 17:09
by sincze
elgringo wrote: Wednesday 31 May 2017 11:45
Yes its possible, I thought of it. But is doesn't make sense to call the domoticz API from a plugin.
I assume it is available within the plugin context since all settings also can be retrieved.
Did anyone find a solution for this so to obtain sunrise and sunset from within a plugin ?

I found something like this.

Code: Select all

cmd = '/json.htm?type=command&param=getSunRiseSet'
        dJson = self.request(self.url(cmd))
        Domoticz.Debug("result:" + str(dJson))
And I must agree, it feels a bit strange to need to go external to obtain these values ;-) but then again if that is as designed.... it is what it is..