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.
Apache License 2.0
724 stars 671 forks source link

[Device Support Request] TZ3000_xkap8wtb #1904

Closed KaherdinTristan closed 1 year ago

KaherdinTristan commented 1 year ago

Is your feature request related to a problem? Please describe. The device; TZ3000_xkap8wtb, is reported under the domain "LIGHT". Also the device turns off if the signal to the associated mesh is too weak. The device is a wall switch WITH power metering.

Describe the solution you'd like The correct device description has already been created https://pullanswer.com/questions/tz3000_xkap8wtb-paired-as-ts0001#7107603

Device signature ```yaml { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=, *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": 260, "device_type": "0x0100", "in_clusters": [ "0x0000", "0x0003", "0x0004", "0x0005", "0x0006", "0x0702", "0x0b04", "0xe000", "0xe001" ], "out_clusters": [ "0x000a", "0x0019" ] } }, "manufacturer": "_TZ3000_xkap8wtb", "model": "TS0001", "class": "zhaquirks.tuya.ts000x.Switch_1G_Metering" } ```
Diagnostic information ```yaml { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2022.11.1", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.10.7", "docker": true, "arch": "aarch64", "timezone": "Europe/Stockholm", "os_name": "Linux", "os_version": "5.15.61-v8", "supervisor": "2022.10.2", "host_os": "Home Assistant OS 9.3", "docker_version": "20.10.18", "chassis": "embedded", "run_as_root": true }, "custom_components": { "fontawesome": { "version": "2.1.5", "requirements": [] }, "adaptive_lighting": { "version": "1.1.0", "requirements": [] }, "waste_collection_schedule": { "version": "1.27.0", "requirements": [ "icalendar", "recurring_ical_events", "icalevents", "bs4" ] }, "webrtc": { "version": "v2.3.1", "requirements": [] }, "mikrotik_router": { "version": "0.0.0", "requirements": [ "librouteros>=3.2.0", "mac-vendor-lookup>=0.1.12" ] }, "browser_mod": { "version": "2.1.2", "requirements": [] }, "zha_toolkit": { "version": "v0.8.23", "requirements": [ "packaging>=20.8" ] }, "hacs": { "version": "1.28.3", "requirements": [ "aiogithubapi>=22.2.4" ] }, "nordpool": { "version": "0.0.7", "requirements": [ "nordpool>=0.2" ] }, "swemail": { "version": "1.0.4", "requirements": [] }, "garbage_collection": { "version": "4.8.3", "requirements": [ "python-dateutil>=2.8.2" ] }, "wiz_light": { "version": "0.4.1", "requirements": [ "pywizlight==0.4.6" ] }, "eufy_security": { "version": "2.8.1", "requirements": [ "websocket-client==1.1.0" ] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/zha", "requirements": [ "bellows==0.34.2", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.84", "zigpy-deconz==0.19.0", "zigpy==0.51.5", "zigpy-xbee==0.16.2", "zigpy-zigate==0.10.3", "zigpy-znp==0.9.1" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "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": "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" ] } ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly" ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" }, { "type": "_zigstar_gw._tcp.local.", "name": "*zigstar*" } ], "dependencies": [ "file_upload" ], "after_dependencies": [ "onboarding", "usb", "zeroconf" ], "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp" ], "is_built_in": true }, "data": { "ieee": "**REDACTED**", "nwk": 20496, "manufacturer": "_TZ3000_xkap8wtb", "model": "TS0001", "name": "_TZ3000_xkap8wtb TS0001", "quirk_applied": true, "quirk_class": "zhaquirks.tuya.ts000x.Switch_1G_Metering", "manufacturer_code": 4417, "power_source": "Mains", "lqi": 87, "rssi": -83, "last_seen": "2022-11-07T18:17:16", "available": true, "device_type": "Router", "signature": { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=, *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": 260, "device_type": "0x0100", "in_clusters": [ "0x0000", "0x0003", "0x0004", "0x0005", "0x0006", "0x0702", "0x0b04", "0xe000", "0xe001" ], "out_clusters": [ "0x000a", "0x0019" ] } } }, "active_coordinator": false, "entities": [ { "entity_id": "button.tz3000_xkap8wtb_ts0001_identifybutton_2", "name": "_TZ3000_xkap8wtb TS0001" }, { "entity_id": "select.eluttag_diskmaskin_power_on_state", "name": "_TZ3000_xkap8wtb TS0001" }, { "entity_id": "sensor.eluttag_diskmaskin_current_power", "name": "_TZ3000_xkap8wtb TS0001" }, { "entity_id": "sensor.tz3000_xkap8wtb_ts0001_electricalmeasurementrmscurrent_2", "name": "_TZ3000_xkap8wtb TS0001" }, { "entity_id": "sensor.tz3000_xkap8wtb_ts0001_electricalmeasurementrmsvoltage_2", "name": "_TZ3000_xkap8wtb TS0001" }, { "entity_id": "sensor.tz3000_xkap8wtb_ts0001_electricalmeasurementpowerfactor_2", "name": "_TZ3000_xkap8wtb TS0001" }, { "entity_id": "switch.eluttag_diskmaskin", "name": "_TZ3000_xkap8wtb TS0001" } ], "neighbors": [ { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Parent", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x65DA", "permit_joining": "Unknown", "depth": "1", "lqi": "42" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0xD3C7", "permit_joining": "Unknown", "depth": "1", "lqi": "42" }, { "device_type": "Coordinator", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x0000", "permit_joining": "Unknown", "depth": "0", "lqi": "9" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x0C7F", "permit_joining": "Unknown", "depth": "1", "lqi": "54" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0xD21C", "permit_joining": "Unknown", "depth": "1", "lqi": "24" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x29DD", "permit_joining": "Unknown", "depth": "2", "lqi": "21" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0xE240", "permit_joining": "Unknown", "depth": "1", "lqi": "0" } ], "endpoint_names": [ { "name": "ON_OFF_LIGHT" } ], "user_given_name": "Eluttag diskmaskin", "device_reg_id": "aa41c247bc59f8390e1271ca5de671d4", "area_id": "kok", "cluster_details": { "1": { "device_type": { "name": "ON_OFF_LIGHT", "id": 256 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0001": { "attribute_name": "app_version", "value": 70 }, "0x0004": { "attribute_name": "manufacturer", "value": "_TZ3000_xkap8wtb" }, "0x0005": { "attribute_name": "model", "value": "TS0001" }, "0x0006": { "attribute_name": "date_code", "value": "" }, "0x0007": { "attribute_name": "power_source", "value": 1 }, "0xfffd": { "attribute_name": "cluster_revision", "value": 2 }, "0xfffe": { "attribute_name": "attr_reporting_status", "value": 0 } }, "unsupported_attributes": { "0x0012": { "attribute_name": "device_enabled" }, "0x0013": { "attribute_name": "alarm_mask" } } }, "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": 1 }, "0x4001": { "attribute_name": "on_time", "value": 0 }, "0x4002": { "attribute_name": "off_wait_time", "value": 0 }, "0x8001": { "attribute_name": "backlight_mode", "value": 1 }, "0x8002": { "attribute_name": "power_on_state", "value": 1 } }, "unsupported_attributes": { "0x4003": { "attribute_name": "start_up_on_off" }, "0x8004": { "attribute_name": "switch_mode" }, "0xfffe": { "attribute_name": "attr_reporting_status" } } }, "0x0702": { "endpoint_attribute": "smartenergy_metering", "attributes": { "0x0000": { "attribute_name": "current_summ_delivered", "value": 1581 }, "0x0200": { "attribute_name": "status", "value": 0 }, "0x0300": { "attribute_name": "unit_of_measure", "value": 0 }, "0x0303": { "attribute_name": "summation_formatting", "value": 0 }, "0x0306": { "attribute_name": "metering_device_type", "value": 0 } }, "unsupported_attributes": { "0x0400": { "attribute_name": "instantaneous_demand" }, "0x0301": { "attribute_name": "multiplier" }, "0x0302": { "attribute_name": "divisor" }, "0x0304": { "attribute_name": "demand_formatting" }, "0x0202": { "attribute_name": "hours_in_operation" }, "0x0206": { "attribute_name": "current_meter_id" } } }, "0x0b04": { "endpoint_attribute": "electrical_measurement", "attributes": { "0x0505": { "attribute_name": "rms_voltage", "value": 232 }, "0x0508": { "attribute_name": "rms_current", "value": 0 }, "0x050b": { "attribute_name": "active_power", "value": 0 } }, "unsupported_attributes": { "0x0300": { "attribute_name": "ac_frequency" }, "0x0601": { "attribute_name": "ac_voltage_divisor" }, "0x0302": { "attribute_name": "ac_frequency_max" }, "0x0603": { "attribute_name": "ac_current_divisor" }, "0x0602": { "attribute_name": "ac_current_multiplier" }, "0x0605": { "attribute_name": "ac_power_divisor" }, "0x0604": { "attribute_name": "ac_power_multiplier" }, "0x0507": { "attribute_name": "rms_voltage_max" }, "0x0600": { "attribute_name": "ac_voltage_multiplier" }, "0x0401": { "attribute_name": "ac_frequency_divisor" }, "0x050a": { "attribute_name": "rms_current_max" }, "0x0000": { "attribute_name": "measurement_type" }, "0x050d": { "attribute_name": "active_power_max" }, "0x0402": { "attribute_name": "power_multiplier" }, "0x050f": { "attribute_name": "apparent_power" }, "0x0400": { "attribute_name": "ac_frequency_multiplier" }, "0x0403": { "attribute_name": "power_divisor" } } }, "0xe000": { "endpoint_attribute": "tuya_is_pita_0", "attributes": {}, "unsupported_attributes": {} }, "0xe001": { "endpoint_attribute": "tuya_external_switch_type", "attributes": { "0xd030": { "attribute_name": "external_switch_type", "value": 0 } }, "unsupported_attributes": {} } }, "out_clusters": { "0x000a": { "endpoint_attribute": "time", "attributes": {}, "unsupported_attributes": {} }, "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} } } } } } } ```
Additional logs ``` const fz = require('zigbee-herdsman-converters/converters/fromZigbee'); const tz = require('zigbee-herdsman-converters/converters/toZigbee'); const exposes = require('zigbee-herdsman-converters/lib/exposes'); const reporting = require('zigbee-herdsman-converters/lib/reporting'); const extend = require('zigbee-herdsman-converters/lib/extend'); const ota = require('zigbee-herdsman-converters/lib/ota'); const tuya = require('zigbee-herdsman-converters/lib/tuya'); const e = exposes.presets; const ea = exposes.access; const definition = { fingerprint: [{modelID: 'TS0001', manufacturerName: '_TZ3000_xkap8wtb'}], model: 'TS0001_power', description: 'Relay with power monitoring', vendor: 'TuYa', fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report], toZigbee: [tz.on_off], configure: async (device, coordinatorEndpoint, logger) => { const endpoint = device.getEndpoint(1); await endpoint.read('genBasic', ['manufacturerName', 'zclVersion', 'appVersion', 'modelId', 'powerSource', 0xfffe]); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering']); await reporting.rmsVoltage(endpoint, {change: 5}); await reporting.rmsCurrent(endpoint, {change: 50}); await reporting.activePower(endpoint, {change: 10}); await reporting.currentSummDelivered(endpoint); endpoint.saveClusterAttributeKeyValue('haElectricalMeasurement', {acCurrentDivisor: 1000, acCurrentMultiplier: 1}); endpoint.saveClusterAttributeKeyValue('seMetering', {divisor: 100, multiplier: 1}); device.save(); }, exposes: [e.switch(), e.power(), e.current(), e.voltage().withAccess(ea.STATE)], }; module.exports = definition; save this as file next to configuration.yaml as ext_converter.js add it to configuration.yaml: external_converters: - ext_converter.js start z2m, check if issue is fixed```

