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
752 stars 688 forks source link

[BUG] E1812 Ikea shortcut button does not fire zha_event #1516

Closed bwims closed 2 years ago

bwims commented 2 years ago

Describe the bug I have an E1812 Ikea shortcut button that uses the quirk, but does not fire zha_event, even though it appears to be using the quirk.

To Reproduce Steps to reproduce the behavior:

  1. Pair button with Sonoff ZHA Bridge
  2. Listen for zha_event
  3. Press button
  4. no events occur

Expected behavior to see a zha_event

Screenshots If applicable, add screenshots to help explain your problem.

Device signature - this can be acquired by clicking on the "Zigbee Device Signature" button in the device settings ``` Paste the device signature here. { "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=4476, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x0820", "in_clusters": [ "0x0000", "0x0001", "0x0003", "0x0009", "0x0020", "0x1000" ], "out_clusters": [ "0x0003", "0x0004", "0x0006", "0x0008", "0x0019", "0x0102", "0x1000" ] } }, "manufacturer": "IKEA of Sweden", "model": "TRADFRI SHORTCUT Button", "class": "zhaquirks.ikea.shortcutbtn.IkeaTradfriShortcutBtn"
Diagnostic information - this can be acquired by clicking on the "Download Diagnostics" button in the device settings ``` There was no diagnostics download button. ```
Additional logs ``` Paste any additional debug logs here. ```

Additional context I am a relative newcomer to homeassistant, so apologies if I didn't include something I should have!

Thanks!

MattWestb commented 2 years ago

My "Shorty" is making nice events in ZHA (its running latest production firmware):

{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "ec:1b:bd:ff:fe:d0:9f:82",
        "unique_id": "ec:1b:bd:ff:fe:d0:9f:82:1:0x0006",
        "device_id": "db02546a32aba15feb91376606f27e3c",
        "endpoint_id": 1,
        "cluster_id": 6,
        "command": "on",
        "args": [],
        "params": {}
    },

Can you downloading the diagnostic from your coordinator or some other device ??

Witch version of HA is you running ? We was having problems with some light controllers (most IKEA ones) after some large changes in ZHA and need the lasts bug fix for working OK.

Also do you have installing come old custom components or old custom quirks that can being broken after HA 2022.4.0 ?

bwims commented 2 years ago

Hi thanks for responding.

I don't have any diagnostics buttons on any of my zha devices. Is there something else I need to install to enable them?

Is your "Shorty" a quirk file? How do I install it please? (Sorry to be such a noob!)

I'm running HA 2022.3.5 - I'm too new to the game for custom anything :-)

Thanks again!

dmulcahey commented 2 years ago

Hi thanks for responding.

I don't have any diagnostics buttons on any of my zha devices. Is there something else I need to install to enable them?

Is your "Shorty" a quirk file? How do I install it please? (Sorry to be such a noob!)

I'm running HA 2022.3.5 - I'm too new to the game for custom anything :-)

Thanks again!

Update to the latest HA to get diagnostics

bwims commented 2 years ago

Hi,

I've looked at the homeassistant release notes, and cannot find which version introduced the diagnostics button. Which version was it?

Thanks!

bwims commented 2 years ago

Further to my last, it says here

The Diagnostics integration was introduced in Home Assistant 2022.2

And here a release bulletin of 2022.2, there is a screenshot of the download diagnostics button

But I am running 2022.3.5, so why do I need to upgrade?

Should I be logging this as a separate issue with the homassistant team?

dmulcahey commented 2 years ago

Support for it is by intend we just added it in the last release for ZHA. Why waste time arguing with the person who wrote the feature 🤦🏻‍♂️Upgrade to the latest release and it will be there.

bwims commented 2 years ago

Sorry, didn't mean to argue, just to understand how it hangs together. I have been digging around and I see that the integrations get updated at different times, because the MQTT integration was showing the download button.

I will do the upgrade, never fear!

(It is a pity that the integrations for HA don't have individual version numbers. )

Thanks!

MattWestb commented 2 years ago

@bwims Is you using Z2M or ZHA for your Zigbee devices is HA ?

bwims commented 2 years ago

Oops!

I guess I should have mentioned that I am running HA from a Docker container. I just pulled the latest, and it still says 2022.3.5 and there is still not a diagnostics download button.

@MattWestb just saw your question... I did put ZHA in the bug description. I didn't think I could use anything else on a Sonoff Zbbridge?

dmulcahey commented 2 years ago

The latest is 2022.4.6

dmulcahey commented 2 years ago

https://www.home-assistant.io/blog/2022/04/06/release-20224/#release-202243---april-12

2022.4.3 on April 12th is when diagnostics was added to ZHA

bwims commented 2 years ago

aha. I was using the "latest" tag in the naive belief that it would be the latest version! I can specify that version so I will do that now.

Thanks!

MattWestb commented 2 years ago

If you running containerized HA you need stooping the HA container and removing the HA container. Then puling the latest HA and then doing one new HA with the parameters you was using setting up the original HA container in docker. You must doing all by hand then you is nut running supervised HA that is doing all for you.

Edit: Latest tagged is the latest ( 2022.4.6) but you must getting docker using the latest and not the version you was using then installing HA.

bwims commented 2 years ago

Success!

Here are my diagnostics: { "home_assistant": { "installation_type": "Home Assistant Container", "version": "2022.4.6", "dev": false, "hassio": false, "virtualenv": false, "python_version": "3.9.9", "docker": true, "arch": "aarch64", "timezone": "Europe/London", "os_name": "Linux", "os_version": "5.10.103-v8+", "run_as_root": true }, "custom_components": { "simpleicons": { "version": "v2.0.0", "requirements": [ "simpleicons==6.16.0" ] }, "hacs": { "version": "1.24.2", "requirements": [ "aiogithubapi>=21.11.0" ] }, "nodered": { "version": "1.0.6", "requirements": [] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/zha", "requirements": [ "bellows==0.29.0", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.72", "zigpy-deconz==0.14.0", "zigpy==0.44.2", "zigpy-xbee==0.14.0", "zigpy-zigate==0.7.4", "zigpy-znp==0.7.0" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "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": "10C4", "pid": "8B34", "description": "*bv 2010/10*", "known_devices": [ "Bitron Video AV2010/10" ] } ], "codeowners": [ "@dmulcahey", "@adminiuga" ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" } ], "after_dependencies": [ "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": 24029, "manufacturer": "IKEA of Sweden", "model": "TRADFRI SHORTCUT Button", "name": "IKEA of Sweden TRADFRI SHORTCUT Button", "quirk_applied": true, "quirk_class": "zhaquirks.ikea.shortcutbtn.IkeaTradfriShortcutBtn", "manufacturer_code": 4476, "power_source": "Battery or Unknown", "lqi": null, "rssi": null, "last_seen": "2022-04-22T13:44:37", "available": true, "device_type": "EndDevice", "signature": { "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4476, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x0820", "in_clusters": [ "0x0000", "0x0001", "0x0003", "0x0009", "0x0020", "0x1000" ], "out_clusters": [ "0x0003", "0x0004", "0x0006", "0x0008", "0x0019", "0x0102", "0x1000" ] } } }, "entities": [ { "entity_id": "sensor.ikea_of_sweden_tradfri_shortcut_button_3c262efe_power", "name": "IKEA of Sweden TRADFRI SHORTCUT Button" }, { "entity_id": "button.ikea_of_sweden_tradfri_shortcut_button_3c262efe_identify", "name": "IKEA of Sweden TRADFRI SHORTCUT Button" } ], "neighbors": [], "endpoint_names": [ { "name": "NON_COLOR_CONTROLLER" } ], "user_given_name": "Shortcut button", "device_reg_id": "c5f1887fc063fd2f36a9283c22a6a7e1", "area_id": null } }

Sorry to have taken so long to get here!

Thanks!

bwims commented 2 years ago

@MattWestb

My "Shorty" is making nice events in ZHA (its running latest production firmware):

{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "ec:1b:bd:ff:fe:d0:9f:82",
        "unique_id": "ec:1b:bd:ff:fe:d0:9f:82:1:0x0006",
        "device_id": "db02546a32aba15feb91376606f27e3c",
        "endpoint_id": 1,
        "cluster_id": 6,
        "command": "on",
        "args": [],
        "params": {}
    },

Can you downloading the diagnostic from your coordinator or some other device ??

Witch version of HA is you running ? We was having problems with some light controllers (most IKEA ones) after some large changes in ZHA and need the lasts bug fix for working OK.

Also do you have installing come old custom components or old custom quirks that can being broken after HA 2022.4.0 ?

What is the "shorty" please? Does it go in the config.yaml file?

Thanks!

bwims commented 2 years ago

Well, I feel foolish. I see now that whatever "shorty" is, the result is like listening for an event in developer tools.

Another reason for foolish is that the Ikea button now works! I had been using the node-red-contrib-home-assistant-websocket to listen for events and had not noticed that the upgrade had somehow disconnected the nodes. After updating the configuration node, I found that the button now produces zha_events.

Pushing the button momentarily produces the command "on" and holding the button produces the command "move_with_on_off" and upon releasing it produces "stop_with_on_off"

So, I'm sorry if I have wasted your time, but I would not have learned about needing a special container update for HA otherwise.

My one last comment is that it seems a shame that there is no easy method of knowing when a particular integration has been updated within HA.

If there is such a way, I'd be very grateful if you could let me know.

Otherwise, many thanks for being such a great help!

MattWestb commented 2 years ago

Sounds GREAT !!

I was baying one black Symphonisk controller and one Shortcut button and was naming them "Blacky" and "Shorty" so not easy knowing for you to knowing ;-))

ZHA have doing one very large update then many commands have being updated and producing more information and it was braking many devices automatons. I have fixing most device automation rules in IKEA quirks but some is not merged but is one PR is made for fixing the last ones.

You shall having more commands sent from the device like double pressing and you can finding them by looking for zha_events or using the device automatons from the device card and doing nice automatons :-)))

For releases its normally best looking on HA https://github.com/home-assistant/core/releases and then its links to ZHA and its components with its release notes (little kicking but you can finding all). HA version is easiest finding in configuration -> settings -> info.

The latest containered HA is showing if updates version and you can also making backup of the system data if you like. Sadly is no scipt for doing the update easy but i have making one text file for my test systems so i can using copy and pace and its being done in some minutes. If you have one Raspberry PI or one Linux machine you can installing supervised HA and only need kicking update and the system is doing it for you.

Great that you system is up and ruining with you devices working and glad to helping you !!

bwims commented 2 years ago

Even more useful information! Many thanks!