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

Allow exposes in ModernExtend interface to be a function #7683

Closed

Conversation

burmistrzak
Copy link
Contributor

Already works in Definition, now it does in ModernExtend as well!

Context here: #7444 (comment)

@burmistrzak
Copy link
Contributor Author

@Koenkk Huh, that's interesting...
Why doesn't this just work? I guess, because some libs are expecting Expose[]? 🤔

burmistrzak and others added 2 commits June 25, 2024 04:01
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
@burmistrzak
Copy link
Contributor Author

burmistrzak commented Jun 25, 2024

@Koenkk Hmm, we still have some type mismatches here and there...
Maybe there's actually a good reason why modernExtend only uses Expose[], that I'm simply not aware of?

We don't necessarily have to change the interface, IMHO.
As long as we somehow figure out how to dynamically update exposes in a ModernExtend based on Zh.Device stuff, I'll finally be able to finish up the conversion of the BMCT-SLZ. 😊

@Koenkk
Copy link
Owner

Koenkk commented Jun 25, 2024

I've implemented it in 059dfb8 now, so this can be closed.

@burmistrzak
Copy link
Contributor Author

@Koenkk Oh nice, thank you! ☺️
I would have made the required changes myself, but I first wanted to make sure there're be no sneaky surprises. Glad you've figured it out.

@burmistrzak
Copy link
Contributor Author

@Koenkk What do you think, did I get that exposes right? Do I need some additional arguments somewhere? 🤔

bmct: (): ModernExtend => {
    const fromZigbee: Fz.Converter[] = [
        // ...
    ];
    const toZigbee: Tz.Converter[] = [
        // ...
    ];
    const exposes: DefinitionExposesFunction[] = [
        (device: Device, options: KeyValue): Expose[] => {
            const expose: Expose[] = [
                e.linkquality(),
            ];
            // Doesn't use 'device' yet, but you get the idea.
            return expose;
        },
    ];
    return {
        fromZigbee,
        toZigbee,
        exposes,
        isModernExtend: true,
    };
},

@Koenkk
Copy link
Owner

Koenkk commented Jul 1, 2024

Yes this looks good, does it work?

@burmistrzak
Copy link
Contributor Author

Yes this looks good, does it work?

@Koenkk We'll know soon enough!
Just have to reset a BMCT-SLZ first. Hopefully the Expose[] gets updated correctly. 🤞

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

Successfully merging this pull request may close these issues.

2 participants