Home Assistant in the cloud

The last 2 months I have spent on learning Home Assistant and re-implementing my old Domoticz based home automation system in HA. It’s been fun and HA is an extremely impressive system! Since my old system was distributed with a kind of centralized Domoticz based frontend and slave systems doing the actual I/O, I decided to continue with this architecture. So I have one centralized RPi 4 with a SSD running HA and a few other (old) RPis doing GPIO, 1-wire temp and ZigBee. I use MQTT as interface in my distributed setup.

Then I started to think why do I run the centralized HA on a dedicated piece of HW? It must be possible to deploy the HA docker image on a cloud infrastructure. Of course I have to forget all HW dependant HA integrations, but as long as I stick to my architecture with 100% MQTT enabled devices (or REST and similar) this is not a major thing.

I’ve spent a few hours with Google to see if anyone has tried to deploy HA on Google cloud, AWS or Azure. I was pretty sure to find some info. But surprisingly I didn’t find much. One topic (4 years old) from a guy thinking of moving HA to Google Cloud. That’s it! Spending more time on this I might find more, but obviously this not a favourite topic. And the response this guy got was not overwhelming mildly speaking. Against everything what HA stands for etc…

4 years has passed since then, and today cloud based solutions are extremely popular and used for almost anything. Not only web based services.

Any comment on this?

You also say goodbye to LAN control, which is how a lot of integrations are made.

I don’t want to claim to speak for anyone, but it would seem to me, most people here prefer no cloud whenever possible (for anything). so I don’t see many wanting that type of setup.

2 Likes

And four years later I think you will still find the response to be…

Just because cloud solutions are “extremely popular” in some segments of the population I think you will find support for those here generally negative. And the recent actions of many cloud based developers/businesses only adds to the dim view that the average HA users have toward those types of services.

To expand on what others have already mentioned I can see that responses might be why don’t you just use Google Home/Apple Home(Kit)/Amazon and call it a day since most smart home devices already connect to those services.

However, here’s something to consider for those that do give the opposition. Home Assistant comes with a lot of capabilities and flexibility from a DIY standpoint that makes the other platforms more restrictive. One advantage for running Home Assistant in the cloud yourself is that it is still in your control. I would be hard pressed to find a very large market for an actual Home Assistant Cloud service, beyond what Nabu Casa is providing, as that still ends up meaning someone else has more control over smart home data.

There are of course other aspects of using Home Assistant in the cloud in terms of reliability, performance when transmitting massive amounts of automation and device control traffic across the internet. I think for someone that is OK with all of the risks to setup their own instance in some cloud hosting, it is perfectly OK for them to pursue that.

I personally don’t trust the reliability of my home internet to the point of losing all control of my smart home devices when the internet goes down. However, I have been trying to be careful how much of my smart home actually requires Home Assistant to be running. I’ve focused on mostly smart switches which then allow me to always manually control them. There are a few places where I’ve used some smart bulbs but the are light sockets that still have pull chains in them that I can easily hook back up to get the bulbs to manually turn back on/off(I think), or just swap out those bulbs with regular non-smart LEDs.

Interesting! I realize many (most) home automation people have a very strong opinion about cloud solutions. And they don’t like it …

I work with a quite big web service project in AWS, so I’m familiar with this environment. I see many advantages with a cloud solution. But they are mainly related to scalability and availability. And those areas are probably not the most prioritized ones for a HA user.

So I admit, this is not a deal breaker. Maybe I’m just curious to see how easy/difficult it would be to spin-up HA docker image in a cloud environment…

Availability increase in the cloud only works on a larger scale. So placing your Home Assistant in the cloud would make it more reliably available to the world. But that doesn’t mean anything because it is meant to control your home. You cannot get more reliable than controlling your home from your home.

By putting Ha in the cloud you’re introducing more points of failure. But hey, you can go anywhere else in the world and still acces HA. Just too bad it won’t do anything once it lost connection to your home. So unless you can replicate your home in the cloud too, it is pointless.

Also you are introducing more lag, increasing cost and hurting the environment more, with nothing to gain. So the reason these things aren’t “prioritised” is because there not advantages whatsoever.

3 Likes

I agree with all the negative points so far.

But that doesn’t mean I’m opposed to hearing of implementations where it would be a good fit. Obviously I want to be able to control and automate my home even if the internet is down.

