python plugin: sunset/sunrise times

Python and python framework

Moderator: leecollings

Post Reply
elgringo
Posts: 96
Joined: Thursday 18 May 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Left
Contact:

python plugin: sunset/sunrise times

Post by elgringo »

Is it possible to get sunrise/sunset times from Domoticz within a python plugin?

Or the user variables?
elgringo
Posts: 96
Joined: Thursday 18 May 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Left
Contact:

Re: python plugin: sunset/sunrise times

Post 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:
Hesmink
Posts: 168
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: python plugin: sunset/sunrise times

Post by Hesmink »

elgringo
Posts: 96
Joined: Thursday 18 May 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Left
Contact:

Re: python plugin: sunset/sunrise times

Post 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.
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: python plugin: sunset/sunrise times

Post 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..
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest