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

[New device support]: Legrand WNACB40 (4-Button Scene Controller) #16170

Closed
brantmacga opened this issue Jan 14, 2023 · 33 comments
Closed

[New device support]: Legrand WNACB40 (4-Button Scene Controller) #16170

brantmacga opened this issue Jan 14, 2023 · 33 comments
Labels
new device support New device support request stale Stale issues

Comments

@brantmacga
Copy link

Link

https://www.legrand.us/wiring-devices/adorne-collection/switches/adorne-wireless-smart-scene-switch-with-netatmo-white/p/wnacb40w1

Database entry

0x646266fffe62c80a

Comments

I have the device paired, but I'm unable to figure out how to get access to the 4 scene buttons. I'd like to be able to use them to trigger events/scenes in Home Assistant. I also don't see an option to bind any of the 4 actions.

This is one of the 4-button scene controllers for the north american market. The other version is shown here --> https://www.legrand.us/wiring-devices/radiant-collection/switches/radiant-wireless-smart-scene-controller-with-netatmo-white/p/wnrcb40wh

External converter

const exposes = require('zigbee-herdsman-converters/lib/exposes');
const fz = {...require('zigbee-herdsman-converters/converters/fromZigbee'), legacy: require('zigbee-herdsman-converters/lib/legacy').fromZigbee};
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
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 ota = require('zigbee-herdsman-converters/lib/ota');

const readInitialBatteryState = async (type, data, device) => {
    if (['deviceAnnounce'].includes(type)) {
        const endpoint = device.getEndpoint(1);
        const options = {manufacturerCode: 0x1021, disableDefaultResponse: true};
        await endpoint.read('genPowerCfg', ['batteryVoltage'], options);
    }
};

const tzLocal = {
    auto_mode: {
        key: ['auto_mode'],
        convertSet: async (entity, key, value, meta) => {
            const mode = {'off': 0x00, 'auto': 0x02, 'on_override': 0x03};
            const payload = {data: Buffer.from([mode[value]])};
            await entity.command('manuSpecificLegrandDevices3', 'command0', payload);
            return {state: {'auto_mode': value}};
        },
    },
};

module.exports = [
    {
        zigbeeModel: ['Wireless Scenes Command'],
        model: 'WNACB40',
        vendor: 'Legrand',
        // led blink RED when battery is low
        description: 'Wireless Smart Scene Controller',
        fromZigbee: [fz.identify, fz.on_off, fz.command_toggle],
        exposes: [e.battery(), e.action(['press_1', 'press_2', 'press_3', 'press_4'])],
        toZigbee: [],
        meta: {battery: {voltageToPercentage: '3V_2500'}, publishDuplicateTransaction: true},
        onEvent: readInitialBatteryState,
        configure: async (device, coordinatorEndpoint, logger) => {
            await extend.configure(device, coordinatorEndpoint, logger);
            const endpoint = device.getEndpoint(1);
            await reporting.bind(endpoint, coordinatorEndpoint, ['genIdentify']);

        },
    },
];

Supported color modes

No response

Color temperature range

No response

@brantmacga brantmacga added the new device support New device support request label Jan 14, 2023
@brantmacga
Copy link
Author

I am using a different converter now, still not getting the response I need.

I need to be able to see each button in HA when trying to use it to toggle scenes. Right now when I try to configure it in HA automations, I have "when battery level changes" and "default action".

This is my converter.....

External converter

const exposes = require('zigbee-herdsman-converters/lib/exposes');
const fz = {...require('zigbee-herdsman-converters/converters/fromZigbee'), legacy: require('zigbee-herdsman-converters/lib/legacy').fromZigbee};
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
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 ota = require('zigbee-herdsman-converters/lib/ota');

const readInitialBatteryState = async (type, data, device) => {
    if (['deviceAnnounce'].includes(type)) {
        const endpoint = device.getEndpoint(1);
        const options = {manufacturerCode: 0x1021, disableDefaultResponse: true};
        await endpoint.read('genPowerCfg', ['batteryVoltage'], options);
    }
};

const tzLocal = {
    auto_mode: {
        key: ['auto_mode'],
        convertSet: async (entity, key, value, meta) => {
            const mode = {'off': 0x00, 'auto': 0x02, 'on_override': 0x03};
            const payload = {data: Buffer.from([mode[value]])};
            await entity.command('manuSpecificLegrandDevices3', 'command0', payload);
            return {state: {'auto_mode': value}};
        },
    },
};

module.exports = [
    {
        zigbeeModel: ['Wireless Scenes Command'],
        model: 'WNACB4, WNRCB4',
        vendor: 'Legrand',
        description: 'Wireless Smart Scene Controller',
        fromZigbee: [fz.legrand_scenes, fz.battery, fz.ignore_poll_ctrl, fz.legrand_master_switch_center],
        toZigbee: [],
        exposes: [e.battery(), e.action(['Scene_1', 'Scene_2', 'Scene_3', 'Scene_4', 'center'])],
        meta: {battery: {voltageToPercentage: '3V_2500'}},
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await reporting.bind(endpoint, coordinatorEndpoint, ['genIdentify', 'genPowerCfg']);
        },
     },
];
' ' '

