From 4b5b41e356923224d9d7281417ee463b804ae462 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 17 Nov 2025 13:41:06 +0000 Subject: [PATCH] domoticz: improve config, don't require telldus Add support for configuring the -vhostname, as it helps to get the right issuer into OAuth2 tokens. Also disable the mdns responder by default; when we're running on OpenWrt we have better options that that. Clean up the logging options, and also make it export $TZ to work around our musl hack which otherwise opens and reads /etc/TZ thousands of times a minute. Also drop the telldus dependency. Domoticz will dlopen that at runtime without having to have it present at build time at all, so it should still work for users who install it. Signed-off-by: David Woodhouse --- utils/domoticz/Makefile | 6 +-- utils/domoticz/files/domoticz.config | 9 +++- utils/domoticz/files/domoticz.init | 14 ++++++- .../001-domoticz-2025.2-no-telldus.patch | 41 +++++++++++++++++++ 4 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 utils/domoticz/patches/001-domoticz-2025.2-no-telldus.patch diff --git a/utils/domoticz/Makefile b/utils/domoticz/Makefile index 264c097ce1..d275f2dc7d 100644 --- a/utils/domoticz/Makefile +++ b/utils/domoticz/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=domoticz PKG_VERSION:=2025.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/domoticz/domoticz/tar.gz/$(PKG_VERSION)? @@ -47,7 +47,6 @@ define Package/domoticz +libopenzwave \ +libsqlite3 \ +libstdcpp \ - +telldus-core \ +zlib endef @@ -72,7 +71,8 @@ CMAKE_OPTIONS += \ -DUSE_STATIC_OPENZWAVE=no \ -DUSE_OPENSSL_STATIC=no \ -DUSE_PYTHON=yes \ - -DWITH_LIBUSB=no + -DWITH_LIBUSB=no \ + -DWITH_TELLDUSCORE=no TARGET_CXXFLAGS += -DWITH_GPIO diff --git a/utils/domoticz/files/domoticz.config b/utils/domoticz/files/domoticz.config index 870701c050..51bdfd5dc4 100644 --- a/utils/domoticz/files/domoticz.config +++ b/utils/domoticz/files/domoticz.config @@ -1,11 +1,18 @@ config domoticz option disabled '1' - option loglevel '1' + # (combination of: all,normal,status,error,debug) + option loglevel 'normal' + # (combination of: all,normal,hardware,received,webserver,eventsystem,python,thread_id,sql,auth) + option debuglevel 'normal' + # [user|daemon|local0 .. local7] option syslog 'daemon' + # You can point it at ACME certs directly and it reloads automatically when they change. # option sslcert '/path/to/ssl.crt' # option sslkey '/path/to/ssl.key' # option sslpass 'passphrase' # option ssldhparam '/path/to/dhparam.pem' + # option mdns '0' + # option www '8080' option sslwww '0' # CAUTION - by default, /var is not persistent accross reboots # Don't forget the trailing / - domoticz requires it diff --git a/utils/domoticz/files/domoticz.init b/utils/domoticz/files/domoticz.init index 0cf563170d..eb61bb2d2a 100644 --- a/utils/domoticz/files/domoticz.init +++ b/utils/domoticz/files/domoticz.init @@ -7,18 +7,22 @@ PIDFILE=/var/run/domoticz.pid start_domoticz() { local section="$1" - local disabled loglevel sslcert sslpass sslwww syslog userdata + local disabled loglevel debuglevel mdns sslcert sslpass sslwww www syslog vhostname userdata config_get_bool disabled "$section" "disabled" 0 [ "$disabled" -gt 0 ] && return config_get loglevel "$section" "loglevel" + config_get debuglevel "$section" "debuglevel" + config_get_bool mdns "$section" "mdns" 0 config_get sslcert "$section" "sslcert" config_get sslkey "$section" "sslkey" config_get sslpass "$section" "sslpass" config_get ssldhparam "$section" "ssldhparam" config_get sslwww "$section" "sslwww" + config_get www "$section" "www" config_get syslog "$section" "syslog" + config_get vhostname "$section" "vhostname" config_get userdata "$section" "userdata" userdata /var/lib/domoticz procd_open_instance @@ -26,8 +30,12 @@ start_domoticz() { procd_append_param command -noupdates procd_append_param command -approot /usr/share/domoticz/ + [ "$mdns" -eq 0 ] && procd_append_param command "-nomdns" [ -n "$loglevel" ] && procd_append_param command -loglevel "$loglevel" + [ -n "$debuglevel" ] && procd_append_param command -debuglevel "$debuglevel" [ -n "$syslog" ] && procd_append_param command -syslog "$syslog" + [ -n "$vhostname" ] && procd_append_param command -vhostname "$vhostname" + [ -n "$www" ] && procd_append_param command -www "$www" [ -d "${userdata}" ] || { mkdir -p "${userdata}" @@ -56,6 +64,10 @@ start_domoticz() { [ -n "$ssldhparam" ] && procd_append_param command -ssldhparam "$ssldhparam" } || procd_append_param command -sslwww 0 + # OpenWrt musl has a hack to read /etc/TZ every time if $TZ isn't set. + # Work around it by setting $TZ + [ -r "/etc/TZ" ] && procd_append_param env TZ="$(cat /etc/TZ)" + procd_set_param pidfile "$PIDFILE" procd_set_param respawn procd_set_param stdout 0 diff --git a/utils/domoticz/patches/001-domoticz-2025.2-no-telldus.patch b/utils/domoticz/patches/001-domoticz-2025.2-no-telldus.patch new file mode 100644 index 0000000000..8b8599047b --- /dev/null +++ b/utils/domoticz/patches/001-domoticz-2025.2-no-telldus.patch @@ -0,0 +1,41 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -32,6 +32,7 @@ option(USE_PYTHON "Use Python for Plugin + option(INCLUDE_LINUX_I2C "Include I2C support" YES) + option(INCLUDE_SPI "Include SPI support" YES) + option(WITH_LIBUSB "Enable libusb support" YES) ++option(WITH_TELLDUSCORE "Enable Telldus support" YES) + + # Link static or shared, external dependencies + option(USE_LUA_STATIC "Link LUA static" YES) +@@ -783,17 +784,19 @@ ELSE() + message(STATUS "GPIO is not available") + ENDIF() + +-find_path(TELLDUSCORE_INCLUDE NAMES telldus-core.h) +-IF(TELLDUSCORE_INCLUDE) +- message(STATUS "Found telldus-core (telldus-core.h) at : ${TELLDUSCORE_INCLUDE}") +- find_library(TELLDUS_LIBRARIES NAMES libtelldus-core.so) +- IF(TELLDUS_LIBRARIES) +- message(STATUS "Found libtelldus-core at : ${TELLDUS_LIBRARIES}, adding telldus support") +- add_definitions(-DWITH_TELLDUSCORE) +- ENDIF(TELLDUS_LIBRARIES) +-ELSE() +- message(STATUS "Not found telldus-core (telldus-core.h), not adding tellstick support") +-ENDIF(TELLDUSCORE_INCLUDE) ++IF(WITH_TELLDUSCORE) ++ find_path(TELLDUSCORE_INCLUDE NAMES telldus-core.h) ++ IF(TELLDUSCORE_INCLUDE) ++ message(STATUS "Found telldus-core (telldus-core.h) at : ${TELLDUSCORE_INCLUDE}") ++ find_library(TELLDUS_LIBRARIES NAMES libtelldus-core.so) ++ IF(TELLDUS_LIBRARIES) ++ message(STATUS "Found libtelldus-core at : ${TELLDUS_LIBRARIES}, adding telldus support") ++ add_definitions(-DWITH_TELLDUSCORE) ++ ENDIF(TELLDUS_LIBRARIES) ++ ELSE() ++ message(STATUS "Not found telldus-core (telldus-core.h), not adding tellstick support") ++ ENDIF(TELLDUSCORE_INCLUDE) ++ENDIF(WITH_TELLDUSCORE) + + # Handle resolving + check_function_exists(res_init HAVE_LIBC_RESOLV)