Zigbee temperature sensor & switch only detected as "light"

Hello! I have the end device TS000F from Mhcozy here. Device pairs with my ZHA integration. But it is detected only as light - what is obviously the switch of this device.

However, the TS000F also is a temperature sensor. This is the diagnostics file of the device:

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2024.7.2",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.4",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Vienna",
    "os_name": "Linux",
    "os_version": "6.6.33-haos",
    "supervisor": "2024.06.2",
    "host_os": "Home Assistant OS 12.4",
    "docker_version": "26.1.4",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "awattar_energy_cost": {
      "documentation": "https://github.com/TheBrain8791/ha_awattar",
      "version": "0.1.0",
      "requirements": [
        "bs4"
      ]
    },
    "smartlife": {
      "documentation": "https://www.home-assistant.io/integrations/smartlife",
      "version": "0.1.0",
      "requirements": [
        "tuya-device-sharing-sdk==0.2.0"
      ]
    },
    "hacs": {
      "documentation": "https://hacs.xyz/docs/configuration/start",
      "version": "1.34.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "localtuya": {
      "documentation": "https://github.com/rospogrigio/localtuya/",
      "version": "5.2.1",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "zha",
    "name": "Zigbee Home Automation",
    "after_dependencies": [
      "onboarding",
      "usb"
    ],
    "codeowners": [
      "dmulcahey",
      "adminiuga",
      "puddly",
      "TheJulianJES"
    ],
    "config_flow": true,
    "dependencies": [
      "file_upload"
    ],
    "documentation": "https://www.home-assistant.io/integrations/zha",
    "iot_class": "local_polling",
    "loggers": [
      "aiosqlite",
      "bellows",
      "crccheck",
      "pure_pcapy3",
      "zhaquirks",
      "zigpy",
      "zigpy_deconz",
      "zigpy_xbee",
      "zigpy_zigate",
      "zigpy_znp",
      "universal_silabs_flasher"
    ],
    "requirements": [
      "bellows==0.39.1",
      "pyserial==3.5",
      "zha-quirks==0.0.117",
      "zigpy-deconz==0.23.2",
      "zigpy==0.64.1",
      "zigpy-xbee==0.20.1",
      "zigpy-zigate==0.12.1",
      "zigpy-znp==0.12.2",
      "universal-silabs-flasher==0.0.20",
      "pyserial-asyncio-fast==0.11"
    ],
    "usb": [
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*2652*",
        "known_devices": [
          "slae.sh cc2652rb stick"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*slzb-07*",
        "known_devices": [
          "smlight slzb-07"
        ]
      },
      {
        "vid": "1A86",
        "pid": "55D4",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus v2"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*zigstar*",
        "known_devices": [
          "ZigStar Coordinators"
        ]
      },
      {
        "vid": "1CF1",
        "pid": "0030",
        "description": "*conbee*",
        "known_devices": [
          "Conbee II"
        ]
      },
      {
        "vid": "0403",
        "pid": "6015",
        "description": "*conbee*",
        "known_devices": [
          "Conbee III"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8A2A",
        "description": "*zigbee*",
        "known_devices": [
          "Nortek HUSBZB-1"
        ]
      },
      {
        "vid": "0403",
        "pid": "6015",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate+"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8B34",
        "description": "*bv 2010/10*",
        "known_devices": [
          "Bitron Video AV2010/10"
        ]
      }
    ],
    "zeroconf": [
      {
        "type": "_esphomelib._tcp.local.",
        "name": "tube*"
      },
      {
        "type": "_zigate-zigbee-gateway._tcp.local.",
        "name": "*zigate*"
      },
      {
        "type": "_zigstar_gw._tcp.local.",
        "name": "*zigstar*"
      },
      {
        "type": "_uzg-01._tcp.local.",
        "name": "uzg-01*"
      },
      {
        "type": "_slzb-06._tcp.local.",
        "name": "slzb-06*"
      },
      {
        "type": "_xzg._tcp.local.",
        "name": "xzg*"
      },
      {
        "type": "_czc._tcp.local.",
        "name": "czc*"
      }
    ],
    "is_built_in": true
  },
  "setup_times": {
    "null": {
      "setup": 5.867995787411928e-05
    },
    "01J1YJKYR9QZYJ7ZKE1TH4GE2V": {
      "config_entry_setup": 5.045233323937282
    }
  },
  "data": {
    "ieee": "**REDACTED**",
    "nwk": 49786,
    "manufacturer": "_TZ3218_7fiyo3kv",
    "model": "TS000F",
    "name": "_TZ3218_7fiyo3kv TS000F",
    "quirk_applied": false,
    "quirk_class": "zigpy.device.Device",
    "quirk_id": null,
    "manufacturer_code": 4417,
    "power_source": "Mains",
    "lqi": 248,
    "rssi": -81,
    "last_seen": "2024-07-12T15:22:44",
    "available": true,
    "device_type": "Router",
    "signature": {
      "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.FullFunctionDevice|MainsPowered|RxOnWhenIdle|AllocateAddress: 142>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)",
      "endpoints": {
        "1": {
          "profile_id": "0x0104",
          "device_type": "0x0100",
          "input_clusters": [
            "0x0000",
            "0x0003",
            "0x0004",
            "0x0005",
            "0x0006",
            "0xe000",
            "0xe001",
            "0xef00"
          ],
          "output_clusters": [
            "0x000a",
            "0x0019"
          ]
        },
        "242": {
          "profile_id": "0xa1e0",
          "device_type": "0x0061",
          "input_clusters": [],
          "output_clusters": [
            "0x0021"
          ]
        }
      },
      "manufacturer": "_TZ3218_7fiyo3kv",
      "model": "TS000F"
    },
    "active_coordinator": false,
    "entities": [
      {
        "entity_id": "button.temperatur_pool_zigbee_identifizieren",
        "name": "_TZ3218_7fiyo3kv TS000F"
      },
      {
        "entity_id": "light.temperatur_pool_zigbee_licht",
        "name": "_TZ3218_7fiyo3kv TS000F"
      },
      {
        "entity_id": "sensor.tz3218_7fiyo3kv_ts000f_rssi",
        "name": "_TZ3218_7fiyo3kv TS000F"
      },
      {
        "entity_id": "sensor.tz3218_7fiyo3kv_ts000f_lqi",
        "name": "_TZ3218_7fiyo3kv TS000F"
      },
      {
        "entity_id": "update.temperatur_pool_zigbee_firmware",
        "name": "_TZ3218_7fiyo3kv TS000F"
      }
    ],
    "neighbors": [],
    "routes": [],
    "endpoint_names": [
      {
        "name": "ON_OFF_LIGHT"
      },
      {
        "name": "PROXY_BASIC"
      }
    ],
    "user_given_name": "temperatur.pool.zigbee",
    "device_reg_id": "e812a5bb22800e1fe3778c8774ae8d40",
    "area_id": "terrasse",
    "cluster_details": {
      "1": {
        "device_type": {
          "name": "ON_OFF_LIGHT",
          "id": 256
        },
        "profile_id": 260,
        "in_clusters": {
          "0x0000": {
            "endpoint_attribute": "basic",
            "attributes": {
              "0x0004": {
                "attribute_name": "manufacturer",
                "value": "_TZ3218_7fiyo3kv"
              },
              "0x0005": {
                "attribute_name": "model",
                "value": "TS000F"
              }
            },
            "unsupported_attributes": {}
          },
          "0x0003": {
            "endpoint_attribute": "identify",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0004": {
            "endpoint_attribute": "groups",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0005": {
            "endpoint_attribute": "scenes",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0006": {
            "endpoint_attribute": "on_off",
            "attributes": {
              "0x0000": {
                "attribute_name": "on_off",
                "value": 0
              }
            },
            "unsupported_attributes": {
              "0x4003": {
                "attribute_name": "start_up_on_off"
              }
            }
          },
          "0xe001": {
            "endpoint_attribute": null,
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0xe000": {
            "endpoint_attribute": null,
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0xef00": {
            "endpoint_attribute": null,
            "attributes": {},
            "unsupported_attributes": {}
          }
        },
        "out_clusters": {
          "0x000a": {
            "endpoint_attribute": "time",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0019": {
            "endpoint_attribute": "ota",
            "attributes": {
              "0x0002": {
                "attribute_name": "current_file_version",
                "value": 80
              }
            },
            "unsupported_attributes": {}
          }
        }
      },
      "242": {
        "device_type": {
          "name": "PROXY_BASIC",
          "id": 97
        },
        "profile_id": 41440,
        "in_clusters": {},
        "out_clusters": {
          "0x0021": {
            "endpoint_attribute": "green_power",
            "attributes": {},
            "unsupported_attributes": {}
          }
        }
      }
    }
  }
}

