Having Trouble linking 2 rpi4 with HA together

its been 2 weeks I tried everything, did some reading ( btw have my HA up for about 3weeks), but cant seem to get anything to work, mainly not fully understanding what iam reading from a-z.
can someone please walk me through what has to be done or tell me a link where thing are
spelled out from a-z on how I can link my to HA’s (with different locations). so far I love my HA, I have gotten everything else I wanted on it to work !!! this is my last piece of the puzzle thanks jeff !!!

ps i did install hacs (someone gave me a GREAT link on how to install it) an even tried the remote HA from there !!

Q1. Are install remote or both in same LAN?

Q2. Do you want use mqtt, API or no clue?

Q3. What is linking purpose?
View both instance in single pane or manage both instances

different-- home and summer home
– no clue
like to manage from one spot
and also if a water sensor trigger at me summer home have it trigger a siren at my house
thanks jeff

RE Q2.
I prefer API.
I try MQTT eventstream and statestream and found it sloppy.
For Example1… Maybe summer home you use sensor for gate entry open/close and switch for control motor of gate. MQTT put both sensor and switch into Main Instance and use existing friendly_name. This created (3) problem for me.

  1. I want to expose in main as cover so I.use template.covernto do this but now have (2) more entity cluttering states
  2. friendly_name may conflict with similar in main instance so must take care of this even for discovered device
    3.after reboot main server sometimes mqtt not reconnect remote so had to be careful of this or other MQTT issue

For single sensor MQTT OK but honestly it can make your install cluttered and is less flexible in my opinion.
Creating same cover.entity with API only require setup template cover in main Instance.
I can take multiple sensor and combine to 1 of any type.
Connection 100% if network OK and HA running
API likely have more network overhead than mqtt but I’d imagine this not be big impact for most install.

This said…I explain API method unless you have reasoning for want MQTT. I post example of API connected sensor and switch later today.
What you’ll basically do is

  1. I would use vlan home>>summer home so both affectively same network. This provide secure portal for you connect directly to manage from home and secure connect for HA to HA connect. Is this easy/possible for you?

2 create “long lived access token” for HA at summer home. Name it “main”. Name not matter but basically I name all token for remote to main instance main.

  1. Determine how summer home will show in Lovelace. Honestly since it is vlan you could add it to side bar but I never do this. Imagine you want add as tab in UI

4.replicate all entity you want from Summer home in main instance (I post examples of this later). #3 purpose before this step is so you understand what you need to actually expose. For example, you may have (x4) light but always ON together. In this case you use template switch to create single entity in main instance by calling light.turn_on <light.iforgethowwilfcardthis> from Summer home ha in template switch created in main ha

  1. Add created summer home entity to main UI

Sorry a lot of back and forth but hopefully you get basic concept. I post how create API entity later

Q3.
All automation you do in main instance.
It not necessary to do any UI setup for summer home. I only recommend previously do to I not know true WAN reliability.anf not want you 100% dependant on main when onsite. If this not concern maybe no big deal. If you rent property definitely setup to allow limited local use.

EXAMPLE 1: remote HA has cover entity that displayed in main HA as cover.southgate

- platform: command_line
  covers:
    southgate:
      command_open: '/usr/bin/curl -X POST -H "Authorization: Bearer $mytoken%" http://192.60.27.52:8123/api/services/cover/open_cover'
      command_close: '/usr/bin/curl -X POST -H "Authorization: Bearer $mytoken%" http://192.60.27.52:8123/api/services/cover/close_cover'
      command_stop: '/usr/bin/curl -X POST -H "Authorization: Bearer $mytoken%" http://192.60.27.52:8123/api/services/cover/open_cover'
      command_state: '/usr/bin/curl -X GET -H "Authorization: Bearer $mytoken%" http://192.60.27.52:8123/api/states/cover.south_gate'
      value_template: '{% if value_json.state == "open" %}
                       0
                       {% elif value_json.state == "closed" %}
                       100
                       {% endif %}'
      friendly_name: South Gate

EXAMPLE 2: remote HA has CEC device controlled by HA switch service

- platform: command_line
  switches:
    projector_jvc:
      command_on: '/usr/bin/curl -X POST -H "Authorization: Bearer $mytoken%" -H "Content-Type: application/json" http://192.60.27.15:8123/api/services/hdmi_cec/power_on'
      command_off: '/usr/bin/curl -X POST -H "Authorization: Bearer $mytoken%" -H "Content-Type: application/json" http://192.60.27.15:8123/api/services/hdmi_cec/standby'
      command_state: '/usr/bin/curl -X GET -H "Authorization: Bearer $mytoken%" -H "Content-Type: application/json" http://192.60.27.15:8123/api/states/media_player.hdmi_0'
      value_template: '{{ value_json.state == "on" }}'
      friendly_name: Projector

EXAMPLE 3: remote HA has cover entity that is converted into switch entity in Main HA instance. Cover function was not desired and simple operation as switch was preferred

- platform: command_line
  switches:
    southgate:
      command_on: '/usr/bin/curl -X POST -H "Authorization: Bearer $mytoken%" http://192.60.27.52:8123/api/services/cover/close_cover'
      command_off: '/usr/bin/curl -X POST -H "Authorization: Bearer $mytoken%" http://192.60.27.52:8123/api/services/cover/open_cover'
      command_state: '/usr/bin/curl -X GET -H "Authorization: Bearer $mytoken%" http://192.60.27.52:8123/api/states/cover.south_gate'
      value_template: '{{ value_json.state == "closed" }}'

thanks i will look it over and see if i can work my way through it !!!—i will let you know !!