Closed erkr closed 11 months ago
Update: the total usage (kWh) readout is a factor 100 to high.
Current by a factor 1000. Power factor unknown. No idea if it is actually supported. The type could be switch instead of light (detail).
Update: I managed to make a custom quirk myself. The first time, so not sure it is according to all the rules: Fixes:
This gist contains the latest version of my custom quirk: https://gist.github.com/erkr/5d4addf1b4c8e18d68d2adb154c6be93
Maybe one of the active contributors ( @TheJulianJES @dmulcahey ) can have a look to decide if my quirk can be adopted into the official tuya list?! For me, it works. Some open ends:
Best Eric
Yep, quirk looks mostly good to me. Power factor entity shouldn't be created, as it's not supported, but it's a minor issue in ZHA for all power monitoring devices at the moment (and nothing that can/should be fixed in a quirk).
0x1888
is in the replacement
, as it's outside the manufacturer specific cluster range)configuration.yaml
: https://www.home-assistant.io/integrations/zha/#modifying-the-device-type (IEEE + "-" + endpoint)Z2M additionally exposes switch type for this device and that is still missing here
That seems to be attribute 0xD030
on cluster 0xE001
. Try including TuyaZBExternalSwitchTypeCluster
in the replacement
and use the "Manage Zigbee device" dialog to check if writing that attribute (on that cluster) works.
(The device likely just doesn't advertise having that cluster for some reason.)
Thanks for reviewing my first custom quirk. Good feedback 🙏
The option to change the device type in configuration.yaml is new to me. Will use that to remove my custom quirk without breaking my statistics 😊
I will try to add TuyaZBExternalSwitchTypeCluster and report back if that works later this week👌
Best Eric
@TheJulianJES
I added TuyaZBExternalSwitchTypeCluster
and tried to write 1
into attribute 0xD030
. Although that command doesn't give an error (green checkmark in the button), reading it back reports `none'. Guess it is not working and removed the cluster.
PS: Will my device also be part of 2023.10.x? (as it is not a TS0011 plug)?!
@erkr hola, and thank you for supporting the community and your ZHA contributions! I tried your custom quirk (...because I'm "lucky" to have same TZ3000_xkap8wtb as a pilot for in-line power meters I want to install for few circuits) but it either didn't pick up or mine didn't work. I still see ridiculous number of A in current and RMS is out of whack. Likely I didn't do something simple.
Anyways, do you plan doing a Pull Request to zigpy:dev
similar to e.g. this one? If not, I can take over from you and tinker with it...
Once again, huge thanks for your support! Looking forward to see your quirk working in main branch!
@arsenyspb Thanks for trying my custom quirk. Those ridiculous values sound like the quirk is not really used (I guess you checked that) I won't deliver the quirk to dev, as I lack the experience how to do that. So if you take that over from me would be great! Please take the remark from Julian into account with respect to changing the device type (I changed it into a switch, Julian prefered to keep the original light type) I hope it works for you as well!! Success. Eric
@erkr @TheJulianJES OK I think I've got it working, finally see sane numbers... As a reminder one needs to also delete wrong metrics' history (see here):
apk add sqlite
cd /config/
sqlite3 home-assistant_v2.db
now
sqlite> select * from states where metadata_id = (select metadata_id from states_meta where entity_id = 'sensor.<your_sensor_name_here>_summation_delivered');
sqlite> select * from states where metadata_id = (select metadata_id from states_meta where entity_id = 'sensor.<your_sensor_name_here>_rms_current');
This outputs the mad readings for power and Amps. Next, clean them up:
sqlite> delete from states where metadata_id = (select metadata_id from states_meta where entity_id = 'sensor.<your_sensor_name_here>_summation_delivered');
sqlite> delete from states where metadata_id = (select metadata_id from states_meta where entity_id = 'sensor.<your_sensor_name_here>_rms_current');
Profit.
@arsenyspb Great, thanks for organising a delivery. I think when the review remarks are processed it's ready to rock and roll 🤓
Nice it works for you as well😊
@arsenyspb It reached the 2023.10.4 release. Removed my custom version and it works great with the released one. Thx.
I'm a bit confused, because from what I understand this fix made it into the 2023.10.4 release. However, I'm on 2024.8.0 and I have the same exact same symptoms with the Ts000f, namely current off by 1000 and energy used off by 100. Has this regressed or is there something I need to do to activate the fix?
@klibro Delete the device, restart HA and re-pairing can help. It should be using this quirk (device info -> zigbee info):
zhaquirks.tuya.ts000f_switch.Tuya_1G_Wall_Switch_Metering
No regression seen
Yes, I realise that the quirk is part of the distribution and should be being picked up. The reported model is definitely TS000F, and that should be enough to trigger the quirk, shouldn't it? Other quirks for other ZHA devices I have are being picked up. I'm also successfully applying a custom quirk. I have tried copying the distribution quirk and putting it into my custom quirk directory, but still this is not being picked up after a restart. I have just installed two TS000F devices, so although I can believe one might have glitched, for two not to work seems like it is a deeper issue. Is there some way to troubleshoot why quirks don't get applied?
I figured this out. The quirk in the release specifies a signature with endpoints 1 and 242, but upon inspecting my device, I found that it was only reporting a signature with the "1" endpoint. So the signature wasn't matching and hence the quirk wasn't being applied. I copied the release quirk into my custom quirks directory and removed the 242 endpoint from the signature and also from the replacement (is that right?) and all seems to be working as expected now.
Problem description
I have a zigbee 3.0 wall switch with power monitoring. Switching and power readout work fine. The current readout is a factor 1000 to high though. Not sure if the usage readout is correct. Will report on that later.
Solution description
I guess a quirk can translate the reading to the right value. I hope someone can help to create a custom quirk I can use to test/modify till it is correct.
Screenshots/Video
Screenshots/Video
This is the switch readout with a 40 watt bulb:Device signature
Device signature
```json { "node_descriptor": "NodeDescriptor(logical_type=Diagnostic information
Diagnostic information
```json { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.6.3", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.11.4", "docker": true, "arch": "aarch64", "timezone": "Europe/Amsterdam", "os_name": "Linux", "os_version": "6.1.21-v8", "supervisor": "2023.06.4", "host_os": "Home Assistant OS 10.3", "docker_version": "23.0.6", "chassis": "embedded", "run_as_root": true }, "custom_components": { "hacs": { "version": "1.32.1", "requirements": [ "aiogithubapi>=22.10.1" ] }, "pyscript": { "version": "1.4.0", "requirements": [ "croniter==1.3.8", "watchdog==2.2.1" ] }, "smartthinq_sensors": { "version": "0.31.8", "requirements": [ "pycountry>=20.7.3", "xmltodict>=0.12.0", "charset_normalizer>=2.0.0" ] }, "zha_toolkit": { "version": "v0.8.40", "requirements": [ "packaging>=20.8", "pytz" ] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "after_dependencies": [ "onboarding", "usb" ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly" ], "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" ], "requirements": [ "bellows==0.35.5", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.100", "zigpy-deconz==0.21.0", "zigpy==0.55.0", "zigpy-xbee==0.18.0", "zigpy-zigate==0.11.0", "zigpy-znp==0.11.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" ] } ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" }, { "type": "_zigstar_gw._tcp.local.", "name": "*zigstar*" }, { "type": "_slzb-06._tcp.local.", "name": "slzb-06*" } ], "is_built_in": true }, "data": { "ieee": "**REDACTED**", "nwk": 39735, "manufacturer": "_TZ3000_xkap8wtb", "model": "TS000F", "name": "_TZ3000_xkap8wtb TS000F", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4107, "power_source": "Mains", "lqi": 252, "rssi": -83, "last_seen": "2023-06-29T16:14:02", "available": true, "device_type": "Router", "signature": { "node_descriptor": "NodeDescriptor(logical_type=Logs
Logs
NaCustom quirk
Custom quirk
NaW
Additional information
No response