Any idea how I can get the temperature sensor entity?

Ditto… same prob… is yours mains powered or via the 5v input?

It is mains powered.

I think, the device is simply not supported, at least not in ZHA. Maybe someone could test it with Zigbee2MQTT?

Some new products will need a custom ZHA Device Handler (also known as a quirk) so first submit a device feature request issue if there is not already one already:

Also read:

Im on ZHA… shame I was on Z2M but migrated back to ZHA last year… fingers crossed, in the fullness of time, it will become submitted. In the meantime, mine started smoking so has been returned pending a replacement…

Did this device get submitted yet by someone? IS there any benefit from multiple submissions? I too am working this issue and had too many issues with Z2M and migrated to ZHA.

Any manual method of addition anyone knows about via YAML?

I had the same problem so I wrote a quirk which seems to work for me. Feel free to give it a go. I only have a temperature sensor so I didn’t add the humidity stuff, but that would be fairly easy to do.

3 Likes

I should have added that if anyone wants to extend this quirk, the dp values for the device have been helpfully decoded here. TL;DR:
{
“1”: “Switch 1”,
“7”: “Timer 1”,
“14”: “Restart Status”,
“19”: “Delay-off Schedule”,
“101”: “Work Mode”,
“102”: “Temp Current”,
“103”: “Humidity Value”,
“104”: “Maxhum Set”,
“105”: “Minihum Set”,
“106”: “Upper Temp”,
“107”: “Lower Temp”,
“108”: “Temp Correction”,
“109”: “Humidity Calibration”,
“110”: “Fault State”,
“111”: “Child Lock”,
“112”: “Hum Sensitivity”,
“113”: “Temp Sensitivity”,
“114”: “Alarm”,
“115”: “sensor_dect”,
“116”: “CF”,
“119”: “switch_auto_1”,
“121”: “温度告警”,
“122”: “湿度告警”,
“123”: “告警开关”
}

