TS011F Countdown Lost After Update: A Fix

by SLV Team 42 views
TS011F Countdown Feature Missing After Zigbee2MQTT Update: Troubleshooting and Solutions

Hey everyone! Have you recently updated your Zigbee2MQTT and found that the countdown feature on your TS011F whitelabeled smart plug has disappeared? If so, you're not alone. This article dives into a common issue where the countdown functionality is lost after updating from Zigbee2MQTT version 2.6.2 to 2.6.3 (or later). We'll explore the problem, the likely cause, and potential solutions to get your countdown timer working again. Let's get started!

The Problem: Countdown Timer Vanishes After Update

Many users, including the original poster, have reported the frustrating loss of the countdown feature on their whitelabeled TS011F smart plugs after updating Zigbee2MQTT. These plugs, often rebranded by various manufacturers, are popular for their energy monitoring capabilities and the convenience of a built-in timer. The core issue revolves around how the device is identified and handled by Zigbee2MQTT after the update.

What Exactly Happened?

After the update, the device is re-identified as TS011F_plug_3. This change in identification is due to the new version requiring polling for power monitoring on some devices. The problem arises because the configuration for TS011F_plug_3 in the zigbee-herdsman-converters library doesn't include the necessary code to enable the countdown feature. This means that any automations or scripts that relied on the countdown timer will suddenly display errors, leaving users in the dark (literally, in some cases!). The device info in your Home Assistant setup will also no longer show the countdown timer control. Reverting to the older version (2.6.2) restores the expected functionality, confirming the update as the culprit.

Expected Behavior vs. Reality

Users rightfully expect the countdown feature to remain functional after a software update, especially when it's a core function of the device. Updating should improve features and fix bugs, not remove or break essential functionality. In this case, the update inadvertently removed the countdown feature, breaking existing automations and the user experience.

How to Reproduce the Issue: Step-by-Step Guide

If you're experiencing this issue or want to verify the problem, here's how to reproduce it:

  1. Pair the Device: Start by pairing your whitelabeled TS011F device with Zigbee2MQTT version 2.6.2 (or a version where the countdown feature works).
  2. Configure Automations/Scripts: Create automations or scripts within your home automation system (like Home Assistant) that utilize the countdown feature of the smart plug. For example, set the plug to turn off after a specific time.
  3. Update Zigbee2MQTT: Update your Zigbee2MQTT installation to version 2.6.3 or later.
  4. Observe the Errors: Check your home automation system for errors related to the smart plug. Your automations that use the countdown feature will likely show errors.
  5. Verify the Missing Feature: In your Home Assistant device info for the plug, check if the countdown timer control is available. It will likely be missing.

This straightforward process replicates the problem and helps confirm whether you're experiencing the same issue. It isolates the update as the cause and highlights the specific impact on your automations and device controls.

Digging Deeper: Zigbee2MQTT and Device Definitions

To understand the root cause, let's look at the heart of the problem: the zigbee-herdsman-converters library. This library contains the definitions for various Zigbee devices, telling Zigbee2MQTT how to communicate with them and what features they support. The issue stems from the differing definitions for the TS011F models.

The Role of zigbee-herdsman-converters

The library acts as a translator, allowing Zigbee2MQTT to understand and interact with diverse Zigbee devices. Each device has a specific entry in the library, defining its capabilities, supported clusters, and available controls. When a device is paired, Zigbee2MQTT uses this entry to configure the device and expose its functionalities within your home automation system.

Comparing the Device Definitions

