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

Aqara H1M - 2 and 3 Gang incomplete info #18483

Closed
osamaabdo opened this issue Aug 1, 2023 · 23 comments
Closed

Aqara H1M - 2 and 3 Gang incomplete info #18483

osamaabdo opened this issue Aug 1, 2023 · 23 comments
Labels
problem Something isn't working stale Stale issues

Comments

@osamaabdo
Copy link

What happened?

Hi,
I have 3 Aqara H1M switches
H1M - 1 Gang identified as ZNQBKG24LM
H1M - 2 Gang identified as ZNQBKG25LM
H1M - 3 Gang identified as ZNQBKG25LM

ZNQBKG24LM exoses all info - such as energy, voltage and power_loss_recovery

the problem is that ZNQBKG25LM and ZNQBKG26LM do not expose the above. Any way to fix this

What did you expect to happen?

to expose all info

How to reproduce it (minimal and precise)

No response

Zigbee2MQTT version

1.32.1

Adapter firmware version

20230507

Adapter

Sonoff USB Dongle P

Debug log

No response

@osamaabdo osamaabdo added the problem Something isn't working label Aug 1, 2023
@Rumlik
Copy link

Rumlik commented Aug 4, 2023

I have similar problem
I have 2gang ZNQBKG25LM switch and apparently there is some error in the code. In relay mode, everything works fine. But if you switch to decoupled switching mode, the action sensor then doesn't distinguish between pressing the button right or left. Thus, the right and left button report the same.
Would anyone know how to fix this? Thank you very much.

@osamaabdo
Copy link
Author

osamaabdo commented Aug 8, 2023

I created an external converter, but still unable to get power recovery and turn off LED at night

zigbeeModel: ['lumi.switch.acn030'], // The model ID from: Device with modelID 'lumi.sens' is not supported. model: 'ZNQBKG25LM', // Vendor model number, look on the device for a model number vendor: 'Xiaomi', // Vendor of the device (only used for documentation and startup logging) description: 'Aqara H1M Doubel', // Description of the device, copy from vendor site. (only used for documentation and startup logging) fromZigbee: [fz.on_off, fz.xiaomi_power, fz.xiaomi_multistate_action, fz.aqara_opple], toZigbee: [ tz.on_off, tz.xiaomi_switch_operation_mode_opple, tz.xiaomi_flip_indicator_light, ], endpoint: (device) => { return {'left': 1, 'right': 2}; }, meta: {multiEndpoint: true}, exposes: [ e.switch().withEndpoint('left'), e.switch().withEndpoint('center'), e.switch().withEndpoint('right'), e.power(), e.energy(), e.voltage(), e.enum('operation_mode', ea.ALL, ['control_relay', 'decoupled']) .withDescription('Decoupled mode for left button') .withEndpoint('left'), e.enum('operation_mode', ea.ALL, ['control_relay', 'decoupled']) .withDescription('Decoupled mode for right button') .withEndpoint('right'), e.action(['single_left', 'double_left', 'single_right', 'double_right', 'single_left_right', 'double_left_right', 'single_all', 'double_all']), e.device_temperature(), e.flip_indicator_light(), ], // Defines what this device exposes, used for e.g. Home Assistant discovery and in the frontend

@osamaabdo
Copy link
Author

@Rumlik Did you ever figure out the action issue ?

@osamaabdo
Copy link
Author

