Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support 090615.switch.akpro4 #1547

Open
hzonz opened this issue Jan 20, 2025 · 8 comments
Open

Add support 090615.switch.akpro4 #1547

hzonz opened this issue Jan 20, 2025 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@hzonz
Copy link

hzonz commented Jan 20, 2025

from custom_components.xiaomi_gateway3.core.devices import *

DEVICES = [{
    21145: ["PTX", "PTX Wall Switch", "AK4 Pro Mesh2.0", "090615.switch.akpro4"],
    "spec": [
        # 开关控制
        BaseConv("Channel_1", "switch", mi="2.p.1"),
        BaseConv("Channel_2", "switch", mi="3.p.1"),
        BaseConv("Channel_3", "switch", mi="4.p.1"),
        BaseConv("Channel_4", "switch", mi="5.p.1"),
        # 按键模式
        MapConv("Channel_1_Mode", "select", mi="2.p.2", map={0: "Wired And Wireless", 1: "Wireless"}, entity=ENTITY_CONFIG),
        MapConv("Channel_2_Mode", "select", mi="3.p.2", map={0: "Wired And Wireless", 1: "Wireless"}, entity=ENTITY_CONFIG),
        MapConv("Channel_3_Mode", "select", mi="4.p.2", map={0: "Wired And Wireless", 1: "Wireless"}, entity=ENTITY_CONFIG),
        MapConv("Channel_4_Mode", "select", mi="5.p.2", map={0: "Wired And Wireless", 1: "Wireless"}, entity=ENTITY_CONFIG),
        # LED
        BaseConv("indicator_light", "switch", mi="11.p.1", entity=ENTITY_CONFIG),
        # 开关扩展 电动模式
        MapConv("Channel_1_diandong", "select", mi="12.p.1", map={0: "None", 1: "Wireless", 2: "Diandong", 3: "Localscene", 5: "Smarcurtain"}, entity=ENTITY_CONFIG),
        MapConv("Channel_2_diandong", "select", mi="13.p.1", map={0: "None", 1: "Wireless", 2: "Diandong", 3: "Localscene", 5: "Smarcurtain"}, entity=ENTITY_CONFIG),
        MapConv("Channel_3_diandong", "select", mi="14.p.1", map={0: "None", 1: "Wireless", 2: "Diandong", 3: "Localscene", 5: "Smarcurtain"}, entity=ENTITY_CONFIG),
        MapConv("Channel_4_diandong", "select", mi="15.p.1", map={0: "None", 1: "Wireless", 2: "Diandong", 3: "Localscene", 5: "Smarcurtain"}, entity=ENTITY_CONFIG),
        # 开关扩展 继电器状态
        BaseConv("jdq_status_1", "switch", mi="12.p.11"),
        BaseConv("jdq_status_2", "switch", mi="13.p.11"),
        BaseConv("jdq_status_3", "switch", mi="14.p.11"),
        BaseConv("jdq_status_4", "switch", mi="15.p.11"),        
        # 电源恢复状态
        MapConv("power_on_status", "select", mi="2.p.5", map={0: "off", 1: "on", 2: "Default"}, entity=ENTITY_CONFIG),
        # 场景操作模式
        MapConv("key_mode", "select", mi="16.p.1", map={0: "Standard Mode", 1: "High Speed Mode"}, entity=ENTITY_CONFIG),
        # 事件
        BaseConv("action", "sensor"),
        MapConv("action", mi="6.e.1.p.1", map={1: BUTTON_1_SINGLE, 2: BUTTON_2_SINGLE, 3: BUTTON_3_SINGLE, 4: BUTTON_4_SINGLE}),
        MapConv("action", mi="6.e.2.p.1", map={1: BUTTON_1_HOLD, 2: BUTTON_2_HOLD, 3: BUTTON_3_HOLD, 4: BUTTON_4_HOLD}),
        MapConv("action", mi="6.e.3.p.1", map={1: BUTTON_1_DOUBLE, 2: BUTTON_2_DOUBLE, 3: BUTTON_3_DOUBLE, 4: BUTTON_4_DOUBLE}),
    ],
}] + DEVICES
@hzonz
Copy link
Author

hzonz commented Jan 20, 2025

I am unable to use 'action' as an automation trigger, and I am not sure where the issue lies.

@AlexxIT AlexxIT added the enhancement New feature or request label Jan 20, 2025
@AlexxIT AlexxIT self-assigned this Jan 20, 2025
@AlexxIT
Copy link
Owner

AlexxIT commented Jan 20, 2025

@hzonz
Copy link
Author

hzonz commented Jan 21, 2025

https://github.com/AlexxIT/XiaomiGateway3/wiki/Handle-BLE-Locks

The lumi.remote.b286opcn01 can use action as a trigger condition, with multiple options such as button_1_single, button_2_single, and more available for selection.

device_id: f7096c292be14f4ca2c85edd89eadbd9
domain: xiaomi_gateway3
type: action
metadata: {}
trigger: device
state: button_1_single

I want to implement this method as a trigger condition.

@AlexxIT
Copy link
Owner

AlexxIT commented Jan 21, 2025

I don't understand your question. Above is all the information you need to use the automation.

@hzonz
Copy link
Author

hzonz commented Jan 21, 2025

I don't understand your question. Above is all the information you need to use the automation.

The 090615.switch.akpro4 cannot use action as a trigger condition like the lumi.remote.b286opcn01.

@AlexxIT
Copy link
Owner

AlexxIT commented Jan 21, 2025

You needs to collect debug logs for this device.

@hzonz
Copy link
Author

hzonz commented Jan 21, 2025

You needs to collect debug logs for this device.

Debug Log:

{'topic': 'miio/report', 'data': b'{"id":1325804123,"method":"event_occured","params":{"did":"792983587","siid":6,"eiid":3,"tid":213,"ts":1737368102,"arguments":[{"piid":1,"value":1}]},"type":16}'}
{'uid': '844693525d5c', 'did': '792983587', 'msg': 'on_report', 'data': {'action': 'double_click'}}
{'topic': 'miio/report', 'data': b'{"id":1602614126,"method":"event_occured","params":{"did":"792983587","siid":6,"eiid":1,"tid":214,"ts":1737368103,"arguments":[{"piid":1,"value":2}]},"type":16}'}
{'uid': '844693525d5c', 'did': '792983587', 'msg': 'on_report', 'data': {'action': 'click'}}
{'topic': 'central/report', 'data': b'{"id":1686498241,"_to":128,"type":16,"method":"event_occured","params":{"did":"792983587","siid":6,"eiid":3,"tid":217,"ts":1737368105,"arguments":[{"piid":1,"value":2}]}}'}
{'uid': '844693525d5c', 'did': '792983587', 'msg': 'on_report', 'data': {'action': 'double_click'}}
{'topic': 'central/report', 'data': b'{"id":1004155245,"_to":128,"type":16,"method":"event_occured","params":{"did":"792983587","siid":6,"eiid":1,"tid":218,"ts":1737368106,"arguments":[{"piid":1,"value":1}]}}'}
{'uid': '844693525d5c', 'did': '792983587', 'msg': 'on_report', 'data': {'action': 'click'}}

@AlexxIT
Copy link
Owner

AlexxIT commented Jan 25, 2025

Please show info (from notification) for your device 090615.switch.akpro4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants