mirror of
https://github.com/openwrt/packages.git
synced 2025-01-31 00:12:09 +00:00
9f507623e1
Sunwait calculates sunrise or sunset times with civil, nautical, astronomical and custom twilights. It is intended for use in home automation with Windows Task Scheduler or cron. Use it to turn lights on before it gets dark! The program can wait from invocation until the event specified on the command line occurs or it can return immediately indicating if it is day or night. It's best to schedule Sunwait to run a little before the earliest opportunity for the event to occur each year - ie dusk range is 3:30pm to 10:30pm here, so it reasonable to schedule a dusk task at 3pm and allow Sunwait to pause the task for between 30mins and 7 and a half hours. If you scheduled the task for 6pm, then your lights will come on no earlier than 6pm. The sun's position is calculated using time, and position - latitude and longitude should be specified on the command line. Features: Calculates sunrise and sunset for given coordinates Can wait for sunrise/sunset, or return DAY or NIGHT codes Works with Windows Task Scheduler (or cron) Supports custom twilight angles Used to automate domestic lighting with Arduino transmitter and radio controlled sockets Signed-off-by: Stan Grishin <stangri@melmac.ca>
50 lines
1.5 KiB
Makefile
50 lines
1.5 KiB
Makefile
# Copyright 2024 MOSSDeF, Stan Grishin (stangri@melmac.ca).
|
|
# This is free software, licensed under the GPL-3.0 License.
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
PKG_NAME:=sunwait
|
|
PKG_VERSION:=0.9.1
|
|
PKG_RELEASE:=1
|
|
|
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
|
PKG_SOURCE_URL:=https://codeload.github.com/risacher/sunwait/tar.gz/$(PKG_VERSION)?
|
|
PKG_HASH:=02fe8165a60ede67f1d0dc98acf4dfbe40865a215d9bd039f57806f1e100b406
|
|
|
|
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
|
|
PKG_LICENSE:=GPL-3.0
|
|
PKG_LICENSE_FILES:=LICENSE
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
define Package/sunwait
|
|
SUBMENU:=Utilities
|
|
CATEGORY:=Utilities
|
|
SECTION:=util
|
|
TITLE:=Sunwait
|
|
URL:=https://github.com/risacher/sunwait
|
|
DEPENDS:=+libc
|
|
endef
|
|
|
|
define Package/sunwait/description
|
|
Calculate sunrise and sunset, as well as civil, nautical, and astronomical twilights.
|
|
Has features that make it useful for home automation tasks.
|
|
endef
|
|
|
|
define Build/Compile
|
|
$(TARGET_CC) $(TARGET_CPPFLAGS) -o $(PKG_BUILD_DIR)/sunwait.o -c $(PKG_BUILD_DIR)/sunwait.c
|
|
$(TARGET_CC) $(TARGET_CPPFLAGS) -o $(PKG_BUILD_DIR)/sunriset.o -c $(PKG_BUILD_DIR)/sunriset.c
|
|
$(TARGET_CC) $(TARGET_CPPFLAGS) -o $(PKG_BUILD_DIR)/print.o -c $(PKG_BUILD_DIR)/print.c
|
|
$(TARGET_CC) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/$1 $(PKG_BUILD_DIR)/sunwait.o $(PKG_BUILD_DIR)/sunriset.o $(PKG_BUILD_DIR)/print.o -lm
|
|
endef
|
|
|
|
define Build/Configure
|
|
endef
|
|
|
|
define Package/sunwait/install
|
|
$(INSTALL_DIR) $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/sunwait $(1)/usr/bin/sunwait
|
|
endef
|
|
|
|
$(eval $(call BuildPackage,sunwait))
|