2 Likes

Thank you @klib
Was able to get his working !
image|485x116

Appreciate you helping the community

If
121 translates to “temperature alarm”
122 translates to “humidity alarm”
123 translates to “alarm switch”
Which are pertinent values to monitor and base automations from, this being my first adventure into custom quirks, Is this the appropriate area of .py to add these in?

dp_to_attribute: dict[int, DPToAttributeMapping] = {
    102: DPToAttributeMapping(
        TuyaTemperatureMeasurement.ep_attribute,
        "measured_value",
        converter=lambda x: x * 10,  # decidegree to centidegree
    ),
}

If so, how do I ensure I am using the correct attribute name for the value I want to monitor? IE: the TuyaTemperatureMeasurement information is difficult to interpret as I feel this is device specific and the data I put here critical to getting a good result.

Basically, looking for references for how to add known manufacturer dp values to HA via this custom quick function.

Thanks!

Thanks for the quirk. Would it be possible to adapt it to support this other product?

According to the documentation it is the same, but it has 4 gang

Thanks

Glad the quirk worked for you. As for the 121,122 and 123 dps, these are not documented, and frankly I’m not sure it is worth the effort to reverse engineer what they do and how they work. What do you want an alarm for? If it is just to trigger something when the temperature crosses a threshold, you can easily do that with an automation. You’ll need to write an automation anyway to respond to the alarm, so I don’t know that the native alarming on the device gets you much. Plus, with automation based alarms, you can create multiple thresholds (e.g. one for under temperature and one for over-temperature). It is much more flexible and legible to do it that way.

2 Likes

I don’t have that device so I can’t help you, but the general procedure that I use is the following:

  1. Register the device with HA
  2. Go to the device info page in HA and select the “download diagnostics” option.
  3. Inspect the endpoints and clusters that the device is reporting, and modify the signature of the quirk so that it matches.
  4. Implement support for the endpoints and clusters in the “replacement” section of your quirk. If your device is identical apart from the number of gangs, you should be able to reuse most of my quirk apart from the parts that control the switches.
  5. Put the quirk in your custom quirks folder, restart HA and then check (on the Device Info page) whether the quirk has registered with your device. If it hasn’t, you need to work on the signature as something isn’t matching. If it has but the device is not behaving as expected, then your signature is fine but you need to fix something in your replacement section, and if all is well, then time to celebrate!
