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 multiple PTX Mesh models #1524

Closed
KleinerSource opened this issue Dec 22, 2024 · 5 comments
Closed

Add multiple PTX Mesh models #1524

KleinerSource opened this issue Dec 22, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@KleinerSource
Copy link

KleinerSource commented Dec 22, 2024


from custom_components.xiaomi_gateway3.core.devices import *
DEVICES = [{
    # 平头熊 AK Ultra 墙壁开关
    19642: ["PTX", "PTX Wall Switch", "AK Ultra Mesh2.0", "090615.switch.akult1"],
    "spec": [
        # 实体按键设置
        BaseConv("Channel 1", "switch", mi="2.p.1"),
        # 按键模式设置
        MapConv("Channel 1 Mode", "select", mi="2.p.2", map={0: "Wired And Wireless", 1: "Wireless"}),
        # 背光设置
        MapConv("backlight_level", "select", mi="16.p.2", map={0: "Level 0", 1: "Level 1", 2: "Level 2"}),
        MapConv("backlight_mode", "select", mi="16.p.3", map={0: "Default", 1: "auto", 2: "Not-disturb"}),
        # 无线信号设置
        BaseConv("action", "sensor"),
        ConstConv("action", mi="3.e.1", value=BUTTON_SINGLE),
        ConstConv("action", mi="3.e.2", value=BUTTON_DOUBLE),
        ConstConv("action", mi="3.e.3", value=BUTTON_HOLD),
    ],
}, {
    19641: ["PTX", "PTX Wall Switch", "AK Ultra Mesh2.0", "090615.switch.akult2"],
    "spec": [
        # 实体按键设置
        BaseConv("Channel 1", "switch", mi="2.p.1"),
        BaseConv("Channel 2", "switch", mi="3.p.1"),
        # 按键模式设置
        MapConv("Channel 1 Mode", "select", mi="2.p.2", map={0: "Wired And Wireless", 1: "Wireless"}),
        MapConv("Channel 2 Mode", "select", mi="3.p.2", map={0: "Wired And Wireless", 1: "Wireless"}),
        # 背光设置
        MapConv("backlight_level", "select", mi="16.p.2", map={0: "Level 0", 1: "Level 1", 2: "Level 2"}),
        MapConv("backlight_mode", "select", mi="16.p.3", map={0: "Default", 1: "auto", 2: "Not-disturb"}),
        # 无线信号设置
        BaseConv("action", "sensor"),
        ConstConv("action", mi="4.e.1", value=BUTTON_1_SINGLE),
        ConstConv("action", mi="4.e.2", value=BUTTON_1_DOUBLE),
        ConstConv("action", mi="4.e.3", value=BUTTON_1_HOLD),
        ConstConv("action", mi="5.e.1", value=BUTTON_2_SINGLE),
        ConstConv("action", mi="5.e.2", value=BUTTON_2_DOUBLE),
        ConstConv("action", mi="5.e.3", value=BUTTON_2_HOLD),
    ],
}, {
    19640: ["PTX", "PTX Wall Switch", "AK Ultra Mesh2.0", "090615.switch.akult3"],
    "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"),
        # 按键模式设置
        MapConv("Channel 1 Mode", "select", mi="2.p.2", map={0: "Wired And Wireless", 1: "Wireless"}),
        MapConv("Channel 2 Mode", "select", mi="3.p.2", map={0: "Wired And Wireless", 1: "Wireless"}),
        MapConv("Channel 3 Mode", "select", mi="4.p.2", map={0: "Wired And Wireless", 1: "Wireless"}),
        # 背光设置
        MapConv("backlight_level", "select", mi="16.p.2", map={0: "Level 0", 1: "Level 1", 2: "Level 2"}),
        MapConv("backlight_mode", "select", mi="16.p.3", map={0: "Default", 1: "auto", 2: "Not-disturb"}),
        # 无线信号设置
        BaseConv("action", "sensor"),
        ConstConv("action", mi="5.e.1", value=BUTTON_1_SINGLE),
        ConstConv("action", mi="5.e.2", value=BUTTON_1_DOUBLE),
        ConstConv("action", mi="5.e.3", value=BUTTON_1_HOLD),
        ConstConv("action", mi="6.e.1", value=BUTTON_2_SINGLE),
        ConstConv("action", mi="6.e.2", value=BUTTON_2_DOUBLE),
        ConstConv("action", mi="6.e.3", value=BUTTON_2_HOLD),
        ConstConv("action", mi="7.e.1", value=BUTTON_3_SINGLE),
        ConstConv("action", mi="7.e.2", value=BUTTON_3_DOUBLE),
        ConstConv("action", mi="7.e.3", value=BUTTON_3_HOLD),

    ],
}, {
    #平头熊 AK Pro 墙壁开关
    17943: ["PTX", "PTX Wall Switch", "AK Pro", "090615.switch.akpro1"],
    "spec": [
        # 实体按键设置
        BaseConv("Channel 1", "switch", mi="2.p.1"),
        # 按键模式设置
        MapConv("Channel 1 Mode", "select", mi="2.p.2", map={0: "Wired And Wireless", 1: "Wireless"}),
        # 无线信号设置
        BaseConv("action", "sensor"),
        ConstConv("action", mi="3.e.1", value=BUTTON_SINGLE),
        ConstConv("action", mi="3.e.2", value=BUTTON_DOUBLE),
        ConstConv("action", mi="3.e.3", value=BUTTON_HOLD),
    ],
}, {
    17944: ["PTX", "PTX Wall Switch", "AK Pro", "090615.switch.akpro2"],
    "spec": [
        # 实体按键设置
        BaseConv("Channel 1", "switch", mi="2.p.1"),
        BaseConv("Channel 2", "switch", mi="3.p.1"),
        # 按键模式设置
        MapConv("Channel 1 Mode", "select", mi="2.p.2", map={0: "Wired And Wireless", 1: "Wireless"}),
        MapConv("Channel 2 Mode", "select", mi="3.p.2", map={0: "Wired And Wireless", 1: "Wireless"}),
        # 无线信号设置
        BaseConv("action", "sensor"),
        ConstConv("action", mi="4.e.1", value=BUTTON_1_SINGLE),
        ConstConv("action", mi="4.e.2", value=BUTTON_1_DOUBLE),
        ConstConv("action", mi="4.e.3", value=BUTTON_1_HOLD),
        ConstConv("action", mi="5.e.1", value=BUTTON_2_SINGLE),
        ConstConv("action", mi="5.e.2", value=BUTTON_2_DOUBLE),
        ConstConv("action", mi="5.e.3", value=BUTTON_2_HOLD),
    ],
}, {
    17933: ["PTX", "PTX Wall Switch", "AK Pro", "090615.switch.akpro3"],
    "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"),
        # 按键模式设置
        MapConv("Channel 1 Mode", "select", mi="2.p.2", map={0: "Wired And Wireless", 1: "Wireless"}),
        MapConv("Channel 2 Mode", "select", mi="3.p.2", map={0: "Wired And Wireless", 1: "Wireless"}),
        MapConv("Channel 3 Mode", "select", mi="4.p.2", map={0: "Wired And Wireless", 1: "Wireless"}),
        # 无线信号设置
        BaseConv("action", "sensor"),
        ConstConv("action", mi="5.e.1", value=BUTTON_1_SINGLE),
        ConstConv("action", mi="5.e.2", value=BUTTON_1_DOUBLE),
        ConstConv("action", mi="5.e.3", value=BUTTON_1_HOLD),
        ConstConv("action", mi="6.e.1", value=BUTTON_2_SINGLE),
        ConstConv("action", mi="6.e.2", value=BUTTON_2_DOUBLE),
        ConstConv("action", mi="6.e.3", value=BUTTON_2_HOLD),
        ConstConv("action", mi="7.e.1", value=BUTTON_3_SINGLE),
        ConstConv("action", mi="7.e.2", value=BUTTON_3_DOUBLE),
        ConstConv("action", mi="7.e.3", value=BUTTON_3_HOLD),
    ],
}] + DEVICES

image

image

Action not found in automation

@AlexxIT AlexxIT added the enhancement New feature or request label Dec 22, 2024
@AlexxIT AlexxIT self-assigned this Dec 22, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Dec 22, 2024

You right. Actions will only work with devices from main devices.py file.

@KleinerSource
Copy link
Author

You right. Actions will only work with devices from main devices.py file.

thanks

@AlexxIT
Copy link
Owner

AlexxIT commented Dec 22, 2024

It's better to keep issue open until I add converter.

@KleinerSource
Copy link
Author

It's better to keep issue open until I add converter.

This series contains multiple products, and I have re edited the code

@AlexxIT AlexxIT changed the title Xiaomi_gateway.by adds custom accessories but cannot find action for home assistant automation Add multiple PTX Mesh models Dec 25, 2024
@AlexxIT AlexxIT added this to the v4.0.8 milestone Dec 25, 2024
AlexxIT added a commit that referenced this issue Dec 25, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Dec 28, 2024

@AlexxIT AlexxIT closed this as completed Dec 28, 2024
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