Hello,
UPDATE at the bottom of the conversation
I am currently running Domoticz 2024.7 on Debian 11.11, Python 3.9.2.
Using HomeWizard P1 Meter and the plugin from 'Eraser3'. (https://github.com/Eraser3/HomeWizard-W ... /plugin.py)
I have set the plugin to run every 10 seconds.
Suddenly the plugin stops working and every 14 seconds a line is added to the log:
2026-02-13 12:05:46.324 Error: Compteur HW hardware (9) thread seems to have ended unexpectedly
2026-02-13 12:06:00.327 Error: Compteur HW hardware (9) thread seems to have ended unexpectedly
2026-02-13 12:06:14.332 Error: Compteur HW hardware (9) thread seems to have ended unexpectedly
How would you debug the issue ?
Thank you for your advices
Frederic
from Belgium
Plugin Python script failing -- Domoticz.Heartbeat(self.pluginInterval)
Moderator: leecollings
-
fdemees
- Posts: 30
- Joined: Sunday 29 March 2020 17:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.7
- Location: Belgium, close to Brussels
- Contact:
Plugin Python script failing -- Domoticz.Heartbeat(self.pluginInterval)
Last edited by fdemees on Thursday 19 February 2026 14:43, edited 1 time in total.
Domoticz on Rpi 3B+, ZigbeeforDomoticz, Sonoff Zigbee coordinator, several Sonoff/ESPEasy/Tasmota, IPX800, several Zigbee things, Ksenia Lares
-
willemd
- Posts: 735
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: Plugin Python script failing
Maybe the P1 meter cannot be reached, is unresponsive, and a timeout occurs.
First check your P1 meter with the standard URL
http://xxx.xxx.xxx.xxx/api/v1/data
with xxx etc. replaced by the IP address of the meter.
Then try to reset your P1 meter and/or router. In the past I had a type of router that often lost connection to the P1 meter.
First check your P1 meter with the standard URL
http://xxx.xxx.xxx.xxx/api/v1/data
with xxx etc. replaced by the IP address of the meter.
Then try to reset your P1 meter and/or router. In the past I had a type of router that often lost connection to the P1 meter.
-
fdemees
- Posts: 30
- Joined: Sunday 29 March 2020 17:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.7
- Location: Belgium, close to Brussels
- Contact:
Re: Plugin Python script failing
Thanks @willemd for your answer 
This is the first thing I have made in the beginning.
The dongle is working perfectly, I can query it both in API v1 and v2.
When it happens, some data structure or thread is probably in a stale state. I have found no other way to recover than restarting Domoticz.
If I try touching any item from the Setup > Hardware (eg. change the "Data Interval" or "Disable") the entire Domoticz dies immediately, altough the Unix process is still there.
So I suspect a resource exhaustion, or an issue with onHeartbeat() after a transient error ?
Frédéric
This is the first thing I have made in the beginning.
The dongle is working perfectly, I can query it both in API v1 and v2.
When it happens, some data structure or thread is probably in a stale state. I have found no other way to recover than restarting Domoticz.
If I try touching any item from the Setup > Hardware (eg. change the "Data Interval" or "Disable") the entire Domoticz dies immediately, altough the Unix process is still there.
So I suspect a resource exhaustion, or an issue with onHeartbeat() after a transient error ?
Frédéric
Domoticz on Rpi 3B+, ZigbeeforDomoticz, Sonoff Zigbee coordinator, several Sonoff/ESPEasy/Tasmota, IPX800, several Zigbee things, Ksenia Lares
-
willemd
- Posts: 735
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: Plugin Python script failing
Sorry, I have to leave further investigation to the developer of the plugin.
-
fdemees
- Posts: 30
- Joined: Sunday 29 March 2020 17:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.7
- Location: Belgium, close to Brussels
- Contact:
Re: Plugin Python script failing
As the error message originates from Domoticz itself and not from the plugin, I wonder whether I could receive a recommendation from the Domoticz community.
What can happen when Domoticz forks a thread ?
What can cause "Error: xxx hardware (x) thread seems to have ended unexpectedly " ?
What can happen when Domoticz forks a thread ?
What can cause "Error: xxx hardware (x) thread seems to have ended unexpectedly " ?
Domoticz on Rpi 3B+, ZigbeeforDomoticz, Sonoff Zigbee coordinator, several Sonoff/ESPEasy/Tasmota, IPX800, several Zigbee things, Ksenia Lares
-
willemd
- Posts: 735
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: Plugin Python script failing
I know from development of my own plugins that the error message "thread seems to have ended unexpectedly" normally does not cause further problems. To my understanding, it usually indicates that a new thread from heartbeat is started while the previous one has not yet finished. The new thread will then just continue. I am getting these errors when there is no response from the external device. Once the device is recovered, all is well again.fdemees wrote: Friday 13 February 2026 13:41 As the error message originates from Domoticz itself and not from the plugin, I wonder whether I could receive a recommendation from the Domoticz community.
What can happen when Domoticz forks a thread ?
What can cause "Error: xxx hardware (x) thread seems to have ended unexpectedly " ?
By the way, sometimes when I update a plugin and then push the "update" button in the hardware page, Domoticz seems unresponsive while the Unix thread is still running. In my experience this just takes some time, I guess that the current processes have to be finished before the update takes effect and while that is happening Domoticz seems unresponsive. In your observation Domoticz crashes, but I wonder whether this might be the same experience.
-
fdemees
- Posts: 30
- Joined: Sunday 29 March 2020 17:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.7
- Location: Belgium, close to Brussels
- Contact:
Re: Plugin Python script failing
The plugin was set with the heartbeat to a fixed 10 seconds and I did ask for a refresh every 10 seconds (this item is configurable in steps of 10).
I will shorten a bit the heartbeat to 9 seconds, and double the refresh.
I don't really understand how this works (my fault, I should have read the docs
)
And additionally, some extra debug information.
I fear that in case of a failure, the debug info will scroll out of the buffer log.
We will see.
I will shorten a bit the heartbeat to 9 seconds, and double the refresh.
I don't really understand how this works (my fault, I should have read the docs
And additionally, some extra debug information.
I fear that in case of a failure, the debug info will scroll out of the buffer log.
We will see.
Domoticz on Rpi 3B+, ZigbeeforDomoticz, Sonoff Zigbee coordinator, several Sonoff/ESPEasy/Tasmota, IPX800, several Zigbee things, Ksenia Lares
-
fdemees
- Posts: 30
- Joined: Sunday 29 March 2020 17:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.7
- Location: Belgium, close to Brussels
- Contact:
Re: Plugin Python script failing
I have directed the log file to syslog facility.
Now I have to wait until the problem happens again.
We will see.
Thanks @willemd for your interventions here
Now I have to wait until the problem happens again.
We will see.
Thanks @willemd for your interventions here
Domoticz on Rpi 3B+, ZigbeeforDomoticz, Sonoff Zigbee coordinator, several Sonoff/ESPEasy/Tasmota, IPX800, several Zigbee things, Ksenia Lares
-
fdemees
- Posts: 30
- Joined: Sunday 29 March 2020 17:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.7
- Location: Belgium, close to Brussels
- Contact:
Re: Plugin Python script failing -- Domoticz.Heartbeat(self.pluginInterval)
Hello again,
I have redirected the log to the syslog facility. Now I have more info.
I have set the plugin in debug mode.
The heartbeat is set to 9 seconds and the action to 10 seconds. As a result the next action would fire 18 seconds after the previous one.
What happened between 12:18:40 and 12:19:43 ? I even don't know whether the plugin is run.
I have redirected the log to the syslog facility. Now I have more info.
I have set the plugin in debug mode.
The heartbeat is set to 9 seconds and the action to 10 seconds. As a result the next action would fire 18 seconds after the previous one.
Code: Select all
Feb 19 12:18:13 rpi3b domoticz: (Phase 1 (A)) Updating device from 0:'2.210;0' to have values 0:'2.300;0'.
Feb 19 12:18:13 rpi3b domoticz: (Phase 2 (A)) Updating device from 0:'0.000;0' to have values 0:'0.000;0'.
Feb 19 12:18:13 rpi3b domoticz: (Phase 3 (A)) Updating device from 0:'2.660;0' to have values 0:'2.560;0'.
Feb 19 12:18:13 rpi3b domoticz: (Gaz) Updating device from 0:'1669880' to have values 0:'1669907'.
Feb 19 12:18:13 rpi3b domoticz: (Compteur HW - Wifi signal) Updating device from 0:'24' to have values 0:'28'.
Feb 19 12:18:13 rpi3b domoticz: (Compteur HW - Production switch) Updating device from 1:'On' to have values 0:'Off'.
Feb 19 12:18:13 rpi3b domoticz: Compteur HW: Acquiring GIL for 'onHeartbeatCallback'
Feb 19 12:18:13 rpi3b domoticz: Compteur HW: Pushing 'onHeartbeatCallback' on to queue
Feb 19 12:18:13 rpi3b domoticz: Compteur HW: Processing 'onHeartbeatCallback' message
Feb 19 12:18:13 rpi3b domoticz: Compteur HW: Acquiring GIL for 'onHeartbeatCallback'
Feb 19 12:18:13 rpi3b domoticz: Compteur HW: Calling message handler 'onHeartbeat' on 'module' type object.
Feb 19 12:18:13 rpi3b domoticz: Compteur HW: Acquiring GIL for 'onHeartbeatCallback'
Feb 19 12:18:22 rpi3b domoticz: Compteur HW: Pushing 'onHeartbeatCallback' on to queue
Feb 19 12:18:22 rpi3b domoticz: Compteur HW: Processing 'onHeartbeatCallback' message
Feb 19 12:18:22 rpi3b domoticz: Compteur HW: Acquiring GIL for 'onHeartbeatCallback'
Feb 19 12:18:22 rpi3b domoticz: Compteur HW: Calling message handler 'onHeartbeat' on 'module' type object.
Feb 19 12:18:22 rpi3b domoticz: (Compteur HW - Current power usage) Updating device from 0:'57;1637428' to have values 0:'-14;1637428'.
Feb 19 12:18:22 rpi3b domoticz: (Electricité) Updating device from 0:'1466521;1910854;1226528;513419;57;0' to have values 0:'1466521;1910
854;1226528;513419;0;14'.
... autres "Updating device" ...
Feb 19 12:18:22 rpi3b domoticz: (Compteur HW - Production switch) Updating device from 0:'Off' to have values 1:'On'.
Feb 19 12:18:22 rpi3b domoticz: Compteur HW: Acquiring GIL for 'onHeartbeatCallback'
Feb 19 12:18:31 rpi3b domoticz: Compteur HW: Pushing 'onHeartbeatCallback' on to queue
Feb 19 12:18:31 rpi3b domoticz: Compteur HW: Processing 'onHeartbeatCallback' message
Feb 19 12:18:31 rpi3b domoticz: Compteur HW: Acquiring GIL for 'onHeartbeatCallback'
Feb 19 12:18:31 rpi3b domoticz: Compteur HW: Calling message handler 'onHeartbeat' on 'module' type object.
Feb 19 12:18:31 rpi3b domoticz: Compteur HW: Acquiring GIL for 'onHeartbeatCallback'
Feb 19 12:18:40 rpi3b domoticz: Compteur HW: Pushing 'onHeartbeatCallback' on to queue
Feb 19 12:18:40 rpi3b domoticz: Compteur HW: Processing 'onHeartbeatCallback' message
Feb 19 12:18:40 rpi3b domoticz: Compteur HW: Acquiring GIL for 'onHeartbeatCallback'
Feb 19 12:18:40 rpi3b domoticz: Compteur HW: Calling message handler 'onHeartbeat' on 'module' type object.
Feb 19 12:19:43 rpi3b domoticz: Compteur HW hardware (9) thread seems to have ended unexpectedly
Feb 19 12:19:57 rpi3b domoticz: Compteur HW hardware (9) thread seems to have ended unexpectedly
Feb 19 12:20:11 rpi3b domoticz: Compteur HW hardware (9) thread seems to have ended unexpectedly
Feb 19 12:20:25 rpi3b domoticz: Compteur HW hardware (9) thread seems to have ended unexpectedly
Feb 19 12:20:39 rpi3b domoticz: Compteur HW hardware (9) thread seems to have ended unexpectedlyDomoticz on Rpi 3B+, ZigbeeforDomoticz, Sonoff Zigbee coordinator, several Sonoff/ESPEasy/Tasmota, IPX800, several Zigbee things, Ksenia Lares
Who is online
Users browsing this forum: No registered users and 1 guest