AlexxIT / XiaomiGateway3

Home Assistant custom component for control Xiaomi Multimode Gateway (aka Gateway 3), Xiaomi Multimode Gateway 2, Aqara Hub E1 on default firmwares over LAN
https://github.com/AlexxIT/Blog
MIT License
2.43k stars 341 forks source link

Lack of Support for Aqara Switch Z1(lumi.switch.acn048) #1271

Open ComLin010 opened 8 months ago

ComLin010 commented 8 months ago

Hi ALex I tried to write a converter, but it doesn't work except for the switch function. I'm using an E1 template. Can you add support for Z1? https://home.miot-spec.com/s/lumi.switch.acn048

This is the template for E1 ↓

"lumi.switch.b1lc04": ["Aqara", "Single Wall Switch E1 (no N)", "QBKG38LM"],
    # "support": 5,
    "spec": [
        Converter("switch", "switch", mi="2.p.1"),
        ButtonMIConv("button", mi="6.e.1", value=1),
        ButtonMIConv("button", mi="6.e.2", value=2),
        Action,
        BoolConv("led", "switch", mi="3.p.1", enabled=False),  # uint8
        MapConv("power_on_state", "select", mi="4.p.1", map=POWEROFF_MEMORY,
                enabled=False),
        BoolConv("wireless", "switch", mi="6.p.1", enabled=False),
        MapConv("mode", "select", mi="10.p.1", map=SWITCH_MODE, enabled=False)
    ],

This is the Z1 template I wrote ↓

from custom_components.xiaomi_gateway3.core.converters.devices import *

DEVICES = [{
    "lumi.switch.acn048": ["Aqara", "Switch Z1", "ZNQBKG38LM"],
    "spec": [
        Converter("switch", "switch", mi="5.p.1"),  # bool
        ButtonMIConv("button", mi="6.e.1", value=1),
        Action,
        BoolConv("led", "switch", mi="4.p.1", enabled=False),  # uint8
        MapConv("power_on_state", "select", mi="5.p.4", map=POWEROFF_MEMORY,#断电记忆
                enabled=False),
        BoolConv("wireless", "switch", mi="5.p.2", enabled=False),

    ],
}] + DEVICES
AlexxIT commented 7 months ago

I don't see problems in your version. All looks fine