Here's a breakdown of the relevant sections from the tuya.ts file within the zigbee-herdsman-converters repository (linked in the original post):

  • TS011F_plug_1: This older definition (L7596 in the original post's link) includes the onOffCountdown option within the extend block. This line is crucial for enabling the countdown feature.
  • TS011F_plug_2: Similar to plug_1, this definition (L7660) also explicitly includes the onOffCountdown: true in the extend block, confirming its countdown capability.
  • TS011F_plug_3: The crucial difference lies in the definition for TS011F_plug_3 (L7695). This updated definition omits the onOffCountdown option, which explains why the feature is missing after the update. Instead, it focuses on electricity measurement polling.

The absence of onOffCountdown in the TS011F_plug_3 definition directly causes the problem. When the device is identified as this model, Zigbee2MQTT doesn't know to expose and handle the countdown feature.

Troubleshooting and Potential Solutions

Okay, so what can you do if you're stuck with a missing countdown timer? Here are a few potential solutions and workarounds:

1. Revert to the Previous Version (Temporary Fix)

As the original poster discovered, reverting to Zigbee2MQTT version 2.6.2 (or the last version where the countdown worked) is the simplest and most immediate solution. This restores the correct device definition and re-enables the countdown feature. While this fixes the immediate problem, it means you won't benefit from any bug fixes or improvements included in the newer versions.

2. Manual Device Override (Advanced)

This method involves manually defining your device within Zigbee2MQTT. It offers more control but requires some technical knowledge. Create a file called configuration.yaml in your Zigbee2MQTT data directory, or edit the existing one. Add the following, replacing the ieee with your device's address (find this in the Zigbee2MQTT logs or device details):

  '0xYOUR_DEVICE_IEEE_ADDRESS': # Replace with your device's IEEE address
    friendly_name: Your Smart Plug Name # Give your device a friendly name
    model: TS011F
    vendor: _TZ3000_yujkcrehbz # Replace with your vendor name from device details
    description: Your smart plug description
    extend:  # This section tells Zigbee2MQTT how to handle the device
      - tuya.modernExtend.tuyaOnOff({
          electricalMeasurements: true,
          powerOutageMemory: (manufacturerName) => manufacturerName !== "_TZ3000_cicwjqth",
          indicatorMode: (manufacturerName) => manufacturerName !== "_TZ3000_ww6drja5",
          childLock: (manufacturerName) => manufacturerName !== "_TZ3000_cicwjqth",
          onOffCountdown: (manufacturerName) => manufacturerName !== "_TZ3000_cicwjqth",
      }),

This tells Zigbee2MQTT to treat your device as a TS011F and include the countdown feature. This method allows you to use the latest Zigbee2MQTT version while restoring the lost functionality. Be sure to replace the placeholder values with your device's actual information.

3. Custom Converter (Most Involved, but Potentially Most Flexible)

For those with more technical expertise, a custom converter offers the most flexibility. You would create a custom JavaScript file that defines how Zigbee2MQTT interacts with your device, including the countdown feature. This requires understanding the Zigbee protocol and the zigbee-herdsman-converters library. It's a more complex solution but offers the greatest control over your device's behavior.

4. Wait for an Official Fix/Submit an Issue

The most sustainable solution is to wait for the issue to be officially addressed in a future Zigbee2MQTT update. Consider the following:

  • Check for Updates: Regularly check for new Zigbee2MQTT updates. The developers are likely aware of the issue and may release a fix.
  • Submit an Issue: If the issue isn't already reported on the Zigbee2MQTT GitHub page, consider submitting a detailed issue report. This helps the developers understand the problem and prioritize a fix. Include the device model, Zigbee2MQTT version, and steps to reproduce the issue. Be sure to provide the device details from your database.db file (as in the original post).

Conclusion: Regaining Control of Your Smart Plugs

The loss of the countdown feature after a Zigbee2MQTT update can be frustrating, but understanding the cause allows for effective troubleshooting. By identifying the root problem (the missing onOffCountdown in the device definition) and using one of the solutions outlined above, you can restore functionality to your whitelabeled TS011F smart plugs and get your automations back on track. Whether you choose to revert to an older version, manually configure your device, or wait for an official fix, you have options to regain control of your smart home.

Remember to back up your Zigbee2MQTT configuration before making any significant changes. Also, always keep your home automation software up-to-date for the best experience and security. Happy automating, guys!