Counter Looped detected: what's wrong Topic is solved

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
Doler
Posts: 163
Joined: Friday 31 July 2015 21:02
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sint-Oedenrode, Netherlands
Contact:

Counter Looped detected: what's wrong

Post by Doler »

Updated from version 2025.2 (build 16922) to version 2025.2 (build 16954) and found next status in the log:

Code: Select all

Status: ZWave-AD: Counter Looped detected on first received value for: PN1 (PN1_electric_kwh_value)/zwavejs2mqtt_0xfe88fc1e_8-50-0-value-65537, could be an old retained value?
This status is repeatedly reported for every zwave module with an electric_kwh_value device (even though the devics are unused) and thus flooding the log.

Can somebody help me to explain what the cause of this is and how to prevent it?
Mark: Domoticz latest Beta on Virtual machine (Proxmox) running Debian Bookworm - Z-Stick 7 - RFXCom - P1 - SolarEdge - Dahua - Philips Hue - Docker - Zigbee2mqtt (latest, docker) via python plugin - Zwave-js-ui (latest, docker) - dzVents - Nodered
HvdW
Posts: 663
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: Counter Looped detected: what's wrong

Post by HvdW »

The error ZWave-AD: Counter Looped detected for your energy meter (PN1) usually means:
Cause
- The meter value rolled over (e.g., exceeded 65535 and reset to 0 or 65537).
- An old retained MQTT value was republished.
- A Z-Wave communication glitch.
Possible Fix
1. Clear retained MQTT messages for the topic:

Code: Select all

mosquitto_pub -h [broker_ip] -t "zwavejs2mqtt/0xfe88fc1e/8/50/0/value" -r -n
2. Reset the meter or reinclude it in your Z-Wave network.
3. Check for firmware updates for the meter or Z-Wave controller.
Bugs bug me.
commentator
Posts: 56
Joined: Thursday 23 June 2016 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: NL
Contact:

Re: Counter Looped detected: what's wrong

Post by commentator »

same problem here since update.
Only in Domoticz it is an issue. No problems in HA
User avatar
waltervl
Posts: 6676
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Counter Looped detected: what's wrong

Post by waltervl »

It is only a remark Domoticz found a possible incorrect value and ignoring it. You can also ignore it.
From the code (implemented last week):
https://github.com/domoticz/domoticz/bl ... .cpp#L2173

Code: Select all

				//There could be an anoying situation with MQTT retained messages
				//If a user enabled a retained message, and later sends a new value not-retained,
				//the retained message is still here, and contains a old value.
				//So if we detect a loop on the first message, we ignore the previous value
				Log(LOG_STATUS, "Counter Looped detected on first received value for: %s/%s, could be an old retained value?", pSensor->name.c_str(), pSensor->unique_id.c_str());
If you do not want to ignore it check your MQTT retained messages for this sensor and delete them. See wiki page https://wiki.domoticz.com/MQTT#Delete_retained_topic
If you do not have retained messages then something else is wrong.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Doler
Posts: 163
Joined: Friday 31 July 2015 21:02
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sint-Oedenrode, Netherlands
Contact:

Re: Counter Looped detected: what's wrong

Post by Doler »

Sorry for the late answer but I've been hospitalized so couldn't try things out. I'm getting better now but not this problem.

I checked for retained values: there are none. To be sure I deleted all value messages using MQTT Explorer, log messages keep coming.

I excluded/included one of the error devices (Neo Powerswitch) but result remains the same.

My Z-Stick 7 has the latest firmware, Zwave JS UI is on latest release/version.

Ignoring is impossible since the log messages keep coming at every poll interval.

What can I do/check next?

Regards, Mark
Mark: Domoticz latest Beta on Virtual machine (Proxmox) running Debian Bookworm - Z-Stick 7 - RFXCom - P1 - SolarEdge - Dahua - Philips Hue - Docker - Zigbee2mqtt (latest, docker) via python plugin - Zwave-js-ui (latest, docker) - dzVents - Nodered
User avatar
waltervl
Posts: 6676
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Counter Looped detected: what's wrong

Post by waltervl »

Copy and paste here a history list of those counter values from MQTT explorer around the time you get that counter loop status message in the log.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
gizmocuz
Posts: 2706
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Counter Looped detected: what's wrong

Post by gizmocuz »

If you get it on every poll, what is the actual status value ? (0)?

zwavejs2mqtt/0xfe88fc1e/8/50/0/value

(You can use MQTT Explorer to find this)
Quality outlives Quantity!
Doler
Posts: 163
Joined: Friday 31 July 2015 21:02
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sint-Oedenrode, Netherlands
Contact:

Re: Counter Looped detected: what's wrong

Post by Doler »

I analyzed/tested things last night and this morning: I get (got) the log messages at every poll with the actual value being 0. As soon as the accumulted value is non-zero, the message no longer appears.
So I made sure that the 'faulty' devices had a non-zero kWh value and I have a clean log now. Makes me wonder though what would happen with new devices?

Thanks for the support,
Mark
Mark: Domoticz latest Beta on Virtual machine (Proxmox) running Debian Bookworm - Z-Stick 7 - RFXCom - P1 - SolarEdge - Dahua - Philips Hue - Docker - Zigbee2mqtt (latest, docker) via python plugin - Zwave-js-ui (latest, docker) - dzVents - Nodered
User avatar
gizmocuz
Posts: 2706
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Counter Looped detected: what's wrong

Post by gizmocuz »

With new devices you would see this status message until it increases...
Is it your own MQTT/Device? Why does the counter not increase at the device point? Nothing connected?
We could silence this warning when it is 0.... maybe that is better
Quality outlives Quantity!
Doler
Posts: 163
Joined: Friday 31 July 2015 21:02
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sint-Oedenrode, Netherlands
Contact:

Re: Counter Looped detected: what's wrong

Post by Doler »

This happened at regular z-wave devices but indeed not connected or connected device not used (yet). Silence the warning would be a good idea to prevent future concerns.

Grtz, Mark
Mark: Domoticz latest Beta on Virtual machine (Proxmox) running Debian Bookworm - Z-Stick 7 - RFXCom - P1 - SolarEdge - Dahua - Philips Hue - Docker - Zigbee2mqtt (latest, docker) via python plugin - Zwave-js-ui (latest, docker) - dzVents - Nodered
Post Reply

Who is online

Users browsing this forum: heggink and 1 guest