sun
#
Description#
Plugin to get sunset/sunrise events and info for a certain location.
Configuration#
sun:
# [Required]
# Default latitude.
latitude: # type=float
# [Required]
# Default longitude.
longitude: # type=float
# [Optional]
# How often the `RunnablePlugin.loop <https://docs.platypush.tech/platypush/plugins/.html#platypush.plugins.RunnablePlugin.loop>`_ function should be
# executed (default: 15 seconds). *NOTE*: For back-compatibility
# reasons, the `poll_seconds` argument is also supported, but it's
# deprecated.
# poll_interval: 15 # type=Optional[float]
# [Optional]
# How long we should wait for any running
# threads/processes to stop before exiting (default: 5 seconds).
# stop_timeout: 5 # type=Optional[float]
# [Optional]
# If set to True then the plugin will not monitor
# for new events. This is useful if you want to run a plugin in
# stateless mode and only leverage its actions, without triggering any
# events. Defaults to False.
# disable_monitor: False # type=bool
Triggered events#
Actions#
Module reference#
- class platypush.plugins.sun.SunPlugin(latitude: float, longitude: float, **kwargs)[source]#
Bases:
RunnablePlugin
Plugin to get sunset/sunrise events and info for a certain location.
- __init__(latitude: float, longitude: float, **kwargs)[source]#
- Parameters:
latitude – Default latitude.
longitude – Default longitude.
- get_events(latitude: float | None = None, longitude: float | None = None) dict [source]#
Return the next sun events.
- Parameters:
latitude – Override the default latitude.
longitude – Override the default longitude.
- Returns:
{ "astronomical_twilight_begin": "Next astronomical twilight start time", "astronomical_twilight_end": "Next astronomical twilight end time", "civil_twilight_begin": "Next civil twilight start time", "civil_twilight_end": "Next civil twilight end time", "nautical_twilight_begin": "Next nautical twilight start time", "nautical_twilight_end": "Next nautical twilight end time", "solar_noon": "Next solar noon time", "sunrise": "Next sunrise time", "sunset": "Next sunset time" }
- start()#
Start the plugin.
- stop()#
Stop the plugin.
- wait_stop(timeout=None)#
Wait until a stop event is received.