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

SwitchBinary.Changed event not working #53

Open
emilmuller opened this issue May 14, 2021 · 1 comment
Open

SwitchBinary.Changed event not working #53

emilmuller opened this issue May 14, 2021 · 1 comment

Comments

@emilmuller
Copy link

emilmuller commented May 14, 2021

Recently brushed up on my home automation skills. I had an old Aeotec Z-Stick Gen5 laying around and a Raspberry Pi 3 + .NET Core 3.1.

Also I have a Fibaro wall plug and a Philio wall plug.

When using the SwitchBinary.Changed event, it never fires with these wall plugs. I have previously used a different setup (without the Aeotec stick), and I know that at least the Fibaro wall plug definitely reports back when it is e.g. manually switched.

Has anybody reported any issues with the Changed event?

Also, Node.MessageReceived and Node.UpdateReceived never fires as well.

Kind regards, Emil

@RicoSuter
Copy link
Contributor

RicoSuter commented May 18, 2021

I also use a Fibaro Double Smart Module and just switchbinary didnt work, you need to use multichannel (there are two binary switches in my case) and then register switchbinary for both. Maybe this helps in your case too?

Just copied my code, maybe it makes sense and helps:

var multiChannel = Node.GetCommandClass<MultiChannel>();
MultiChannelEndPointReport = await multiChannel.DiscoverEndpoints(cancellationToken);

if (MultiChannelEndPointReport != null)
{
    for (byte i = 1; i <= MultiChannelEndPointReport.NumberOfIndividualEndPoints; i++)
    {
        var capability = await multiChannel.GetEndPointCapabilities(i, cancellationToken);
        if (capability.SupportedCommandClasses.Contains(CommandClass.SwitchBinary))
        {
            var switchBinary = multiChannel.GetEndPointCommandClass<SwitchBinary>(i);
            var report = await switchBinary.Get(cancellationToken);

            var component = _multiChannelComponents.OfType<ZwaveSwitchComponent>().SingleOrDefault(c => c.EndPointId == i);
            if (component == null)
            {
                component = new ZwaveSwitchComponent(this, switchBinary, i);
                switchBinary.Changed += component.OnSwitchBinary;
                _multiChannelComponents.Add(component);
            }

            component.OnSwitchBinary(Node, new ReportEventArgs<SwitchBinaryReport>(report));
        }
    }
}

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

2 participants