1 Like

Totally did this. Love automations in HA.

Only thing I am seeing so far with this sensor/switch combo is either a problem with the sensor or my actual freezer itself. I plan to clean the coils this weekend but just throwing it our here in case others are seeing this on their history. Ill add a pic but slow sharktooth-like gains back to 0 F then back down again.

@klib Nice, if possible and not already done so please submit your quirk for “_TZ3218_7fiyo3kv TS000F” as a patch via a pull request to the zha-device-handlers repository on GitHub for review and merger - GitHub - zigpy/zha-device-handlers: ZHA device handlers bridge the functionality gap created when manufacturers deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices.

FYI, I still can not see that someone even submitted a device support request for “_TZ3218_7fiyo3kv TS000F” as of yet → Issues · zigpy/zha-device-handlers · GitHub

…and ZHA users complain that it doesn’t get device handlers/converters as quick as Zigbee2MQTT :man_facepalming:

If users do not bother to submit device support requests with diagnostics/logs then how are community developers of ZHA Device Handlers even suppose to know that the devices need quirks if they do not just so happen to own the very same device themselves? → Guess it is too much for users request support for it here to also submit device support requests for it there too or? → https://www.home-assistant.io/integrations/zha#how-to-add-support-for-new-and-unsupported-devices

image

Thanks for the instructions. It seems simple but my knowledge is small. Now I have another problem, it broke and I have to order another one. I don’t think it is very reliable, I was always feeding it at 5V to protect it and it was of no use. .

Thanks for this. I have added to HA, and the device is using the custom quirk, but is still not displaying the temperature. It is definately measuring it (the 2380 value is 23.8 deg, and increases as temp increases), but states it is an unsupported attribute:

   "0xe000": {
        "endpoint_attribute": "tuya_manufacturer_specific_57344",
        "attributes": {},
        "unsupported_attributes": {}
      },
      "0xe001": {
        "endpoint_attribute": "tuya_external_switch_type",
        "attributes": {},
        "unsupported_attributes": {}
      },
      "0xef00": {
        "endpoint_attribute": "tuya_manufacturer",
        "attributes": {},
        "unsupported_attributes": {}
      },
      "0x0402": {
        "endpoint_attribute": "temperature",
        "attributes": {
          "0x0000": {
            "attribute_name": "measured_value",
            "value": 2380
          }
        },
        "unsupported_attributes": {
          "0x0000": {
            "attribute_name": "measured_value"
          }

Not sure if the code needs tweaking, but don’t really know where to start…

That’s odd. I’ve had a look and I get exactly the same report regarding attributes, except in my case it also flows through as a valid entity in HA. Try removing the device and re-adding it in case something went wrong with registration. I must admit I’m a bit hazy on how the binding between HA and ZHA entities is made, and what things can go wrong in the process.

1 Like

Hi could someone tell me how to update “Zigbee Device Handlers” or point me in the best direction as I bought the same TZ3218_7fiyo3kv only for the temperature sensor and it only reports light switch

regards

Editing your configuration.yaml file.

On your Home Assistant instance click file editor.
Click the folder button (“Browse Filesystem”)
Select configuration.yaml, and then click in the text editor to close the filesystem.
Paste the following into the open configuration.yaml:

zha:
custom_quirks_path: /config/zha_quirks/

Click the “Save” icon.Click the folder button (“Browse Filesystem”)

Installing the quirk files.

In another browser tab go to:

Click the download icon (“Download raw file”)

Go back to your Home Assistant instance, and the file editor.
Click the folder button again.
Click the new folder icon and create a folder called zha_quirks
Click the new folder.
Click the upload file button, then click the file button.
Browse to your downloaded candeo_smart_irrigation_timer.py file, and select it.

Click ok in the upload file box, and you’re done.
The last step is to reboot your HA

Quirk functions

This quirk will add Temperature functionality to the TS000F

Hope this helps someone.