@jiquem
Copy link

jiquem commented Feb 1, 2023

You could have a look to Koenkk/zigbee-herdsman-converters#5359

@brantmacga
Copy link
Author

brantmacga commented Feb 1, 2023

You could have a look to Koenkk/zigbee-herdsman-converters#5359

thank you. Is your device a Green Power device?

Nevermind, I looked it up and see that it is. Interestingly, it shows as already being supported by Z2M. I will follow along with your Issue request.

@jiquem
Copy link

jiquem commented Feb 1, 2023

It's not a "green power" device : it has a battery

@brantmacga
Copy link
Author

It's not a "green power" device : it has a battery

https://zigbee.blakadder.com/Legrand_ZLGP15.html

The “GP” is for green power. Is this the device you have ?

@brantmacga
Copy link
Author

brantmacga commented Feb 2, 2023

I've added fz.command_recall.

Now when I try to create an automation, I have "recall_1 action" as a trigger. This is the only trigger, and it works for all 4 buttons. Now trying to get it where I have a trigger option for each of the four buttons so they can control different devices/scenese.

External converter

const exposes = require('zigbee-herdsman-converters/lib/exposes');
const fz = {...require('zigbee-herdsman-converters/converters/fromZigbee'), legacy: require('zigbee-herdsman-converters/lib/legacy').fromZigbee};
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
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 ota = require('zigbee-herdsman-converters/lib/ota');

const readInitialBatteryState = async (type, data, device) => {
    if (['deviceAnnounce'].includes(type)) {

    }
};

const tzLocal = {
    auto_mode: {
        key: ['auto_mode'],
        convertSet: async (entity, key, value, meta) => {
            const mode = {'off': 0x00, 'auto': 0x02, 'on_override': 0x03};
            const payload = {data: Buffer.from([mode[value]])};
            await entity.command('manuSpecificLegrandDevices3', 'command0', payload);
            return {state: {'auto_mode': value}};
        },
    },
};

module.exports = [
    {
        zigbeeModel: ['Wireless Scenes Command'],
        model: 'WNACB4, WNRCB4',
        vendor: 'Legrand',
        description: 'Wireless Smart Scene Controller',
        fromZigbee: [fz.legrand_scenes, fz.battery, fz.ignore_poll_ctrl, fz.legrand_master_switch_center, fz.command_recall],
        toZigbee: [],
        exposes: [e.battery(), e.action(['Scene_1', 'Scene_2', 'Scene_3', 'Scene_4', 'center'])],
        meta: {battery: {voltageToPercentage: '3V_2500'}},
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await reporting.bind(endpoint, coordinatorEndpoint, ['genIdentify', 'genPowerCfg']);
        },
     },
];

@brantmacga
Copy link
Author

Tried another converter setup in attempt to have access to all four buttons.... Still only have the one global "recall_1 action"

External converter

const exposes = require('zigbee-herdsman-converters/lib/exposes');
const fz = {...require('zigbee-herdsman-converters/converters/fromZigbee'), legacy: require('zigbee-herdsman-converters/lib/legacy').fromZigbee};
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
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 ota = require('zigbee-herdsman-converters/lib/ota');

const readInitialBatteryState = async (type, data, device) => {
    if (['deviceAnnounce'].includes(type)) {

    }
};

const tzLocal = {
    auto_mode: {
        key: ['auto_mode'],
        convertSet: async (entity, key, value, meta) => {
            const mode = {'off': 0x00, 'auto': 0x02, 'on_override': 0x03};
            const payload = {data: Buffer.from([mode[value]])};
            await entity.command('manuSpecificLegrandDevices3', 'command0', payload);
            return {state: {'auto_mode': value}};
        },
    },
};

module.exports = [
    {
        zigbeeModel: ['Wireless Scenes Command'],
        model: 'WNACB4, WNRCB4',
        vendor: 'Legrand',
        description: 'Wireless Smart Scene Controller',
        fromZigbee: [fz.legrand_scenes, fz.battery, fz.ignore_poll_ctrl, fz.legrand_master_switch_center, fz.command_Scene1_recall, fz.command_Scene2_recall, fz.command_Scene3_recall, fz.command_Scene4_recall],
        toZigbee: [],
        exposes: [e.battery(), e.action(['Scene1', 'Scene2', 'Scene3', 'Scene4', 'center'])],
        meta: {battery: {voltageToPercentage: '3V_2500'}},
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await reporting.bind(endpoint, coordinatorEndpoint, ['genIdentify', 'genPowerCfg']);
        },
     },
];