Additional context

KaherdinTristan commented 1 year ago

I am not in any way shape or form accustomed to debugging zigbee devices, but I'll do my best to help out with anything, just as long as You help me with describing what I should do... I'm currently running HA on RPi4, and using a Conbee 2 as coordinator. I have a bunch of zigbee devices, and this (and one similar) is really bugging me out.

KaherdinTristan commented 1 year ago

This thread also talks about some sort of sollution https://github.com/Koenkk/zigbee2mqtt/discussions/14214?notification_referrer_id=NT_kwDOADPbwrI0NDg3MDAyMjU4OjMzOTg1OTQ#discussioncomment-3829787

javicalle commented 1 year ago

This thread also talks about some sort of sollution

The thread explains how update the device firmware. This can't be done in ZHA (not yet) and will require a Tuya gateway to update the firmware (if there is some firmware update available, I don't know).

There is a full discussion about that issue:

Reading above it seems that there is a design problem that with a firmware update may or may not be solved (this part is not clear to me).

In any case, it doesn't seem to be a problem that can be fixed with a quirk.

KaherdinTristan commented 1 year ago

The device defaults to domain LIGHT but it should default to domain SWITCH. I also think (haven't checked this entirely yet) that one or two "accumulated power consumption" 'entities'/reported values are wrong by a factor of 10.

manufacturer: _TZ3000_xkap8wtb,
model: TS0001
name: _TZ3000_xkap8wtb TS0001

image

KaherdinTristan commented 1 year ago

Has power metering. Is getting random "turned off" events. 2022-11-10_zha-e56ec98032982a689e88dc2163f8471d-_TZ3000_xkap8wtb TS0001-b1c9c9ad351532cfe672157b7eda0f36.json.txt

MattWestb commented 1 year ago

The same as the no power metering device plus if its getting to much voltage its shutting down it self for protecting the equipment. Also some is reporting zero in voltage in the voltage readings little now and then. Pleas config debut logging in (Z)HA and post the log part then you is getting the unwanted turned offs.

Can you posting the complete or the firs 6 numbers of the device IEEE (you finding it under device info on the device card) then im curious with chip tuya is using for this device.

KaherdinTristan commented 1 year ago

Device _TZ3000_xkap8wtb WITH power metering. Constantly turning off.

TS0001
by _TZ3000_rmjr4ufz
Connected via [Zigbee Coordinator](http://10.0.0.64:8123/config/devices/device/7b84426a50a9c164cf76c0b0f8c7f856)
Zigbee info
IEEE: a4:c1:38:dd:a5:6f:3d:07
Nwk: 0xd3c7
Device Type: Router
LQI: 223
RSSI: -66
Last Seen: 2022-11-10T15:58:12
Power Source: Mains
Quirk: zhaquirks.tuya.ts000x.Switch_1G_Metering
KaherdinTristan commented 1 year ago

Device _TZ3000_xkap8wtb WITH power metering Issue is right now that is turns off randomly.

image

18-30-46 ON home-assistant.log

Edited file here 18-30-46 ON home-assistant.log

KaherdinTristan commented 1 year ago

I have the latest update fw image

MattWestb commented 1 year ago

I think you is having one bad device that is having firmware problems. One issue that is converted to one discussion https://github.com/Koenkk/zigbee2mqtt/issues/11648 / https://github.com/Koenkk/zigbee2mqtt/discussions/13343 and all devices is having Telink chips.

You can testing if your device can being updated with the firmware in the issue but on own risk.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.