But what if I’m just monitoring some other location? That wouldn’t work if the internet were down anyway. Or maybe remotely control some non-critical devices which have local backup. Remotely running automations seems to be less useful, although again maybe someone has a use case where the automation isn’t that critical.

The point is, HA is very flexible. Most of us want it running locally, but I’m sure it has the flexibility to meet some needs most of us haven’t thought of yet.

Let us know how you make out.

1 Like

It is absolutely possible, and with things like ZeroTier or Wireguard - it would be pretty easy to link various local Pi’s running things like ZWaveJS and Zigbee2MQTT to a Cloud instance of Home Assistant, without requiring port forwarding everything. The lag it would introduce may be noticeable, but probably not excessive. But the vast majority of the things people integrate in to Home Assistant, just wouldn’t be possible to do once it software stops being local.

1 Like

Besides the caveats already mentioned, I don’ really see showstoppers.
Personally, I would use tailscale as a VPN, with an exit node somewhere in your lan, so that your cloud HA have access to/from your LAN.

That’s for the “Container” version, ofc. No way of using HAOS or “Supervised”, here.

I do run my HA in Cloud in supervised install on ARM64 debian VM using site2site VPN, only thing I did not get to work is mDNS etc. so I need to add esphome devices by ip.

I now wonder if it would be possible somehow do HA cluster with yellow running at home. So than both main internet connection failure and local hw failure are somewhat covered.

For the “critical” things like wall switches I do have esphome setup that if it can’t communicate with HA then it uses relay to turn off/on the lights instead of sending command to HA a and HA sending command to light afterwards.
It my opinion this is kinda must for working home control things - have network control only as one layer over the electrical so even if the server is down or router is broken you can control the things same as before. Only there is no automation.

I know zigbee supports direct communication between devices, but I did not have much luck with zigbee devices in general and I’m moving everything possible to where it all started - wifi.

This is all very interesting. I am new to HA and trying to learn how it works before committing. My first idea was to install it on a IaaS provider. Cloud is a too wide concept and apparently normally refers to SaaS in this community but they are totally different cloud models, with the only commonality is that it runs outside your home (when talking about public cloud, obviously). But then I am learning that the communication actually goes via the HA server itself which is a let down. Other older domotic systems used to work in “serverless” way which for me is the right way (e.g. Lonworks). i.e. once configured, a switch only requires communication with a bulb in order to turn it on… Does Home Assistant support anything like that?

That’s a feature of the protocol, e.g. zigbee.
If you want that p2p communication, what do you want HA to do?

I like this idea and was googling for the same, and found your article. If popular HA integrations can run in such an environment, it would indeed be interesting. If you consider running HA as a service for someone else, cloud is definetly an intersting option. Then the personal argument of many, for avoiding cloud, becomes irrrelevant and other arguments more important.

google led me here looking into solutions like this.

in most cases, individual devices will never be more efficient than a centralised solution in a data center. Even in smaller scale, imagine installing individual devices in each flat of a big apartment building vs 1 server in the basement of that building. A lot more optimisation is possible when scaling such things

I seriously doubt that, because there is lots of unneeded overhead between what could have been a passively cooled low end device in close proximity and your airconditioned data center.

I realise this is very after the fact and apparently only the OP liked the idea… but as a newcommer to home automation, I started setting up a system entirely of my own creation with arduinos tunnelling through a Pi 1b to a control system I wrote myself, running in GCloud. I then stumbled across Home Assistant. Thought I’d try it out… it simply never occurred to me to put it anywhere other than in the cloud, it comes in a docker image, I mean where else would I put it!? I see that evreyone here talks about using Pi 4 boards, not sure how much money you all have, but they are minute computers for £150 ($175?), why would you do that? I just don’t get it. But maybe you’ve had them all for years back before the virus+war. Anyway, in case the OP is interested: yes its possible, in fact its very straight forward. You referenced being very used to AWS, setting up VPNs and the necssary NAT rules to allow discovery across subnets is pretty trivial if you are really building infrastructure in your day job in AWS. I did mine in google cloud as it just happen to be what I was logged into at the time. Even easier in Azure. Anyway, it costs nothing (literally), and is very straight forward with a guide or two. Our old firewall would have been a good endpoint, but have just gone to fibre to the premises, and I couldn’t be bothered to setup my own router this time so used an old Pi 1 to do the tunneling (again, see the 3 billion articles, you can configure a Pi to be everything between a very capable firewall on in its own right, through to just running a tunnel, in my case I just needed to make sure all the sensors, heat pump controllr and lighting refrenced the Pi as their gateway, if I wanted to hookup TVs and media I’d dig a firewall out of the cupboard and use that for my whole lan again.)

