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

determine which HA connection has returned AddEventHandlerSubscriptionAsync event #14

Open
pcgear opened this issue Jan 17, 2024 · 0 comments

Comments

@pcgear
Copy link

pcgear commented Jan 17, 2024

I am trying to connect multiple Home Assistant controllers to my code. The code snippet below is working and I am getting responses from two controllers. The problem is I can't determine which controller returns the response. I realize I could add different WS_OnEvent functions to separate the returns but that becomes cumbersome if there are 50 connections. Is there some method to make this determination more cleanly?

       var hassWSApi = new HassWSApi();
        var connectionParameters = ConnectionParameters.CreateFromInstanceBaseUrl("http://192.168.55.125:8123/", "...");
        await hassWSApi.ConnectAsync(connectionParameters);

        var hassWSApi2 = new HassWSApi();
        connectionParameters = ConnectionParameters.CreateFromInstanceBaseUrl("http://192.168.55.165:8123/", "...");
        await hassWSApi2.ConnectAsync(connectionParameters);


        await hassWSApi.AddEventHandlerSubscriptionAsync(WS_OnEvent);
        await hassWSApi2.AddEventHandlerSubscriptionAsync(WS_OnEvent);
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