From 16be13461c1649e71ea10758f186cbe29f4fbd37 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 31 Oct 2026 09:05:07 +0000 Subject: [PATCH] domoticz: update to 2026.4 Fetch the source asset from the release rather than the codeload tarball: the webserver is now the libwebem submodule (previously the in-tree webserver/ directory), and codeload tarballs do not include submodules. It is built in and linked statically, as before. Drop the patches which are obsoleted by the new release: the development snapshot (and its version stamp), the telldus and boost fixes, and the counter graph spike-spreading feature which was accepted upstream as fillMissingDays(). Rebase the MQTT-AD duplicate message patch. Add two patches to libwebem, submitted upstream: - accept the MINIZIP::minizip imported target name exported by minizip-ng 4.x - fall back to pkg-config to find jsoncpp. We build with CMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY, as config-mode find_package() would otherwise find the build host's jsoncpp cmake config and link an x86_64 library into an aarch64 build. Signed-off-by: David Woodhouse --- utils/domoticz/Makefile | 22 +++++++--- .../001-domoticz-2025.2-no-telldus.patch | 41 ------------------- .../002-fix-boost-asio-post-executor.patch | 11 ----- ...bwebem-accept-MINIZIP-minizip-target.patch | 27 ++++++++++++ ...libwebem-find-jsoncpp-via-pkg-config.patch | 35 ++++++++++++++++ .../009-MQTT-AD-Drop-duplicate-messages.patch | 36 ++++++++++++++++ 6 files changed, 114 insertions(+), 58 deletions(-) delete mode 100644 utils/domoticz/patches/001-domoticz-2025.2-no-telldus.patch delete mode 100644 utils/domoticz/patches/002-fix-boost-asio-post-executor.patch create mode 100644 utils/domoticz/patches/003-libwebem-accept-MINIZIP-minizip-target.patch create mode 100644 utils/domoticz/patches/004-libwebem-find-jsoncpp-via-pkg-config.patch create mode 100644 utils/domoticz/patches/009-MQTT-AD-Drop-duplicate-messages.patch diff --git a/utils/domoticz/Makefile b/utils/domoticz/Makefile index 84217766ad..b42476b439 100644 --- a/utils/domoticz/Makefile +++ b/utils/domoticz/Makefile @@ -8,12 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=domoticz -PKG_VERSION:=2025.2 -PKG_RELEASE:=4 +PKG_VERSION:=2026.4 +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://codeload.github.com/domoticz/domoticz/tar.gz/$(PKG_VERSION)? -PKG_HASH:=fd016f4ffe419e8d559bc0a7f9de5ec4fcaf485fc9d1464c8e8221102b13f589 +# The codeload tarball lacks the extern/ submodules (libwebem); use the +# source asset from the release, which bundles them. +PKG_SOURCE:=domoticz_src_2026.18387.tar.gz +PKG_SOURCE_URL:=https://github.com/domoticz/domoticz/releases/download/$(PKG_VERSION) +PKG_HASH:=88964b791050abf6b6df3ec9e1d262d18e198a6fa108638974eca8600d1a4568 PKG_MAINTAINER:=David Woodhouse PKG_LICENSE:=GPL-3.0 @@ -26,6 +28,11 @@ PKG_BUILD_FLAGS:=no-mips16 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk +# The tarball extracts to a bare domoticz/ directory; strip that so the +# build happens in the usual versioned directory. +TAR_OPTIONS:=--strip-components 1 $(TAR_OPTIONS) +TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) + define Package/domoticz SECTION:=utils CATEGORY:=Utilities @@ -33,6 +40,7 @@ define Package/domoticz URL:=https://domoticz.com/ USERID:=domoticz=6144:domoticz=6144 DEPENDS:= \ + +libatomic \ +boost \ +boost-date_time \ +boost-thread \ @@ -54,9 +62,11 @@ define Package/domoticz/description Domoticz is a Home Automation System that lets you monitor and configure various devices like: Lights, Switches, various sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water and much more. Notifications/Alerts can be sent to any mobile device. endef +TARGET_LDFLAGS += -latomic + CMAKE_OPTIONS += \ - -DBUILD_SHARED_LIBS=yes \ -DBoost_NO_BOOST_CMAKE=yes \ + -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \ -DGIT_SUBMODULE=no \ -DCMAKE_BUILD_TYPE=Release \ -DUSE_BUILTIN_MQTT=no \ diff --git a/utils/domoticz/patches/001-domoticz-2025.2-no-telldus.patch b/utils/domoticz/patches/001-domoticz-2025.2-no-telldus.patch deleted file mode 100644 index 8b8599047b..0000000000 --- a/utils/domoticz/patches/001-domoticz-2025.2-no-telldus.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- 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) diff --git a/utils/domoticz/patches/002-fix-boost-asio-post-executor.patch b/utils/domoticz/patches/002-fix-boost-asio-post-executor.patch deleted file mode 100644 index f67c262d7e..0000000000 --- a/utils/domoticz/patches/002-fix-boost-asio-post-executor.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/tcpserver/TCPServer.cpp -+++ b/tcpserver/TCPServer.cpp -@@ -59,7 +59,7 @@ namespace tcp { - // Post a call to the stop function so that server::stop() is safe to call - // from any thread. - flghandle_stop_Completed=false; -- boost::asio::post([this] { handle_stop(); }); -+ boost::asio::post(io_context_, [this] { handle_stop(); }); - } - - void CTCPServerInt::handle_stop() diff --git a/utils/domoticz/patches/003-libwebem-accept-MINIZIP-minizip-target.patch b/utils/domoticz/patches/003-libwebem-accept-MINIZIP-minizip-target.patch new file mode 100644 index 0000000000..371d9f224e --- /dev/null +++ b/utils/domoticz/patches/003-libwebem-accept-MINIZIP-minizip-target.patch @@ -0,0 +1,27 @@ +From 1b41f66000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: David Woodhouse +Date: Fri, 31 Oct 2026 10:30:00 +0000 +Subject: [PATCH] libwebem: accept the MINIZIP::minizip imported target name + +The minizip cmake config shipped by minizip 4.x exports its imported +target in an uppercase MINIZIP:: namespace; webem only looked for +minizip::minizip and failed at generate time despite minizip_FOUND. + +--- a/extern/libwebem/CMakeLists.txt ++++ b/extern/libwebem/CMakeLists.txt +@@ -207,10 +207,14 @@ if(WEBEM_ENABLE_ZIP) + target_link_libraries(webem PRIVATE minizip) + elseif(TARGET minizip::minizip) + target_link_libraries(webem PRIVATE minizip::minizip) ++ elseif(TARGET MINIZIP::minizip) ++ target_link_libraries(webem PRIVATE MINIZIP::minizip) + else() + find_package(minizip QUIET) +- if(minizip_FOUND) ++ if(TARGET minizip::minizip) + target_link_libraries(webem PRIVATE minizip::minizip) ++ elseif(TARGET MINIZIP::minizip) ++ target_link_libraries(webem PRIVATE MINIZIP::minizip) + else() + message(WARNING "minizip not found - disabling ZIP support. Install minizip to enable it.") + target_compile_definitions(webem PUBLIC WEBSERVER_DONT_USE_ZIP) diff --git a/utils/domoticz/patches/004-libwebem-find-jsoncpp-via-pkg-config.patch b/utils/domoticz/patches/004-libwebem-find-jsoncpp-via-pkg-config.patch new file mode 100644 index 0000000000..64257fff49 --- /dev/null +++ b/utils/domoticz/patches/004-libwebem-find-jsoncpp-via-pkg-config.patch @@ -0,0 +1,35 @@ +From 344e73e000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: David Woodhouse +Date: Fri, 31 Oct 2026 10:31:00 +0000 +Subject: [PATCH] libwebem: fall back to pkg-config to find jsoncpp + +Distros (OpenWrt among them) may ship jsoncpp with only a pkg-config +file. Config-mode find_package() then finds nothing - or worse, when +cross-compiling, finds the build host's config and links a foreign- +architecture library. Try pkg-config, which handles cross-compilation +correctly, before resorting to FetchContent. + +--- a/extern/libwebem/CMakeLists.txt ++++ b/extern/libwebem/CMakeLists.txt +@@ -171,9 +171,20 @@ elseif(TARGET jsoncpp_lib) + target_link_libraries(webem PUBLIC jsoncpp_lib) + else() + find_package(jsoncpp QUIET) +- if(jsoncpp_FOUND) ++ if(NOT TARGET jsoncpp_lib) ++ # No usable cmake config for jsoncpp (when cross-compiling, a host ++ # config must not count); pkg-config gets cross-compilation right. ++ find_package(PkgConfig QUIET) ++ if(PKG_CONFIG_FOUND) ++ pkg_check_modules(JSONCPP IMPORTED_TARGET jsoncpp) ++ endif() ++ endif() ++ if(TARGET jsoncpp_lib) + message(STATUS "webem: using system jsoncpp") + target_link_libraries(webem PUBLIC jsoncpp_lib) ++ elseif(TARGET PkgConfig::JSONCPP) ++ message(STATUS "webem: using pkg-config jsoncpp") ++ target_link_libraries(webem PUBLIC PkgConfig::JSONCPP) + else() + message(STATUS "webem: fetching jsoncpp 1.9.6 via FetchContent") + set(JSONCPP_WITH_TESTS OFF CACHE BOOL "" FORCE) diff --git a/utils/domoticz/patches/009-MQTT-AD-Drop-duplicate-messages.patch b/utils/domoticz/patches/009-MQTT-AD-Drop-duplicate-messages.patch new file mode 100644 index 0000000000..1b583b3855 --- /dev/null +++ b/utils/domoticz/patches/009-MQTT-AD-Drop-duplicate-messages.patch @@ -0,0 +1,36 @@ +From 39dbe8121339917ab4c2f856aec714f0507af2a5 Mon Sep 17 00:00:00 2001 +From: David Woodhouse +Date: Mon, 1 Dec 2025 10:14:54 +0000 +Subject: [PATCH 2/7] MQTT-AD: Drop duplicate messages + +ESPHome sends duplicate messages to MQTT every time it polls the hardware +sensor, even if the value hasn't changed. Drop them in MQTT-AD if the +previous one is less than ten minutes old, rather than wasting a lot of +time processing the 'updates'. +--- + hardware/MQTTAutoDiscover.cpp | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) +--- a/hardware/MQTTAutoDiscover.cpp ++++ b/hardware/MQTTAutoDiscover.cpp +@@ -2090,8 +2090,20 @@ void MQTTAutoDiscover::handle_auto_disco + { + szValue = qMessage; + } ++ // ESPHome repeatedly sends MQTT updates each time it polls the sensor, ++ // even when the value doesn't change. Discard duplicates if the last ++ // value is the same, and less than ten minutes old. ++ auto now = mytime(nullptr); ++ if (pSensor->last_topic == topic && pSensor->last_value == szValue && ++ pSensor->last_received > (now - 600)) ++ { ++#ifdef _DEBUG ++ Log(LOG_NORM, "Dropping duplicate MQTT message to %s (%ld seconds old)", topic.c_str(), now - pSensor->last_received); ++#endif ++ return; ++ } + pSensor->last_value = szValue; +- pSensor->last_received = mytime(nullptr); ++ pSensor->last_received = now; + pSensor->last_topic = topic; + pSensor->bIsJSON = bIsJSON; + if (bIsJSON)