-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Linking two or more Home Assistant instances #246
Comments
The MQTT event stream almost does this. It sends the state changed events from one HA instance to another and allows these to display on the front-end. What it doesn't do is replicate the states themselves, so you can't then query the states. It also doesn't transmit service calls back to modify the states. I don't think a master-slave arrangement is really ideal however, I think each HA should be responsible for its own states, not transmit them off site. You don't really want you holiday house's watering not to go on because the internet is down, this is the whole reason why people are wanting to use local control rather than "in the cloud". The underlying technology here isn't actually important, but to me the outcome should be:
Really automations should really be hosted on the HA that uses them, so they don't get disconnected when the internet goes down, but if users really want to rely on their internet connection then this method would work. |
Indeed, I agree that automations that can run locally always should. It is not the goal to replace these. In my opinion, the goal should only be to aggregate control for the user. Therefore, in order of priority, the steps are
I don't have a strong opinion on MQQT versus websockets. However, given that steps are made to support the web things API, there could be gains in an implementation with the websocket API (which is also used for web things and might share a few developments). |
If we have successful service call transmission, then there's no reason why you can't run remote automations, it's more just that it wouldn't be the best idea. The main issue with not transmitting service calls is that then you'll have a read only state, which we don't currently use much in the front end, so the display is likely to be buggy. |
Also see the somewhat related High-Availability architecture ideas/discussion here about linking instances for redundancy -> #152 That is, could maybe achieve High-Availability if could link two or more Home Assistant instances and also add a fail-over feature. |
I don't really understand, is there a possibility to call a service on the remote site? I want to call the remote site's notify-service because the remote site is paired with my iPhone and the HA Cloud. |
This is a showstopper for me so I really hope someone can figure this out. I'm looking to make the switch from SmartThings but really need to be able to use phone-based presence with two instances. I got my Pi this week and got the first instance setup at one place, but when I went to look at setting up a second instance at another house I realized there's no way to link them. One of the big use cases for my home automation is to be able to switch between the two and see what's going on at the other place, as well as trigger automation based on presence (or lack of it) at each place. SmartThings has a UI affordance to do this and it's pretty seamless. It seems like Home Assistant should be able to do something similar. Just setup two separate instances (URls) in the app, and when you switch it just uses whatever instance you switched to. Then the instance should handle all the presence stuff as it does now. |
I'm looking at this now too as I've recently set my house up with HA and have already set a zone for my church. I want to use presence to turn things on and off when I'm in my office there but also want to manage everything via a single UI. It seems like the web sockets method of Home Assistant Remote should work if both instances are hooked up with HA Cloud or the MQTT method talked about in https://link.medium.com/ExIn8GTHOcb should be doable if combined with a VPN between sites. Ideally though, HA would support managing multiple instances centrally so that the remote/secondary ones could be more of a bridge than a full HA setup. Central management would also allow for installing updates, integrations, and add-ons in a consistent way across nodes. Following the bridge idea, if the main and supplemental instances are on the same network then the could link up automagically via discovery. If separated they could link via ZeroTier or WireGuard prior to being discovered. In my head, the non-primary instances would function much like a Hue Bridge with the addition of a minimal UI for setting up the link. |
Any updates ? |
I think I have seen this before and it was declined as adding way to much complexity to the code base, and what is the benefit of have integrations and data sharing that cross 2 systems? Could they not be independent systems, and then you login to each individually. |
Ignoring complexity (agree with you) I think that there is a large benefit of additional HA instances which communicate with devices. reasons for that:
|
Another use case for this would be not having to connect multiple homes to the same cloud service. For example, if you want to track health data from Withings and presence from iCloud, it's redundant and, yes, additional complexity, to have to do that on multiple HA instances. (In my opinion, it would be great if all cloud connections could go via Nabu Casa and then be made available to all connected HA instances, but I understand more privacy-concerned users might not want that. Also beyond the scope of this issue.) |
I don't think we need multi HA for the apps to support multiple homes. That's a feature request for the apps. I don't think it will ever really make sense to bolt on full and total control of one HA from another HA (like managing automations and pairing and stuff). UX wise it's quite a large thing to retrofit, short of a ground up redesign of the UI I think it would just lead to a confusing mess. I do think one HA showing entities from another HA is interesting and useful. We can already do that to a certain extent with MQTT or HomeKit. I quite often have one HA controlling another HA by using homekit bridge on the "remote" side and homekit_controller on the "main" instance. To extend that between homes you'd just need a site to site VPN or something. It looks like the remote_homeassistant custom component might do something similar but without being limited by external schemas. All of these would let you forward just a subset of entities and events rather than forwarding everything an polluting the parent HA. |
The SmartThings app does this and it's not a confusing mess. It simply lets me manage two independent instances (one for each house) and as far as the app is concerned there is no communication between the two. The app acts as a hub between the two instances, providing a common place to look at the state of each, manage devices and automations, provide device based presence, and surface alerts and notifications for both instances. The interface stays clean because I can only look at one instance at a time. |
What you are requesting is totally different than the topic of this discussion, this change can be made in the frontend or the mobile app to allow switching between accounts but the discussion here is about linking data from entities from a |
@blokpardi I Agree with @thecode here, I think you have misunderstood what I mean. That or I don't understand what you are trying to say 😆. I hope that what Shay has said answers your concerns, but if not let me try to say it in a clearer way, in case that is the source of the confusion. A simple and not confusing UI for multiple HA installs is one like you've described. What you describe is what Home on iOS does too. There is a concept of multiple houses, and a selector for the current house. You are never looking at 2 houses at once. There is a single app, and it it is aware of multiple "backends". I agree that like you say, this is clean and simple. It is not a confusing mess at all. This can be implemented by the app's already, and does not require the instances to be linked together. A quick search suggests the maintainer for the app would actually accept the PR to implement this if somone was willing to do the work. But it is a lot of work, and they'd prefer it if the contributor was going to stick around to make sure it stayed working. They did a survey (https://twitter.com/home_assistant/status/1367226483966504960) and decided to prioritise other work themselves. See also home-assistant/android#296, home-assistant/iOS#161 and home-assistant/iOS#1790. But all this is completely seperate to what this issue is about, where we are talking about the actual backends knowing about each other, and being able to control one from the other, entities being visible between them and events spreading between them. At a backend level, not just a UI level. For some (I think) it's about integration which is deeper than what can be done by https://github.com/custom-components/remote_homeassistant alone. For some it's about making remote_homeassistant something built in. To get what you want you need to follow the ticket I listed above for your device of choice rather than this one, though. |
@Jc2k thank you for the detail, that helps. My original comment was about the front-end UX and being able to manage multiple unconnected instances, so apologies if I was off topic. In terms of this thread, if you haven't seen what Adrian Caramaliu has done with WebCore (dashboard.webcore.co), it's freaking amazing IMO. It's a backend rules engine that both supports separate instances of SmartThings (technically separate instances of WebCore) but also allows those instances to talk to each other. What I wouldn't give for an open engine like that not tied to SmartThings. |
^^^^^^^^^^^^^ |
Just adding my two cents to this thread. I currently have HA running in my primary home and a vacation home. I believe there are several methods to address this currently available but each has limitations.
I am satisfied with the current state of play, except I would like to see remote-homeassistant or a similar capability added to the core. The notifications on the Master IOS App and the ability for "cross" instance automations makes remote-homeassistant a "must" for me. The current functionality works, just not sure what the reluctance to move it into the core is. I read balloob's comments from 2018 on closing the PR. Not sure I fully understand what his concerns are, but from my perspective an MVP must include the ability to see States from the client in the Master AND call services on the client from the Master. |
+1 or at least having something like remote_homeassistant or similar as a built-in core component would be a great start for this!
For me, to make linking two or more Home Assistant instances a good user experience it should really be a built-in core feature. The original post by danielsjf already lists some really good real-world scenarios that should not be that uncommon today:
An additional scenario is instances of Home Assistant at parents/grandparents houses (each with Zigbee USB dongles for ZHA). Today I manage Home Assistant at my parents via web interface only as totally separate installations with no connections at all. |
As my usage has increased, I’ve found a couple of key scenarios are really hard to deal with today:
In both there it may be desirable to have devices at multiple physical locations interact with a single HA (literally or effectively) so that automations can use data from multiple places. An example of this is presence detection that knows when I’m in remote location foo instead of at home and changes behaviors of devices at both locations accordingly. Such a scenario really benefits from a single mobile app being used to provide the presence for all locations. |
Hello: Has anyone got Nest cameras working remotely? I have my "slave" HA running all devices that require (or benefit from) Nabu Casa and I have my master pulling data from the slave instance. Everything works beautifully, except my Nest cameras. I see "camera not found" in the master's log. I'm suspecting something with SSL but not sure. Thanks. |
What is the outcome? |
Hello: I'm also interested on progress on this topic, here my usecase:
Probably Remote Home-Assistant is the solution to this case, I'll rty to give it a try but a solution at back-end level would be something really great. Thanks, |
This architecture issue is old, stale, and possibly obsolete. Things changed a lot over the years. Additionally, we have been moving to discussions for these architectural discussions. For that reason, I'm going to close this issue. ../Frenck |
@frenck What would be the best way to keep up with architectural discussions related to this? |
This one is stale so closed it to clean up a little. I'm happy to re-open and move it to a discussion if you think it is viable / needs resolving. ../Frenck |
I don't know how useful this discussion is, but I think the feature, in some form, would be great. Just wondering if it or something in that vein is being discussed elsewhere, in which case it would be interesting to follow the discussion. |
Right, but this is not a repository for tracking feature requests :) ../Frenck |
Hi @frenck , could you enlighten me as to where this discussion should happen ? I would like to follow the conversation :). I'm also writing here to guide fellow future client :D . |
@elafontaine This architectural discussion is closed. Please use the community forums for requesting and discussing features. |
Context
Home Assistant is great in grouping and controlling local and webbased devices/services. However, there are cases in which local actually means two or more unconnected networks. A few examples:
In all these cases, it would be great if two different versions of Home Assistant could talk to each other. Since one will always be the aggregator of the data, I will call this main instance of Home Assistant the master. The second device will be the client.
In the past there have been (and still are) a few attempts to make this work:
Both the first and the third option currently work, but both aren't hassle free setups and aren't integrated in HA. Therefore they might break if HA is updated.
Decision
The proposal is mainly a retake of the comment of @balloob.
In short, the master and client would communicate via the websocket API. The client would push state updates to the master when they change.
The MVP would only relay sensor data from the client to the master. It would require the following changes:
outpost
that is set up on the client. It will duplicate all client entities on the master via the websocket API and push all state updates on the client to the same master instance.Further developments could add the following functionality:
Consequences
Potentially more maintenance of the websockets API but this is already used heavily by other components.
The text was updated successfully, but these errors were encountered: