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
770 stars 702 forks source link

[BUG] Paulmann 501.34 Wall Switch (sw_build_id (id: 0x4000) 2.7.6_r25) cannot be used in HASSIO automations #2662

Closed drueppela closed 1 year ago

drueppela commented 1 year ago

References:

https://github.com/zigpy/zha-device-handlers/pull/1678#issuecomment-1771660070 https://community.home-assistant.io/t/paulmann-501-34-wall-switch/418414/7?u=ajd_ht https://de.paulmann.com/p/wandschalter-smart-home-zigbee-3.0-on-off-dimm-weiss/50134


Bug description

I paired

Paulmann 501.34 Wall Switch (Wandschalter Smart Home Zigbee 3.0 On/Off/Dimm Weiß)

image

with

Home Assistant 2023.10.3 Supervisor 2023.10.0 Operating System 11.0 Frontend 20231005.0 - latest

and

ZHA

I cannot find any possibility to integrate the Paulmann 501.34 Wall Switch in any automation.

I only find 1 device

image

with 4 entities

image

Steps to reproduce

  1. Pair Paulmann 501.34 Wall Switch (sw_build_id (id: 0x4000) 2.7.6_r25)
  2. Try to automate.

Expected behavior

  1. It should be possible to see two devices / switches
  2. The following events (a1, a0, b1, b0) should be exposed and should be used in automations image

Screenshots/Video

Screenshots/Video [Paste/upload your media here]

Device signature

Device signature ```json { "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=4644, 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": "0x0104", "device_type": "0x0001", "input_clusters": [ "0x0000", "0x0001", "0x0003", "0x0b05", "0x1000" ], "output_clusters": [ "0x0003", "0x0004", "0x0005", "0x0006", "0x0008", "0x0019", "0x0300", "0x1000" ] }, "2": { "profile_id": "0x0104", "device_type": "0x0001", "input_clusters": [ "0x0000", "0x0001", "0x0003", "0x0b05", "0x1000" ], "output_clusters": [ "0x0003", "0x0004", "0x0005", "0x0006", "0x0008", "0x0019", "0x0300", "0x1000" ] } }, "manufacturer": "Paulmann Licht GmbH", "model": "501.34", "class": "zigpy.device.Device" } ```

Diagnostic information

