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

Support for multiple houses #60

Closed
oysteinhagenpettersen opened this issue Jul 27, 2024 · 6 comments
Closed

Support for multiple houses #60

oysteinhagenpettersen opened this issue Jul 27, 2024 · 6 comments

Comments

@oysteinhagenpettersen
Copy link
Contributor

I started hacking away on a fork to support running multiple instances (house + cabin) of the module in the same MagicMirror setup. Hoping that you are open for a PR containing these changes. Sounds like a good plan?

@ottopaulsen
Copy link
Owner

I am happy to get PRs, so please go on, but discussing the changes first would be nice.
I assume this is only about running the same module multiple times in the same MM. I haven't tried that, but that would be a good thing, and a nice way to solve such a case.

@oysteinhagenpettersen
Copy link
Contributor Author

My use case involves having two separate instances of the module in the same MagicMirror (MM) for both my house and cabin. I assume others might have similar setups.

According to the MagicMirror documentation, each module can only have one node helper. Therefore, the node helper needs to be updated to support requests from multiple instances and respond with information that allows each instance to determine whether the update from the Tibber API is relevant to them.

The main change involves introducing an instance ID. This ID is used when the client (MMM-Tibber) communicates with the node helper via socket communication. The house ID serves as the instance ID, which is included in the message and extracted on the node helper side.

When the node helper sends Tibber data or subscription data back to the clients (MMM-Tibber), it attaches the same instance ID to the message. Each client then checks the instance ID to see if the update is meant for them. If it is, they update their view; if not, they ignore the update.

Let me know and I will open a PR so you can review the change.

@ottopaulsen
Copy link
Owner

Please do :-)

@oysteinhagenpettersen
Copy link
Contributor Author

Sorry for the delay: #61

@ottopaulsen
Copy link
Owner

I guess this is completed now, right?

@oysteinhagenpettersen
Copy link
Contributor Author

Yes, closing now

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