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

Creating Device with multiple endpoints (and multiple types) #7421

Open
john159753 opened this issue Apr 21, 2024 · 1 comment
Open

Creating Device with multiple endpoints (and multiple types) #7421

john159753 opened this issue Apr 21, 2024 · 1 comment

Comments

@john159753
Copy link

john159753 commented Apr 21, 2024

Hello!
I am working on a personal project (Zigbee Control of my HotTub). And i have been working through some challenges. I really like a good challenge, but i have pretty much come up short in trying to make sure I'm doing this right. Looking through all the current implementations, I couldn't see any devices doing what I'm trying to do. Right once i thought i had a handle on things, modern extends became the way and i had to wipe what i was doing. I'm sure i missed a golden example, but can someone validate my definition is looking correct for what i am trying to accomplish?

My device is going to expose 4 endpoints, one of then is a color level device, and the other three are on/off switches. As-is - Things just seem "disconnected", HA only shows the light endpoint, color control in Z2M UI doesn't do anything, when i set color in HA the hue indicator on the wheel disappears (like there is no feedback on current hue). This behavior doesn't happen if i only have the one light endpoint defined

const {deviceEndpoints, onOff, light} = require('zigbee-herdsman-converters/lib/modernExtend');

const definition = {
    zigbeeModel: ['HotTub Control'],
    model: 'HotTub Control',
    vendor: 'John Daley',
    description: 'IQ2020',
   

    meta: {multiEndpoint: true}, 
 	extend: [
			deviceEndpoints({"endpoints":{"Jets 1 Low":1,"Jets 1 High":2,"Jets 2":3,"Light":4}}), 
			onOff({"powerOnBehavior":false,"endpointNames":["Jets 1 Low","Jets 1 High","Jets 2"]}),
			light({"effect":false,"color":{"modes":["hs","xy"]},"endpointNames":["Light"]})
			],
 	//extend: [ //deviceEndpoints({"endpoints":{"Light":4}}),
	//light({"effect":false,"color":{"modes":["hs","xy"]}})],

        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint1 = device.getEndpoint(1);
            await reporting.bind(endpoint1, coordinatorEndpoint, ['genOnOff']);
            await reporting.onOff(endpoint1);
            const endpoint2 = device.getEndpoint(2);
            await reporting.bind(endpoint2, coordinatorEndpoint, ['genOnOff']);
            await reporting.onOff(endpoint2);
            const endpoint3 = device.getEndpoint(3);
            await reporting.bind(endpoint3, coordinatorEndpoint, ['genOnOff']);
            await reporting.onOff(endpoint3);
        },
		
};

module.exports = definition;

and here is the output of the state tab - the oddness in this tab is whats leading me to believe i am not doing the Z2M converter correctly

{
    "color": {
        "s": 99,
        "saturation": 99
    },
    "color_mode": "xy",
    "state_Jets 1 High": "OFF",
    "state_Jets 1 Low": "OFF",
    "state_Jets 2": "OFF",
    "state_Light": "ON",
    "linkquality": 123,
    "power_on_behavior": null,
    "brightness_Light": 255,
    "color_Light": {
        "hue": 2,
        "saturation": 94
    },
    "color_mode_Light": "hs"
}

Im gonna keep taking whacks at this -- but if someone could point of something I am doing blatantly wrong id really appreciate it

@john159753
Copy link
Author

I think this can be closed, but there might be a check missing..
I found this issue when originally writing the device, #3432
I thought when modern extend came out, I could set my own endpoint names (since there wasn't any error when doing so), but i think while i could still control it, it didnt extend the devices properly over mqtt, so they never showed in home assistant.

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

No branches or pull requests

1 participant