Diagnostic information ```json { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.10.3", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.11.5", "docker": true, "arch": "aarch64", "timezone": "Europe/Berlin", "os_name": "Linux", "os_version": "6.1.21-v8", "supervisor": "2023.10.0", "host_os": "Home Assistant OS 11.0", "docker_version": "24.0.6", "chassis": "embedded", "run_as_root": true }, "custom_components": { "hacs": { "version": "1.33.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "zha_toolkit": { "version": "v1.1.2", "requirements": [ "pytz" ] }, "govee_lan": { "version": "1.0.0", "requirements": [ "govee-led-wez>=0.0.15" ] }, "govee": { "version": "0.2.2", "requirements": [ "govee-api-laggat==0.2.2", "dacite==1.6.0" ] }, "nodered": { "version": "3.0.1", "requirements": [] }, "gardena_smart_system": { "version": "1.0.0", "requirements": [ "py-smart-gardena==1.3.7" ] }, "virtual": { "version": "0.8.0b1", "requirements": [] }, "petkit": { "version": "0.1.0", "requirements": [] } }, "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", "universal_silabs_flasher" ], "requirements": [ "bellows==0.36.5", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.104", "zigpy-deconz==0.21.1", "zigpy==0.57.2", "zigpy-xbee==0.18.3", "zigpy-zigate==0.11.0", "zigpy-znp==0.11.5", "universal-silabs-flasher==0.0.14", "pyserial-asyncio-fast==0.11" ], "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": "_uzg-01._tcp.local.", "name": "uzg-01*" }, { "type": "_slzb-06._tcp.local.", "name": "slzb-06*" } ], "is_built_in": true }, "data": { "ieee": "**REDACTED**", "nwk": 13767, "manufacturer": "Paulmann Licht GmbH", "model": "501.34", "name": "Paulmann Licht GmbH 501.34", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4644, "power_source": "Battery or Unknown", "lqi": 255, "rssi": -53, "last_seen": "2023-10-20T09:18:09", "available": true, "device_type": "EndDevice", "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=4644, 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": "0x0104", "device_type": "0x0001", "input_clusters": [ "0x0000", "0x0001", "0x0003", "0x0b05", "0x1000" ], "output_clusters": [ "0x0003", "0x0004", "0x0005", "0x0006", "0x0008", "0x0019", "0x0300", "0x1000" ] }, "2": { "profile_id": "0x0104", "device_type": "0x0001", "input_clusters": [ "0x0000", "0x0001", "0x0003", "0x0b05", "0x1000" ], "output_clusters": [ "0x0003", "0x0004", "0x0005", "0x0006", "0x0008", "0x0019", "0x0300", "0x1000" ] } }, "manufacturer": "Paulmann Licht GmbH", "model": "501.34" }, "active_coordinator": false, "entities": [ { "entity_id": "button.paulmann_licht_gmbh_501_34_identify", "name": "Paulmann Licht GmbH 501.34" }, { "entity_id": "sensor.paulmann_licht_gmbh_501_34_battery", "name": "Paulmann Licht GmbH 501.34" }, { "entity_id": "sensor.paulmann_licht_gmbh_501_34_battery_2", "name": "Paulmann Licht GmbH 501.34" } ], "neighbors": [], "routes": [], "endpoint_names": [ { "name": "LEVEL_CONTROL_SWITCH" }, { "name": "LEVEL_CONTROL_SWITCH" } ], "user_given_name": null, "device_reg_id": "8ca4512d767c89afc73ce43c27275972", "area_id": null, "cluster_details": { "1": { "device_type": { "name": "LEVEL_CONTROL_SWITCH", "id": 1 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0004": { "attribute_name": "manufacturer", "value": "Paulmann Licht GmbH" }, "0x0005": { "attribute_name": "model", "value": "501.34" }, "0x4000": { "attribute_name": "sw_build_id", "value": "2.7.6_r25" } }, "unsupported_attributes": {} }, "0x0001": { "endpoint_attribute": "power", "attributes": { "0x0021": { "attribute_name": "battery_percentage_remaining", "value": 200 }, "0x0033": { "attribute_name": "battery_quantity", "value": 0 }, "0x0031": { "attribute_name": "battery_size", "value": 255 }, "0x0020": { "attribute_name": "battery_voltage", "value": 33 } }, "unsupported_attributes": {} }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0b05": { "endpoint_attribute": "diagnostic", "attributes": {}, "unsupported_attributes": {} }, "0x1000": { "endpoint_attribute": "lightlink", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "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": {}, "unsupported_attributes": {} }, "0x0008": { "endpoint_attribute": "level", "attributes": {}, "unsupported_attributes": {} }, "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} }, "0x0300": { "endpoint_attribute": "light_color", "attributes": {}, "unsupported_attributes": {} }, "0x1000": { "endpoint_attribute": "lightlink", "attributes": {}, "unsupported_attributes": {} } } }, "2": { "device_type": { "name": "LEVEL_CONTROL_SWITCH", "id": 1 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": {}, "unsupported_attributes": {} }, "0x0001": { "endpoint_attribute": "power", "attributes": { "0x0021": { "attribute_name": "battery_percentage_remaining", "value": 200 }, "0x0033": { "attribute_name": "battery_quantity", "value": 0 }, "0x0031": { "attribute_name": "battery_size", "value": 255 }, "0x0020": { "attribute_name": "battery_voltage", "value": 33 } }, "unsupported_attributes": {} }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0b05": { "endpoint_attribute": "diagnostic", "attributes": {}, "unsupported_attributes": {} }, "0x1000": { "endpoint_attribute": "lightlink", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "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": {}, "unsupported_attributes": {} }, "0x0008": { "endpoint_attribute": "level", "attributes": {}, "unsupported_attributes": {} }, "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} }, "0x0300": { "endpoint_attribute": "light_color", "attributes": {}, "unsupported_attributes": {} }, "0x1000": { "endpoint_attribute": "lightlink", "attributes": {}, "unsupported_attributes": {} } } } } } } ```

Logs

Logs ```python [Paste the logs here] ```

Additional information

No response

drueppela commented 1 year ago

I tried to implement

https://github.com/zigpy/zha-device-handlers/tree/dev/zhaquirks/paulmann)](https://github.com/zigpy/zha-device-handlers/tree/dev/zhaquirks/paulmann

Step 1:

I created the directory:

/config/zha_custom_quirks

image

Step 2:

Added

zha:
database_path: /config/zigbee.db
enable_quirks: true
custom_quirks_path: /config/zha_custom_quirks/

to

/config/configuration.yaml

Step 3:

Added

__init__.py

https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/__init__.py

to the directory:

/config/zha_custom_quirks

image

Step 4:

Added

const.py

https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/const.py

to the directory:

/config/zha_custom_quirks

image

Step 5:

Added directory

paulmann

https://github.com/zigpy/zha-device-handlers/tree/dev/zhaquirks/paulmann

to the directory:

/config/zha_custom_quirks

image

Step 6:

Added

__init__.py

https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/paulmann/__init__.py

to the directory:

/config/zha_custom_quirks/paulmann

image

Step 7:

Added

fourbtnremote.py

https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/paulmann/fourbtnremote.py

to the directory:

/config/zha_custom_quirks/paulmann

https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/paulmann/fourbtnremote.py

image

Step 8:

Disconnected Paulmann Licht GmbH Wall Switch 501.34