Anyway, just wanted to say to anyone searching for the same thing - yes it is possible, no its not at all tricky if you can read a simple guide or two, if you have decent internet there shouldn’t be any lag (I have almost no perceptible lag - I hit button, lights turn on before my finger is off the touch pad). Not saying I wouldn’t stick it on a Pi if they cost < $50, but they are currently triple that so, er… no.

Thanks for offering some real-world experience.

I think you hit on a real issue in the HA world. I stumbled across HA when I was looking for an excuse to try out the (then) inexpensive RPi. Back then, HA development, support and documentation was all geared toward running on that platform.

Fast forward to today, and if you even mention the RPi in a post here, there’s a good chance you’ll start a long dialog with people who insist that’s nowhere near enough horsepower, and you should go out and buy a [insert much more powerful and expensive device here.]

Of course, there are lots of wonderful things HA can do if you throw enough time, money, processor, storage and memory at it. But I sometimes wonder if we’ve lost the focus on the basics. I really don’t need streaming audio or video, an AI voice assistant, or a massive database of everything my HA system ever recorded. I suspect I’m in the minority these days.

As someone with a lot of networking knowledge who tried it - it is currently impossible to run Home Assistant in the cloud. HA has a monolithic architecture which is regrettably as archaic as it is hard to change at this point in time. The monolith essentially means that HA was never properly split into its separate components (UI, storage, connectivity, integrations) and is therefore in no way capable of running the integrations on another host than the rest. Changing to enable the core system and the persistence layers on a cloud server, attach a number of dynamic integration proxies (of which one on a Pi or Arduino at my home), and then select per integration on which proxy to run it would require a fundamental and very painful refactor or even rewrite of HA.

The alternatives are not viable. While for example Zigbee2MQTT will happily run like this (it’s implictly its own proxy and you can just connect MQTT via VPN or even public internet) integrations that depend on LAN features like discovery - not so much. Setting up a VPN, with a bunch of complex routing rules, will eventually get you to the point where your cloud instance can directly control your Sonos device or whatever. It will however never discover them, as broadcasts are not forwarded by any bridging VPN for very good reasons, and even if you manage to do it (I did in the end) the integrations are most of the time still broken because they assume L2 connectivity features. So you end up with a system that works a lot of the time, or appear to do so, and you cannot rely on it which defeats the entire purpose of a home automation system.

The reason I tried to set it up are simply reliability and stability. When the electricity drops in my house, or the fuse my Pi is connected to blows, or my fiber modem crashes, in a well designed microservices architecture with proper redundancy it should just list the integrations that run there as temporarily unavailable. My Home Assistant should then still be accessible (via 4G/5G if need be), still show web integrations like my calendars and weather reports, hell even my Tesla integration would still work, HA would just be a bit less functional. The idea is awesome. But impossible.

TL;DR: HA is designed to be run as a whole on a single system. Having most of HA run somewhere and just some integrations somewhere else is currently not feasible. If they ever refactor the ‘integration hosting’ away from the core awesomeness can ensue but not today.

(disclaimer: I use the shorthand term ‘in the cloud’ for what it actually means: “a computer of which the physical location is unspecified and unimportant to its use”. This may be a colocated uber-secure personal server, an AWS/GC/DO/Azure machine or a VM from a local vendor, whatever floats your boat. Concerns about specific cloud vendors are irrelevant to this discussion)

I’ve been following this thread because I love it when people explore innovative options. Proving that a new approach like this actually worked could open up possibilities I hadn’t even considered before.

To me, this is the bottom line. I take the Home in Home Assistant as the key element. If my home is “down” (power, network, whatever) then whether or not HA is available becomes moot. I have weather and calendar apps on my phone.

I don’t have a Tesla, but I assume the same is true for that. If the car can still communicate with the manufacturer’s cloud, you can still use their app even if you can’t communicate with your HA instance.

So having HA accessible when the rest of my home isn’t, wouldn’t be of any value to me. I know it’s possible to add all kinds of functionality to HA which isn’t directly related to home monitoring or automation, but that’s not its primary purpose. HA is the best tool for this task, but not every task.