I discovered a solution for the ZNQBKG26LM switch to add power_loss_recovery, and led_disabled_at_night
The model number (ZNQBKG26LM) needs to be added to toZigbee
xiaomi_switch_power_outage_memory: { key: ['power_outage_memory'], convertSet: async (entity, key, value, meta) => { if (['SP-EUC01', 'ZNCZ04LM', 'ZNCZ15LM', 'QBCZ14LM', 'QBCZ15LM', 'SSM-U01', 'SSM-U02', 'DLKZMK11LM', 'DLKZMK12LM', 'WS-EUK01', 'WS-EUK02', 'WS-EUK03', 'WS-EUK04', 'QBKG19LM', 'QBKG18LM', 'QBKG20LM', 'QBKG25LM', 'QBKG26LM', 'QBKG28LM', 'QBKG29LM', 'QBKG31LM', 'QBKG34LM', 'QBKG38LM', 'QBKG39LM', 'QBKG40LM', 'QBKG41LM', 'ZNDDMK11LM', 'ZNLDP13LM', 'ZNQBKG31LM', 'WS-USC02', 'WS-USC03', 'WS-USC04', 'ZNQBKG24LM', 'ZNQBKG25LM',

And in xiaomi_led_disabled_night:

but i am still struggling to get actions in ZNQBKG25LM, as mentioned, it only has single_action (no single_left_action) and single_right

@osamaabdo
Copy link
Author

osamaabdo commented Aug 15, 2023

i finally figured it out with the following converter - hopfully it is added to the official release
it is basically adding ZNQBKG25LM to the multistate action


const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const {
    hasAlreadyProcessedMessage
} = require('zigbee-herdsman-converters/lib/utils');

const new_xiaomi_multistate_action= {
    cluster: 'genMultistateInput',
    type: ['attributeReport'],
    convert: (model, msg, publish, options, meta) => {
        //console.log('Received presentValue:', msg.data['presentValue'], 'Endpoint ID:', msg.endpoint.ID);

        if (hasAlreadyProcessedMessage(msg, model)) return;
        let actionLookup = {0: 'hold', 1: 'single', 2: 'double', 3: 'triple', 255: 'release'};
        if (model.model === 'WXKG12LM') {
            actionLookup = {...actionLookup, 16: 'hold', 17: 'release', 18: 'shake'};
        }

        let buttonLookup = null;
        if (['WXKG02LM_rev2', 'WXKG07LM', 'WXKG15LM', 'WXKG17LM'].includes(model.model)) {
            buttonLookup = {1: 'left', 2: 'right', 3: 'both'};
        }
        if (['QBKG12LM', 'QBKG24LM'].includes(model.model)) buttonLookup = {5: 'left', 6: 'right', 7: 'both'};
        if (['QBKG39LM', 'QBKG41LM', 'WS-EUK02', 'WS-EUK04', 'QBKG20LM', 'QBKG28LM', 'QBKG31LM','ZNQBKG25LM'].includes(model.model)) {
            buttonLookup = {41: 'left', 42: 'right', 51: 'both'};
        }
        if (['QBKG25LM', 'QBKG26LM', 'QBKG29LM', 'QBKG34LM', 'ZNQBKG31LM', 'ZNQBKG26LM'].includes(model.model)) {
            buttonLookup = {
                41: 'left', 42: 'center', 43: 'right',
                51: 'left_center', 52: 'left_right', 53: 'center_right',
                61: 'all',
            };
        }
        if (['WS-USC02', 'WS-USC04'].includes(model.model)) {
            buttonLookup = {41: 'top', 42: 'bottom', 51: 'both'};
        }

        const action = actionLookup[msg.data['presentValue']];
        if (buttonLookup) {
            const button = buttonLookup[msg.endpoint.ID];
            if (button) {
                return {action: `${action}_${button}`};
            }
        } else {
            return {action};
        }
    },
}
const definition = {
    zigbeeModel: ['lumi.switch.acn030'], // The model ID from: Device with modelID 'lumi.sens' is not supported.
    model: 'ZNQBKG25LM', // Vendor model number, look on the device for a model number
    vendor: 'Xiaomi', // Vendor of the device (only used for documentation and startup logging)
    description: 'Aqara H1M Doubel', // Description of the device, copy from vendor site. (only used for documentation and startup logging)


    fromZigbee: [fz.on_off, fz.xiaomi_power, new_xiaomi_multistate_action, fz.aqara_opple],
    toZigbee: [
        tz.on_off, tz.xiaomi_switch_operation_mode_opple, tz.xiaomi_flip_indicator_light,tz.xiaomi_led_disabled_night,
        tz.xiaomi_switch_power_outage_memory,
    ],
    meta: {multiEndpoint: true},
    endpoint: (device) => {
        return {'left': 1, 'right': 2};
    },
    exposes: [
        e.switch().withEndpoint('left'), e.switch().withEndpoint('right'),
        e.power_outage_memory(),e.power(), e.energy(), e.voltage(),e.led_disabled_night(),
        e.enum('operation_mode', ea.ALL, ['control_relay', 'decoupled'])
        .withDescription('Decoupled mode for left button')
        .withEndpoint('left'),
        e.enum('operation_mode', ea.ALL, ['control_relay', 'decoupled'])
        .withDescription('Decoupled mode for right button')
        .withEndpoint('right'),
        e.device_temperature(), e.flip_indicator_light(),
        e.action(['single_left', 'double_left', 'single_right', 'double_right',
        'single_left_right', 'double_left_right', 'single_all', 'double_all']),
    ], // Defines what this device exposes, used for e.g. Home Assistant discovery and in the frontend
    
};

module.exports = definition;

for the 3 gang switch ZNQBKG26LM, similar but we just need to have led_disabled_at_night and power_outage_memory


const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const manufacturerOptions = {
    xiaomi: {manufacturerCode: 0x115F}
};

const new_xiaomi_switch_power_outage_memory= {
    key: ['power_outage_memory'],
    convertSet: async (entity, key, value, meta) => {
        if (['SP-EUC01', 'ZNCZ04LM', 'ZNCZ15LM', 'QBCZ14LM', 'QBCZ15LM', 'SSM-U01', 'SSM-U02', 'DLKZMK11LM', 'DLKZMK12LM',
            'WS-EUK01', 'WS-EUK02', 'WS-EUK03', 'WS-EUK04', 'QBKG19LM', 'QBKG18LM', 'QBKG20LM', 'QBKG25LM', 'QBKG26LM', 'QBKG28LM', 'QBKG29LM',
            'QBKG31LM', 'QBKG34LM', 'QBKG38LM', 'QBKG39LM', 'QBKG40LM', 'QBKG41LM', 'ZNDDMK11LM', 'ZNLDP13LM', 'ZNQBKG31LM',
            'WS-USC02', 'WS-USC03', 'WS-USC04', 'ZNQBKG24LM', 'ZNQBKG25LM','ZNQBKG26LM',
        ].includes(meta.mapped.model)) {
            await entity.write('aqaraOpple', {0x0201: {value: value ? 1 : 0, type: 0x10}}, manufacturerOptions.xiaomi);
        } else if (['ZNCZ02LM', 'QBCZ11LM', 'LLKZMK11LM'].includes(meta.mapped.model)) {
            const payload = value ?
                [[0xaa, 0x80, 0x05, 0xd1, 0x47, 0x07, 0x01, 0x10, 0x01], [0xaa, 0x80, 0x03, 0xd3, 0x07, 0x08, 0x01]] :
                [[0xaa, 0x80, 0x05, 0xd1, 0x47, 0x09, 0x01, 0x10, 0x00], [0xaa, 0x80, 0x03, 0xd3, 0x07, 0x0a, 0x01]];

            await entity.write('genBasic', {0xFFF0: {value: payload[0], type: 0x41}}, manufacturerOptions.xiaomi);
            await entity.write('genBasic', {0xFFF0: {value: payload[1], type: 0x41}}, manufacturerOptions.xiaomi);
        } else if (['ZNCZ11LM', 'ZNCZ12LM'].includes(meta.mapped.model)) {
            const payload = value ?
                [0xaa, 0x80, 0x05, 0xd1, 0x47, 0x00, 0x01, 0x10, 0x01] :
                [0xaa, 0x80, 0x05, 0xd1, 0x47, 0x01, 0x01, 0x10, 0x00];

            await entity.write('genBasic', {0xFFF0: {value: payload, type: 0x41}}, manufacturerOptions.xiaomi);
        } else {
            throw new Error('Not supported');
        }
        return {state: {power_outage_memory: value}};
    },
    convertGet: async (entity, key, meta) => {
        if (['SP-EUC01', 'ZNCZ04LM', 'ZNCZ15LM', 'QBCZ14LM', 'QBCZ15LM', 'SSM-U01', 'SSM-U02', 'DLKZMK11LM', 'DLKZMK12LM',
            'WS-EUK01', 'WS-EUK02', 'WS-EUK03', 'WS-EUK04', 'QBKG19LM', 'QBKG18LM', 'QBKG20LM', 'QBKG25LM', 'QBKG26LM', 'QBKG28LM', 'QBKG29LM',
            'QBKG31LM', 'QBKG34LM', 'QBKG38LM', 'QBKG39LM', 'QBKG40LM', 'QBKG41LM', 'ZNDDMK11LM', 'ZNLDP13LM', 'ZNQBKG31LM',
            'WS-USC02', 'WS-USC03', 'WS-USC04', 'ZNQBKG24LM', 'ZNQBKG25LM','ZNQBKG26LM',
        ].includes(meta.mapped.model)) {
            await entity.read('aqaraOpple', [0x0201]);
        } else if (['ZNCZ02LM', 'QBCZ11LM', 'ZNCZ11LM', 'ZNCZ12LM'].includes(meta.mapped.model)) {
            await entity.read('aqaraOpple', [0xFFF0]);
        } else {
            throw new Error('Not supported');
        }
    },
}
const new_xiaomi_led_disabled_night= {
    key: ['led_disabled_night'],
    convertSet: async (entity, key, value, meta) => {
        if (['ZNCZ04LM', 'ZNCZ12LM', 'ZNCZ15LM', 'QBCZ14LM', 'QBCZ15LM', 'QBKG19LM', 'QBKG18LM', 'QBKG20LM', 'QBKG25LM', 'QBKG26LM',
            'QBKG28LM', 'QBKG29LM', 'QBKG31LM', 'QBKG34LM', 'DLKZMK11LM', 'SSM-U01', 'WS-EUK01', 'WS-EUK02',
            'WS-EUK03', 'WS-EUK04', 'SP-EUC01', 'ZNQBKG24LM', 'ZNQBKG25LM','ZNQBKG26LM'].includes(meta.mapped.model)) {
            await entity.write('aqaraOpple', {0x0203: {value: value ? 1 : 0, type: 0x10}}, manufacturerOptions.xiaomi);
        } else if (['ZNCZ11LM'].includes(meta.mapped.model)) {
            const payload = value ?
                [0xaa, 0x80, 0x05, 0xd1, 0x47, 0x00, 0x03, 0x10, 0x00] :
                [0xaa, 0x80, 0x05, 0xd1, 0x47, 0x01, 0x03, 0x10, 0x01];

            await entity.write('genBasic', {0xFFF0: {value: payload, type: 0x41}}, manufacturerOptions.xiaomi);
        } else {
            throw new Error('Not supported');
        }
        return {state: {led_disabled_night: value}};
    },
    convertGet: async (entity, key, meta) => {
        if (['ZNCZ04LM', 'ZNCZ12LM', 'ZNCZ15LM', 'QBCZ15LM', 'QBCZ14LM', 'QBKG19LM', 'QBKG18LM', 'QBKG20LM', 'QBKG25LM', 'QBKG26LM',
            'QBKG28LM', 'QBKG29LM', 'QBKG31LM', 'QBKG34LM', 'DLKZMK11LM', 'SSM-U01', 'WS-EUK01', 'WS-EUK02',
            'WS-EUK03', 'WS-EUK04', 'SP-EUC01', 'ZNQBKG24LM', 'ZNQBKG25LM','ZNQBKG26LM'].includes(meta.mapped.model)) {
            await entity.read('aqaraOpple', [0x0203], manufacturerOptions.xiaomi);
        } else {
            throw new Error('Not supported');
        }
    },
}
const definition = {
    zigbeeModel: ['lumi.switch.acn031'], // The model ID from: Device with modelID 'lumi.sens' is not supported.
    model: 'ZNQBKG26LM', // Vendor model number, look on the device for a model number
    vendor: 'Xiaomi', // Vendor of the device (only used for documentation and startup logging)
    description: 'Aqara H1M Triple', // Description of the device, copy from vendor site. (only used for documentation and startup logging)
    fromZigbee: [fz.on_off, fz.xiaomi_power, fz.xiaomi_multistate_action, fz.aqara_opple],
    toZigbee: [
        tz.on_off, tz.xiaomi_switch_operation_mode_opple, tz.xiaomi_flip_indicator_light,
        new_xiaomi_led_disabled_night,
        new_xiaomi_switch_power_outage_memory
    ],
    meta: {multiEndpoint: true},
    endpoint: (device) => {
        return {'left': 1, 'center': 2, 'right': 3};
    },

    exposes: [
        e.switch().withEndpoint('left'), e.switch().withEndpoint('center'), e.switch().withEndpoint('right'),
        e.power_outage_memory(),e.power(), e.energy(), e.voltage(),e.led_disabled_night(),
        e.enum('operation_mode', ea.ALL, ['control_relay', 'decoupled'])
            .withDescription('Decoupled mode for left button')
            .withEndpoint('left'),
        e.enum('operation_mode', ea.ALL, ['control_relay', 'decoupled'])
            .withDescription('Decoupled mode for center button')
            .withEndpoint('center'),
        e.enum('operation_mode', ea.ALL, ['control_relay', 'decoupled'])
            .withDescription('Decoupled mode for right button')
            .withEndpoint('right'),
        e.action(['single_left', 'double_left', 'single_center', 'double_center', 'single_right', 'double_right',
            'single_left_center', 'double_left_center', 'single_left_right', 'double_left_right',
            'single_center_right', 'double_center_right', 'single_all', 'double_all']),
        e.device_temperature(), e.flip_indicator_light(),
    ], // Defines what this device exposes, used for e.g. Home Assistant discovery and in the frontend
    
};

module.exports = definition;

@Koenkk
Copy link
Owner

Koenkk commented Aug 15, 2023

Could you make a pull request for this?

@Rumlik
Copy link

Rumlik commented Aug 15, 2023

Could you make a pull request for this?

I will try this tomorrow or next day. To check this.

@Rumlik
Copy link

Rumlik commented Aug 17, 2023

Could you make a pull request for this?

For 2 gang everything good now with this converter 👌

@Its-Manzzi
Copy link

@osamaabdo did you manage to solve for 3 gang for the decoupled switching and the led light? Thank you

@Whipsmith
Copy link

@Rumlik did you make a PR with this fix?

Also, do you update your switches to the latest firmware?

@Rumlik
Copy link

Rumlik commented Sep 24, 2023

@Rumlik did you make a PR with this fix?

Also, do you update your switches to the latest firmware?

Me? I thought it was said to @osamaabdo

I cant update firmware. I click update and nothing happens. You can update?

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale Stale issues label Oct 25, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2023
@Rumlik
Copy link

Rumlik commented Dec 12, 2023

Hi there,
Since the last Z2M update, right and left button press on ZNQBKG25LM - 2 gang logging no longer works in operation mode. It only logs as a single press without indicating whether right or left.
Can someone please help with a solution?
Thank you very much.

@Its-Manzzi
Copy link

Hey, did you manage to resolve?

@Rumlik
Copy link

Rumlik commented Jan 1, 2024

No

@Its-Manzzi
Copy link

So you aren't able to use the switch effecticely in HA?

@Rumlik
Copy link

Rumlik commented Jan 1, 2024

So you aren't able to use the switch effecticely in HA?

Now i cant with decouple status. Only relay switch.
Nobody seems to care.

@Its-Manzzi
Copy link

@osamaabdo Aslm, hoping you can assist here, you were really helpful in solving the previous issue. It would be appreciated if possible. جزاك الله خير

@utegental
Copy link

@Rumlik did you make a PR with this fix?
Also, do you update your switches to the latest firmware?

Me? I thought it was said to @osamaabdo

I cant update firmware. I click update and nothing happens. You can update?

I tried, and it successfully updated, but it changed nothing :-)

@Its-Manzzi
Copy link

@Rumlik did you make a PR with this fix?
Also, do you update your switches to the latest firmware?

Me? I thought it was said to @osamaabdo
I cant update firmware. I click update and nothing happens. You can update?

I tried, and it successfully updated, but it changed nothing :-)

Do you also have the issue as @Rumlik?

@mdworton
Copy link

mdworton commented Mar 7, 2024

I also have the same issue with the firmware. Says it has been successful but doesn't update. I have ZNQBKG26LM, ZNQBKG25LM, ZNQBKG24LM in my network but none can perform update. I have some older Aqara H1 with Neutrals and they work fine it just seems to be the H1M models that don't work. Maybe the firmware update could be related to the above issue and could fix that too. No obvious errors in the logs either. Happy to diagnose where i can if needed.

@mdworton
Copy link

mdworton commented Mar 7, 2024

Just to add to this if you look under the device and select state it shows the new firmware as if it is loaded once you run the update, so in my case:
"update": {
"installed_version": 1380147,
"latest_version": 1380147,
but if you hit the check for firmware updates it reverts back to installed version as before the update:
"update": {
"installed_version": 1376310,
"latest_version": 1380147,

@Its-Manzzi
Copy link

Still no fixes it seems:(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Something isn't working stale Stale issues
Projects
None yet
Development

No branches or pull requests

7 participants