Step 9:

Factory reset Paulmann Licht GmbH Wall Switch 501.34

Step 10:

Restart Home Assistant

Step 11:

Pairing Paulmann Licht GmbH Wall Switch 501.34

Result:

As before I can see events fired, but Paulmann 501.34 Wall Switch (sw_build_id (id: 0x4000) 2.7.6_r25) cannot be used in HASSIO automations.

image


Where can I see if the quirk is running?

image

Logger: zhaquirks
Source: components/zha/__init__.py:122
First occurred: 19:34:30 (1 occurrences)
Last logged: 19:34:30

Loaded custom quirks. Please contribute them to https://github.com/zigpy/zha-device-handlers

image


I cannot find a hint at

https://github.com/zigpy/zha-device-handlers/pull/2419 https://github.com/zigpy/zha-device-handlers/blob/dev/README.md

and

Add guide for adding a custom quirk to ZHA #2419

TheJulianJES commented 1 year ago

Can you listen to zha_event in the Home Assistant "developer tools" -> "events" section and see if you get any events when pressing the buttons? Also, see if there's anything in the logbook when pressing buttons.

drueppela commented 1 year ago

@TheJulianJES & @dmulcahey & @MattFromGer & @javicalle

image


GROUP A - START


GROUP A - A1 - ON [SHORT CLICK & RELEASE]

Listen to zha_event

image

Logbook

image

GROUP A - A0 - OFF [SHORT CLICK & RELEASE]

Listen to zha_event

image

Logbook

image

GROUP A - A1 - DIMMING + [LONG PRESS/HOLD]

Listen to zha_event

image

Logbook

image

GROUP A - A1 - DIMMING + [RELEASE]

Listen to zha_event

image

Logbook

image

GROUP A - A1 - DIMMING - [LONG PRESS/HOLD]

Listen to zha_event

image

Logbook

image

GROUP A - A1 - DIMMING - [RELEASE]

Listen to zha_event

image

Logbook

image


GROUP B - START


GROUP B - B1 - ON [SHORT CLICK & RELEASE]

Listen to zha_event

image

Logbook

image

GROUP B - B0 - OFF [SHORT CLICK & RELEASE]

Listen to zha_event

image

Logbook

image

GROUP B - B1 - DIMMING + [LONG PRESS/HOLD]

Listen to zha_event

image

Logbook

image

GROUP B - B1 - DIMMING + [RELEASE]

Listen to zha_event

image

Logbook

image

GROUP B - B1 - DIMMING - [LONG PRESS/HOLD]

Listen to zha_event

image

Logbook

image

GROUP B - B1 - DIMMING - [RELEASE]

Listen to zha_event

image

Logbook

image

javicalle commented 1 year ago

Just noticed that your device signature is:

  "manufacturer": "Paulmann Licht GmbH",
  "model": "501.34",

While the quirk is using the value: https://github.com/zigpy/zha-device-handlers/blob/d1a1b599da44c471b52a616c320aab1d5491e163/zhaquirks/paulmann/__init__.py#L3

Have you tried to add your signature to quirk? it would be something like:

class PaulmannRemote4Btn(CustomDevice):
    """Custom device representing Paulmann 4-button 501.34 remote control."""

    signature = {
        # <SimpleDescriptor endpoint=1 profile=260 device_type=1
        # device_version=0
        # input_clusters=[0, 1, 3, 2821, 4096]
        # output_clusters=[3, 4, 5, 6, 8, 25, 768, 4096]>
        MODELS_INFO: [
            (PAULMANN, "501.34"),
            ("Paulmann Licht GmbH", "501.34"),
        ],
        ENDPOINTS: {
            1: {
                .../...
MattFromGer commented 1 year ago

Good catch @javicalle. I'll prepare a PR

drueppela commented 1 year ago

@javicalle : 🥇

All Device Triggers are available now. MANY THANKS.

Is there a chance to make the Device Triggers available as Entities?


Is there a chance to change the Device Trigger Names

Button 1 ==> Button a1

and

"First button"pressed to "Button a1" pressed?

like the Paulmann description?

image

redfusion83 commented 1 year ago

@drueppela Thanks for this very well written guide. It's great that you put a lot of work into your posts, it really contributes to the community! Also, I had the same problem and now I can use the newer switches too!

I think it's still too much work to create the automations for this switch and I'd like to create a blueprint to make it easier. I've never done this before and need to learn, but that's the fun of Home Assistant!

itsmicash commented 2 months ago

@redfusion83 @drueppela @MattFromGer @TheJulianJES

Hi guys, I have issues with button A0 and B0 (or button 2 and 4) all button presses work except long press and press and realease on these 2 buttons. hope someone can support me.

Button 2 long press & release image

Button 2 long press image

Button 4 long press & release image

Button 4 long press image

I'm really struggling and don't know what to do.