Two Home Assistants with nothing between them

The apartment and the country house each got their own Home Assistant with no bridge between them. How one vendor account is split into two homes, why the country house stood without devices for twenty-five days, and what layered diagnostics does about it.

I have smart devices in the apartment and in the country house, and the vendor accounts are shared, one for both homes. Each home has its own Home Assistant, and there is nothing between them: no MQTT bridge, no entity mirror, no shared database.

I set them up together with Claude. By then both homes were already described in a registry, the same way infrastructure is described in code. I built the smart home the way I am used to building systems: it is a direct consequence of my experience in IT, only with an agent as a pair.

Why not one for two homes

The country house runs on its own power setup: the grid, an inverter, a generator. It needs to be controlled when something has gone wrong, and on such days the link to the apartment often goes down too. If the Home Assistant in the apartment controlled everything, the country house could not be controlled at the worst moment.

So the country house one runs on the country house server and must work without a link to the apartment, and the apartment one knows nothing about the country house. Two things connect them, and both work without either of them: a link tile to the panel of the neighboring home and an agent that has access to both.

As a bonus, I did not have to touch the firewall. The devices of each home talk to their own Home Assistant in their own network, and nothing has to be opened between the homes.

Both run in containers, each in the smart device segment of its home and under its own address. Devices find each other by broadcast, and broadcast does not cross segments. The configuration is done by scripts through the API, and the apartment has 33 scripts. After them the apartment has 429 entities and 24 automations, the country house 224 and 20.

One account for two homes

Stock integrations pull in every device of the account and do not ask which home it is in. If nothing is done, one lamp will be toggled by two Home Assistants, and the question "who turned off the light" will have no answer.

Each vendor needed its own solution. From the Yandex smart home, the apartment one takes only devices whose name starts with the Russian word for "apartment". Tuya has no filter, so each one disables the other home's devices on its own side. We worked out which device belongs where not by names: Tuya devices announce themselves in their network every few seconds, and it was enough to listen to both networks.

Twenty-five days of a country house without devices

On October 3 the diagnostics showed 93 unavailable entities in the country house. They had been unavailable since September 8, since a routine restart of Home Assistant. The network, the broker, the containers and the vendor cloud were working, and there was not a single error in the log. There was nothing to notice it with earlier: I had no alerting for such a case.

In the eWeLink app devices are sorted into "homes", and the integration has an option for which home to take. An empty option means "the current home of the account". That time the current one was the apartment. The country house Home Assistant received four apartment devices and did not receive its own twenty-five.

The fix took a minute: I pinned the home in the options explicitly, and the devices came back. It is now pinned in both homes, and switching in the app does not affect anything.

The router that stopped being polled

In the apartment, presence is tracked by the router integration. On September 3 the router failed to answer once, and right after that refused authorization once with the correct password. Home Assistant opened a reauthentication request and stopped polling the router altogether. The integration entry was listed as loaded, the entities were unavailable, and one line remained in the log. Nobody saw this for three weeks, for the same reason as in the country house. Then the same thing happened again after a single timeout, for six more days.

I did not find out why the router refused: it keeps its log in memory. Reloading the integration entry helps, and an automation now does that. Ten minutes without data from the router, and it reloads the entry; if that fails, it retries in half an hour.

The leak sensor is not cured by a reload. After a network failure it began accepting a connection and closing it without an answer, and the only thing that helps is cutting its power. The integration was writing about a thousand errors a week, which is 99% of the log, and I disabled it. The sensor shuts off the water on a leak by itself, without Home Assistant; only the voice and the notification do not work.

Layered diagnostics

These failures have one thing in common: they are silent. There is no error, the entry is "loaded", and the devices are gone. A "Home Assistant responds" check does not see that.

So in both homes you can ask "what is going on with the house". The check goes layer by layer, from the house down to the hardware: the country house has nine of them, from the electrical system and heating to the server and Home Assistant itself, the apartment has eight. A layer answers with one of four words: normal, warning, failure or "no data". "No data" counts the same as a failure: there is no source, so the layer is not checked.

After the router story the diagnostics got a line about integrations whose entities all disappeared at once. The count is by physical devices, not by entities.

The answer comes by voice, one line per layer, and the full report with numbers goes to a notification. It was the diagnostics that found the country house without devices.

What Home Assistant does by itself

An event is caught by whoever sees it. The loss of power is detected by the power monitor, and Home Assistant only voices what arrived over the event bus. It keeps its own thresholds only for appliances that nobody but it knows about.

In the country house that is load shedding. When the house switches to the inverter, Home Assistant turns off the water heater and both stages of the boiler: the battery cannot carry them. When the current at the mains input approaches the limit, it acts in steps:

Input currentWhat happens
40 Aannounces the current and the margin before cutoff
45 Aturns off the water heater
48 Aturns off the heating cables
below 35 A for ten minutesturns back on what was turned off

The first threshold is a voice one: a person has a chance to turn off the kettle themselves. The input protection does not touch the boilers at any current: in winter they are the heating of the house.

In the apartment Home Assistant talks more than it acts. It talks about stuffy and dry air and switches nothing by itself. It does not interfere with the water shutoff at all.

The agent asks for permission

The agent kept its access to both Home Assistants. At home I have my own DevOps engineer who is on call around the clock: an agent on a Mac mini.

In the country house there are rules on the mains input relay, the inverter line, the boilers, the water heater, the heating cables and the boiler room ventilation. A call goes into a queue and waits until I press "approve" or "reject"; if I stay silent for 120 seconds, the call is not executed. There are no rules on reads, otherwise I would have to approve even a look at the boiler state.

The tool that edits the rules themselves is disabled for the agent: it must not change the restrictions that are placed on itself.

Two things are still ahead. The first: for the agent to go through both homes once a week by itself, look for anomalies and propose solutions, instead of waiting for the question "what is going on with the house". The second: the main thing, for the sake of which everything was split in two, I have not tested yet, namely how the country house works with the link to the apartment cut.

Tags: Architecture, Automation, Diagnostics, Self-hosting

LinkedIn X Telegram

Read next

Comments