@brantmacga
Copy link
Author

Last attempt for today; still didn't work.

External converter

const exposes = require('zigbee-herdsman-converters/lib/exposes');
const fz = {...require('zigbee-herdsman-converters/converters/fromZigbee'), legacy: require('zigbee-herdsman-converters/lib/legacy').fromZigbee};
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
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 ota = require('zigbee-herdsman-converters/lib/ota');

const readInitialBatteryState = async (type, data, device) => {
    if (['deviceAnnounce'].includes(type)) {

    }
};

const tzLocal = {
    auto_mode: {
        key: ['auto_mode'],
        convertSet: async (entity, key, value, meta) => {
            const mode = {'off': 0x00, 'auto': 0x02, 'on_override': 0x03};
            const payload = {data: Buffer.from([mode[value]])};
            await entity.command('manuSpecificLegrandDevices3', 'command0', payload);
            return {state: {'auto_mode': value}};
        },
    },
};

module.exports = [
    {
        zigbeeModel: ['Wireless Scenes Command'],
        model: 'WNACB4, WNRCB4',
        vendor: 'Legrand',
        description: 'Wireless Smart Scene Controller',
        fromZigbee: [fz.legrand_scenes, fz.battery, fz.ignore_poll_ctrl, fz.legrand_master_switch_center, fz.command_recall],
        toZigbee: [],
        exposes: [e.battery(), e.action(['press_1', 'press_2', 'press_3', 'press_4', 'center'])],
        meta: {battery: {voltageToPercentage: '3V_2500'}},
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await reporting.bind(endpoint, coordinatorEndpoint, ['genIdentify', 'genPowerCfg']);
        },
     },
];

@brantmacga
Copy link
Author

@Koenkk any advice with scene control converters?

@Koenkk
Copy link
Owner

Koenkk commented Feb 4, 2023

@brantmacga could you provide me the debug log when pressing the buttons?

See https://www.zigbee2mqtt.io/guide/usage/debug.html on how to enable debug logging.

@brantmacga
Copy link
Author

This is a single press of each of the 4 buttons. Thank you for taking a look at this with me!

2023-02-04 10:48:41Received Zigbee message from '0x646266fffe62c80a', type 'commandRecall', cluster 'genScenes', data '{"groupid":65515,"sceneid":1}' from endpoint 1 with groupID 65515

2023-02-04 10:48:46Received Zigbee message from '0x646266fffe62c80a', type 'commandRecall', cluster 'genScenes', data '{"groupid":65517,"sceneid":1}' from endpoint 1 with groupID 65517

2023-02-04 10:48:48Received Zigbee message from '0x646266fffe62c80a', type 'commandRecall', cluster 'genScenes', data '{"groupid":65516,"sceneid":1}' from endpoint 1 with groupID 65516

2023-02-04 10:48:50Received Zigbee message from '0x646266fffe62c80a', type 'commandRecall', cluster 'genScenes', data '{"groupid":65514,"sceneid":1}' from endpoint 1 with groupID 65514

@brantmacga
Copy link
Author

2023-02-04 11:01:22Received Zigbee message from '0x646266fffe62c80a', type 'commandCheckIn', cluster 'genPollCtrl', data '{}' from endpoint 1 with groupID 0

2023-02-04 11:01:22Received Zigbee message from '0x646266fffe62c80a', type 'commandRecall', cluster 'genScenes', data '{"groupid":65517,"sceneid":1}' from endpoint 1 with groupID 65517

2023-02-04 11:01:24Received Zigbee message from '0x646266fffe62c80a', type 'readResponse', cluster 'genBasic', data '{"appVersion":0}' from endpoint 1 with groupID 0

2023-02-04 11:01:24Received Zigbee message from '0x646266fffe62c80a', type 'readResponse', cluster 'genBasic', data '{"hwVersion":0}' from endpoint 1 with groupID 0

2023-02-04 11:01:25Received Zigbee message from '0x646266fffe62c80a', type 'readResponse', cluster 'genPollCtrl', data '{"checkinInterval":345600}' from endpoint 1 with groupID 0

@Koenkk
Copy link
Owner

Koenkk commented Feb 5, 2023

The groupid varies, along with the action you will also find an action_group in the published payload.

@m4sis
Copy link

m4sis commented Feb 8, 2023

I also have a Legrand button with 4 scenes, like you, I get action_1 for the four buttons.
I have no idea how to successfully assign the groupid to an automation

@brantmacga
Copy link
Author

I haven't yet figured out how to implement what Koenkk is telling me. I understand there are different group ID's, I'm just not sure yet how that should be written in a way that HA understands for using in automations.

@jiquem
Copy link

jiquem commented Feb 8, 2023

I get it working
Here is an automation which is executed when I press on the first button

