『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 1563|回复: 6

[求助] 在zha中配置的zigbee6键开关所有按键会被一起控制

[复制链接]

6

主题

30

帖子

488

积分

中级会员

Rank: 3Rank: 3

积分
488
金钱
458
HASS币
0
发表于 2023-5-6 15:23:45 | 显示全部楼层 |阅读模式
6个按键有两个是场景按键,参考网上的教程用custom_zha_quirks修改了配置,现在能识别到修改配置但是依然在ha里面控制会出现所有开关同步,去按实体开关的时候不会出问题,状态同步在ha里面也是正常的

"""Tuya DP based switches."""
from zigpy.profiles import zha
from zigpy.zcl.clusters.general import Basic, GreenPowerProxy, Groups, Ota, Scenes, Time, OnOff, Identify

from zhaquirks.const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODELS_INFO,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
    BUTTON_1,
    BUTTON_2,
    BUTTON_3,
    BUTTON_4,
    BUTTON_5,
    BUTTON_6,
    COMMAND,
    DEVICE_TYPE,
    DOUBLE_PRESS,
    ENDPOINT_ID,
    LONG_PRESS,
    MODEL,
    SHORT_PRESS,
)
from zhaquirks.tuya.mcu import (
    MoesSwitchManufCluster,
    TuyaOnOff,
    TuyaOnOffManufCluster,
    TuyaOnOffNM,
)

from zhaquirks.tuya import (
    TuyaSwitch,
    TuyaZBE000Cluster,
    TuyaZBElectricalMeasurement,
    TuyaSmartRemoteOnOffCluster,
    TuyaZBExternalSwitchTypeCluster,
    TuyaZBMeteringCluster,
    TuyaZBOnOffAttributeCluster,
)

class TuyaTS0726(TuyaSwitch):
    """Tuya sextuple channel switch time on out cluster device with GreenPowerProxy cluster device."""

    signature = {
        MODELS_INFO: [
            ("_TZ3000_a9buwvb7", "TS0726"),
        ],
        ENDPOINTS: {
            # <SimpleDescriptor endpoint=1 profile=260 device_type=81
            # input_clusters=[0x0000,0x0004,0x0005,0xEF00]
            # output_clusters=[0x000A,0x0019]>
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SCENE_SELECTOR,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    TuyaZBE000Cluster.cluster_id,
                    TuyaZBExternalSwitchTypeCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [ 
                    Time.cluster_id,
                    Ota.cluster_id
                ],
            },
            2: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SCENE_SELECTOR,
                INPUT_CLUSTERS: [
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    TuyaZBE000Cluster.cluster_id,
                    TuyaZBExternalSwitchTypeCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [],
            },
            3: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SCENE_SELECTOR,
                INPUT_CLUSTERS: [
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    TuyaZBE000Cluster.cluster_id,
                    TuyaZBExternalSwitchTypeCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [],
            },
            4: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SCENE_SELECTOR,
                INPUT_CLUSTERS: [
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    TuyaZBE000Cluster.cluster_id,
                    TuyaZBExternalSwitchTypeCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [],
            },
            5: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SCENE_SELECTOR,
                INPUT_CLUSTERS: [
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    TuyaZBE000Cluster.cluster_id,
                    TuyaZBExternalSwitchTypeCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [],
            },
            6: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SCENE_SELECTOR,
                INPUT_CLUSTERS: [
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    TuyaZBE000Cluster.cluster_id,
                    TuyaZBExternalSwitchTypeCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [],
            }
        },
    }            

    replacement = {
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaZBE000Cluster.cluster_id,
                    TuyaZBExternalSwitchTypeCluster.cluster_id,
                    TuyaZBOnOffAttributeCluster
                ],
                OUTPUT_CLUSTERS: [ 
                    Time.cluster_id,
                    Ota.cluster_id
                ],
            },
            2: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
                INPUT_CLUSTERS: [
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaZBOnOffAttributeCluster,
                ],
                OUTPUT_CLUSTERS: [],
            },
            3: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
                INPUT_CLUSTERS: [
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaZBOnOffAttributeCluster,
                ],
                OUTPUT_CLUSTERS: [],
            },
            4: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
                INPUT_CLUSTERS: [
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaZBOnOffAttributeCluster,
                ],
                OUTPUT_CLUSTERS: [],
            },
            5: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SCENE_SELECTOR,
                INPUT_CLUSTERS: [
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaZBOnOffAttributeCluster,
                ],
                OUTPUT_CLUSTERS: [],
            },
            6: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SCENE_SELECTOR,
                INPUT_CLUSTERS: [
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaZBOnOffAttributeCluster,
                ],
                OUTPUT_CLUSTERS: [],
            }
        }
    }


回复

使用道具 举报

10

主题

106

帖子

1611

积分

金牌会员

Rank: 6Rank: 6

积分
1611
金钱
1505
HASS币
0
发表于 2023-5-10 01:38:42 来自手机 | 显示全部楼层
沙发,坐等大佬
回复

使用道具 举报

10

主题

112

帖子

586

积分

高级会员

Rank: 4

积分
586
金钱
474
HASS币
0
发表于 2023-5-19 10:00:18 | 显示全部楼层
你参考的自定义quirks的教程能不能发个链接,我也有这个需求,想学习一下!谢谢
回复

使用道具 举报

6

主题

30

帖子

488

积分

中级会员

Rank: 3Rank: 3

积分
488
金钱
458
HASS币
0
 楼主| 发表于 2023-5-22 17:22:47 | 显示全部楼层
liy517 发表于 2023-5-19 10:00
你参考的自定义quirks的教程能不能发个链接,我也有这个需求,想学习一下!谢谢 ...

https://bbs.hassbian.com/thread-17496-1-1.html
就是论坛的帖子
回复

使用道具 举报

10

主题

112

帖子

586

积分

高级会员

Rank: 4

积分
586
金钱
474
HASS币
0
发表于 2023-5-24 18:28:35 | 显示全部楼层
southward 发表于 2023-5-22 17:22
https://bbs.hassbian.com/thread-17496-1-1.html
就是论坛的帖子

谢谢谢谢~~~去学习一下,zigbee2mqtt的教程很多,ZHA的教程太少了
回复

使用道具 举报

2

主题

22

帖子

159

积分

注册会员

Rank: 2

积分
159
金钱
137
HASS币
0
发表于 2023-6-22 13:10:58 | 显示全部楼层
遇到了相同的问题,请问后来是怎么解决的?
回复

使用道具 举报

6

主题

30

帖子

488

积分

中级会员

Rank: 3Rank: 3

积分
488
金钱
458
HASS币
0
 楼主| 发表于 2023-9-8 18:20:07 | 显示全部楼层
crh37983158 发表于 2023-6-22 13:10
遇到了相同的问题,请问后来是怎么解决的?

暂时放弃了,好像更新了这个开关,但是还是不完美
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-24 11:11 , Processed in 0.056605 second(s), 28 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表