Skip to content

Commit 1720fd3

Browse files
committed
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 <[email protected]>
1 parent 837dc9e commit 1720fd3

File tree

4 files changed

+65
-5
lines changed

4 files changed

+65
-5
lines changed

utils/domoticz/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
99

1010
PKG_NAME:=domoticz
1111
PKG_VERSION:=2025.2
12-
PKG_RELEASE:=1
12+
PKG_RELEASE:=2
1313

1414
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
1515
PKG_SOURCE_URL:=https://codeload.github.com/domoticz/domoticz/tar.gz/$(PKG_VERSION)?
@@ -47,7 +47,6 @@ define Package/domoticz
4747
+libopenzwave \
4848
+libsqlite3 \
4949
+libstdcpp \
50-
+telldus-core \
5150
+zlib
5251
endef
5352

@@ -72,7 +71,8 @@ CMAKE_OPTIONS += \
7271
-DUSE_STATIC_OPENZWAVE=no \
7372
-DUSE_OPENSSL_STATIC=no \
7473
-DUSE_PYTHON=yes \
75-
-DWITH_LIBUSB=no
74+
-DWITH_LIBUSB=no \
75+
-DWITH_TELLDUSCORE=no
7676

7777
TARGET_CXXFLAGS += -DWITH_GPIO
7878

utils/domoticz/files/domoticz.config

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
config domoticz
22
option disabled '1'
3-
option loglevel '1'
3+
# (combination of: all,normal,status,error,debug)
4+
option loglevel 'normal'
5+
# (combination of: all,normal,hardware,received,webserver,eventsystem,python,thread_id,sql,auth)
6+
option debuglevel 'normal'
7+
# [user|daemon|local0 .. local7]
48
option syslog 'daemon'
9+
# You can point it at ACME certs directly and it reloads automatically when they change.
510
# option sslcert '/path/to/ssl.crt'
611
# option sslkey '/path/to/ssl.key'
712
# option sslpass 'passphrase'
813
# option ssldhparam '/path/to/dhparam.pem'
14+
# option mdns '0'
15+
# option www '8080'
916
option sslwww '0'
1017
# CAUTION - by default, /var is not persistent accross reboots
1118
# Don't forget the trailing / - domoticz requires it

utils/domoticz/files/domoticz.init

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,35 @@ PIDFILE=/var/run/domoticz.pid
77

88
start_domoticz() {
99
local section="$1"
10-
local disabled loglevel sslcert sslpass sslwww syslog userdata
10+
local disabled loglevel debuglevel mdns sslcert sslpass sslwww www syslog vhostname userdata
1111

1212
config_get_bool disabled "$section" "disabled" 0
1313
[ "$disabled" -gt 0 ] && return
1414

1515
config_get loglevel "$section" "loglevel"
16+
config_get debuglevel "$section" "debuglevel"
17+
config_get_bool mdns "$section" "mdns" 0
1618
config_get sslcert "$section" "sslcert"
1719
config_get sslkey "$section" "sslkey"
1820
config_get sslpass "$section" "sslpass"
1921
config_get ssldhparam "$section" "ssldhparam"
2022
config_get sslwww "$section" "sslwww"
23+
config_get www "$section" "www"
2124
config_get syslog "$section" "syslog"
25+
config_get vhostname "$section" "vhostname"
2226
config_get userdata "$section" "userdata" userdata /var/lib/domoticz
2327

2428
procd_open_instance
2529
procd_set_param command "$PROG"
2630
procd_append_param command -noupdates
2731
procd_append_param command -approot /usr/share/domoticz/
2832

33+
[ "$mdns" -eq 0 ] && procd_append_param command "-nomdns"
2934
[ -n "$loglevel" ] && procd_append_param command -loglevel "$loglevel"
35+
[ -n "$debuglevel" ] && procd_append_param command -debuglevel "$debuglevel"
3036
[ -n "$syslog" ] && procd_append_param command -syslog "$syslog"
37+
[ -n "$vhostname" ] && procd_append_param command -vhostname "$vhostname"
38+
[ -n "$www" ] && procd_append_param command -www "$www"
3139

3240
[ -d "${userdata}" ] || {
3341
mkdir -p "${userdata}"
@@ -56,6 +64,10 @@ start_domoticz() {
5664
[ -n "$ssldhparam" ] && procd_append_param command -ssldhparam "$ssldhparam"
5765
} || procd_append_param command -sslwww 0
5866

67+
# OpenWrt musl has a hack to read /etc/TZ every time if $TZ isn't set.
68+
# Work around it by setting $TZ
69+
[ -r "/etc/TZ" ] && procd_append_param env TZ="$(cat /etc/TZ)"
70+
5971
procd_set_param pidfile "$PIDFILE"
6072
procd_set_param respawn
6173
procd_set_param stdout 0
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
--- a/CMakeLists.txt
2+
+++ b/CMakeLists.txt
3+
@@ -32,6 +32,7 @@ option(USE_PYTHON "Use Python for Plugin
4+
option(INCLUDE_LINUX_I2C "Include I2C support" YES)
5+
option(INCLUDE_SPI "Include SPI support" YES)
6+
option(WITH_LIBUSB "Enable libusb support" YES)
7+
+option(WITH_TELLDUSCORE "Enable Telldus support" YES)
8+
9+
# Link static or shared, external dependencies
10+
option(USE_LUA_STATIC "Link LUA static" YES)
11+
@@ -783,17 +784,19 @@ ELSE()
12+
message(STATUS "GPIO is not available")
13+
ENDIF()
14+
15+
-find_path(TELLDUSCORE_INCLUDE NAMES telldus-core.h)
16+
-IF(TELLDUSCORE_INCLUDE)
17+
- message(STATUS "Found telldus-core (telldus-core.h) at : ${TELLDUSCORE_INCLUDE}")
18+
- find_library(TELLDUS_LIBRARIES NAMES libtelldus-core.so)
19+
- IF(TELLDUS_LIBRARIES)
20+
- message(STATUS "Found libtelldus-core at : ${TELLDUS_LIBRARIES}, adding telldus support")
21+
- add_definitions(-DWITH_TELLDUSCORE)
22+
- ENDIF(TELLDUS_LIBRARIES)
23+
-ELSE()
24+
- message(STATUS "Not found telldus-core (telldus-core.h), not adding tellstick support")
25+
-ENDIF(TELLDUSCORE_INCLUDE)
26+
+IF(WITH_TELLDUSCORE)
27+
+ find_path(TELLDUSCORE_INCLUDE NAMES telldus-core.h)
28+
+ IF(TELLDUSCORE_INCLUDE)
29+
+ message(STATUS "Found telldus-core (telldus-core.h) at : ${TELLDUSCORE_INCLUDE}")
30+
+ find_library(TELLDUS_LIBRARIES NAMES libtelldus-core.so)
31+
+ IF(TELLDUS_LIBRARIES)
32+
+ message(STATUS "Found libtelldus-core at : ${TELLDUS_LIBRARIES}, adding telldus support")
33+
+ add_definitions(-DWITH_TELLDUSCORE)
34+
+ ENDIF(TELLDUS_LIBRARIES)
35+
+ ELSE()
36+
+ message(STATUS "Not found telldus-core (telldus-core.h), not adding tellstick support")
37+
+ ENDIF(TELLDUSCORE_INCLUDE)
38+
+ENDIF(WITH_TELLDUSCORE)
39+
40+
# Handle resolving
41+
check_function_exists(res_init HAVE_LIBC_RESOLV)

0 commit comments

Comments
 (0)