alias: "[SCENARIO] Legrand 1"
description: ""
trigger:
  - platform: mqtt
    topic: zigbee2mqtt/legrand_switch_scenario
condition:
  - condition: template
    value_template: "{{ trigger.payload_json.action_group == 65517 }}"
action:
  - service: persistent_notification.create
    data_template:
      message: "{{ trigger.payload_json.action_group }}"
mode: single

@m4sis
Copy link

m4sis commented Feb 16, 2023

breakthrough ?

@brantmacga
Copy link
Author

breakthrough ?

no. I haven't yet had time to work on it again.

@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 Mar 20, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 28, 2023
@Hellou1337
Copy link

Hellou1337 commented Nov 21, 2023

hi, i have the same legrand switch 067775 and only one button si working as have the guys before me. Also i have legrand 067774 and also only one action is received. So basically the same problem :)

Is there any way to distinguish between pushed buttons?

Thanks in advance for any reply

EDIT:
I have found that the Conbee/Phoscon support this switch, maybe there is someting useful for coders out there
dresden-elektronik/deconz-rest-plugin#6096

EDIT2:
I tried the two button 067774 again and in latest update it sends correctly "On Left, Off Left, On Right and Off Right". Something like that would be great to be implementet in 067775

@jiquem
Copy link

jiquem commented Nov 24, 2023

Hello,

You can proceed like this to trigger the automation.
For instance, this one will be triggered when the button 1 is used
Capture d’écran 2023-11-24 à 15 41 03

@Hellou1337
Copy link

Hi,

thanks for reply - will use.

however for 067775 only one button is sending signals, others just dont show up as any action in Z2M or any logs. I guess some kind of external converter shoud do the trick? The one button that works sends action_group":65516 so that i can work with. But if no message shows up in Z2M what can i do?

@jiquem
Copy link

jiquem commented Nov 25, 2023

Try this one

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 ota = require('zigbee-herdsman-converters/lib/ota');

const readInitialBatteryState = async (type, data, device) => {
    if (['deviceAnnounce'].includes(type)) {
        const endpoint = device.getEndpoint(1);
        const options = {manufacturerCode: 0x1021, disableDefaultResponse: true};
        await endpoint.read('genPowerCfg', ['batteryVoltage'], options);
    }
};

const tzLocal = {
    auto_mode: {
        key: ['auto_mode'],
        convertSet: async (entity, key, value, meta) => {
            const mode = {'off': 0x00, 'auto': 0x02, 'on_override': 0x03};
            const payload = {data: Buffer.from([mode[value]])};
            await entity.command('manuSpecificLegrandDevices3', 'command0', payload);
            return {state: {'auto_mode': value}};
        },
    },
};

const definition = {
        fingerprint: [{modelID: ' Wireless Scenes Command\u0000\u0000\u0000\u0000\u0000\u0000\u0000'}],
        model: '067755',
        vendor: 'Legrand',
        description: 'Wireless Scenes Command',
        fromZigbee: [fz.identify, fz.battery, fz.command_recall],
        exposes: [e.battery(), e.action(['identify', 'recall_1_1'])],
        toZigbee: [],
        meta: {multiEndpoint: true, battery: {voltageToPercentage: '3V_2500'}, publishDuplicateTransaction: true},
        onEvent: readInitialBatteryState,
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'genOnOff', 'genLevelCtrl']);
        },


};

module.exports = definition;

@Hellou1337
Copy link

wow,

It actually works and I can do triggers and distinguish what button was pressed.
What a great day :-)

Thanks very much for your help

@9611919
Copy link

9611919 commented Dec 23, 2023

Sorry for dummy question...)
Where did you out the code?

@jiquem
Copy link

jiquem commented Dec 24, 2023

@9611919
Copy link

9611919 commented Dec 24, 2023

Have a look to https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html#_2-adding-your-device

Thank you! I did it!!! :)
But I stuck further. There is new firmware on one of modules. And it doesn't want to be installed... via zigbee2mqtt

@jiquem
Copy link

jiquem commented Dec 25, 2023

It’s normal : z2m doesn’t allow firmware upgrade for this device

@9611919
Copy link

9611919 commented Dec 26, 2023

It’s normal : z2m doesn’t allow firmware upgrade for this device

Simply IMHO. Can it happen that I use Bticino and update is for Legrand?

@jiquem
Copy link

jiquem commented Dec 26, 2023

No

@9611919
Copy link

9611919 commented Dec 26, 2023

No

Koenkk/zigbee-OTA#328

I did it!

@jiquem
Copy link

jiquem commented Dec 27, 2023

You did it with a powered device.

@9611919
Copy link

9611919 commented Dec 27, 2023

You did it with a powered device.

Yes. With bticino k4411c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new device support New device support request stale Stale issues
Projects
None yet
Development

No branches or pull requests

6 participants