Master HA instance with multiple slaves

So my home is 5,000 sq ft. Basement, main floor and upstairs. I have a casita for the inlaws (just a small 500 sq ft. loft style home) and believe it or not I don’t use any wifi devices. My wifi and networking adventure is a blog unto itself.
So all my light switches, dimmers and appliances are on zwave plugs. I use zooz zwave power strips (the new model has power monitoring) and I also have two Sonnen Smart Batteries that have various zwave sensors. I have 3x zwave power consumption meters, my pool automation is all zigbee, I have occupancy sensors in each room (Aeotec 6 in 1) as well as zwave sensors for water, etc. I mostly use Aeotec devices and zooz devices and GE switches. some of my wall outlets are zwave also. I find that using appliance plugs for microwave, dishwasher, washing machine is good, and then i use the heavy duty 40 amp switches for my AC units, oven, dryer, water heater, etc. When you get zwave stuff cheap from work, it is easy to go crazy :slight_smile: but again, no wifi - my wifi networks are cluttered as is. I organize my display via floor, then room. And I have a personalized summary view (made in appdeamon ) for what matters most to each person. The wife likes to know if the alarm is set, if any windows are open, her eta to work and if the wash/dryer/diswasher are done. I like to see power data so i made a dashboard showing my various power consumption metrics from various devices. The Sonnen Smart Batteries i got a few years ago are what started me down this addicting home automation adventure.

@oriolism all i did was create a folder called “custom_componets” and put the remote_homeassistant.py file in there. I set the linux permissions to allow executing the script via ssh (I use chmod 777 just because I did not want to troubleshoot permissions).

THan I enabled legacy api authentication on the slave devices per here: Authentication providers - Home Assistant

Then i added this to my configuration.yaml

remote_homeassistant:
  instances:
  - host: 192.168.1.219
    port: 8123
    api_password: !secret http_password
    entity_prefix: "rpi1_"
    subscribe_events:
    - zwave.network_ready
    - zwave.node_event

Rebooted the slave first, then the master, and everything magically appeared :slight_smile:

2 Likes

Thanks! I’ll try that later.

Thank you for the detailed reply! Those Sonnen batteries do look very cool. You definitely dove in with both feet - sounds like quite the setup!

Be careful with:

api_password:

http.api_password - Deprecated - Users who are still using api_password for authentication will need to move its configuration under auth_providers. Please see the updated documentation for further details. Those who don’t make this change will see an INFO level reminder in the Home Assistant logs until the fix is made for a time, but please note, api_password authentication will eventually be removed completely and we advise users to change to use one of the other authentication methods. If you manually specify auth providers in your configuration.yaml , you will need to migrate your API Password from the http section to the auth provider section to continue using it.

1 Like

Yep. Writing is on the wall for this custom component unless Lukas, or someone else, revises it in the near future.

Thanks for the heads up about the API password. I just decided to use trusted networks instead. /32 works for a single trusted ip.

Okay, adding support for access_token was an easy fix - that’s also possible now :slight_smile:

And thanks again for the feedback, it’s really appreciated. I’m happy to see the component still used (besides in my own installation of course).

3 Likes

The access_token you are referring is it a “Long-Lived Access Token” issued inside the profile page of HA?
I tried to set it up with these settings:

remote_homeassistant:
  instances:
  - host: 10.0.0.202
    port: 8124
    secure: true
    access_token: !secret ha_remote_access_token
    # api_password: !secret ha_remote_api_password
    entity_prefix: "slave_local_"

But, im getting “could not connect” errors.

Could not connect to ws://10.0.0.202:8124/api/websocket, retry in 10 seconds...

I tried both with secure true and false.
I also enabled websocket_api: on slave (don’t know if that’s relevant)
Any ideas?

1 Like

8124 is not the default Port for home assistant. Try changing the port to 8123 which is the default for home assistant.

My master instance works on 8123, so i set up the slave at 8124 (for now, that i have them inside the same network in order to configure duckdns things)
I access it via ip:8124 am i not supposed to use the same for the remote component?

I tried with 8123 just in case, still getting the same error.

Can you ssh into the master and run curl to the slave is and port?

I can ssh into the master but, can you explain in more detail what you mean after that? :slight_smile:

Sure! Curl is just a command line tool to check web socket connectivity. Here is a guide with some examples. https://linuxize.com/post/curl-command-examples/#what-is-curl
Curl should already be installed. So after you ssh into the master, just Run the command curl ipaddress:port. And see what you get :slight_smile:

Using this topic with some problems. I have installed the custom component at my master HA. At the slave I entered my user profile and created a “Long-Lived Access Tokens”.

This is my config at the master HA:
remote_homeassistant:
instances:

  • host: 10.8.0.6
    port: 8123
    secure: false
    access_token: Long-Lived Access Tokens
    entity_prefix: “garage_pi_”

Looks like something is wrong with the token i created at the slave HA or how I write it in the configuration, I tired with " " or ’ ’ or nothing but the same error.
Got the following from master HA:
ERROR (MainThread) [custom_components.remote_homeassistant] Auth invalid, check your access token or API password

And this in the slave:
WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 192.168.24.103

EDIT: Something wrong with copying of API key, created new one and it worked perfect

ssh’ed into my master hass.io:

core-ssh:~# curl 10.0.0.202:8124
curl: (52) Empty reply from server

core-ssh:~# curl 10.0.0.202
curl: (7) Failed to connect to 10.0.0.202 port 80: Connection refused


Is that ok?

Will try to repicate your steps exactly, see what happens in my case.
BTW, Do you have duckdns add-on installed on both machines?
Do you have websocket_api: in your configuration.yaml?

edit:
I was able to connect by disabling all the duckdns related stuff (addon and code in conf)
Will try from remote locations with all that stuff enabled and see again.

Hi, thanks for sharing this wonderful feature. That’s exactly what I was looking for. However, I insert the .py file in custom components but it doesn’t work. It must be completed? and I also compiled in the Master machine config.yaml file with
remote_homeassistant:
instances:

  • host: 192.168.178.61
    port: 8123
    api_password: *********

but it doesn’t work. It must be completed?
You could explain the procedure better. I’m new to HA

Good day
Happy to help but I am not sure what bits are missing so I will walk through the setup again.
Under the HomeAssistant folder on the “Master” I created the custom_components directory (just like what is required for any custom cards and such)
I added the file from github called remote_homeassistant.py

In my configuration.yaml I have the following code - the key is to make sure are subscribing to the events or else nothing will be sent back to the master.

remote_homeassistant:
  instances:
  - host: 192.168.1.219
    port: 8123
    access_token: !secret access_token
    #entity_prefix: "rpi1_"
    subscribe_events:
    - state_changed
    - service_registered
    - zwave.network_ready
    - zwave.node_event
  - host: 192.168.2.219
    port: 8123
    access_token: !secret access_token2
    #entity_prefix: "rpi1_"
    subscribe_events:
    - state_changed
    - service_registered
    - zwave.network_ready
    - zwave.node_event

Hope that helps!

2 Likes

Hi, thanks for your reply. Now it work, but, I can only get it to work if I disable ssl certificates for https access with duckdns. Also I can only log in with api_password, with access_token it’s not possible. I am currently running the 0.85.0 versions on both servers.