custom-components / remote_homeassistant

Links multiple home-assistant instances together
Apache License 2.0
929 stars 81 forks source link

bi-directional use? #40

Closed Flipsoo closed 3 years ago

Flipsoo commented 4 years ago

Hello, Ive tried to get a setup running where 2 instances of hassio connect together, but while i have to restart one instance to get the custom component running, the second instance only has the entities but doesnt get new state changes - the one last rebooted works great but the other doesnt. is there a trick or something in the readme im missing for that behavior?

Greetings to all of you:)

marc-romu commented 3 years ago

I've tried to connect two instances of home assistant together with remote_homeassistant version 3.1. My configuration is something like this:

Instance 1
remote_homeassistant:
  instances:
  - host: 192.168.10.1
    port: 8123
    entity_prefix: "ha2_"
    access_token: !secret access_token_to_2
    verify_ssl: false
    secure: false
    include:
      entities:
      - sensor.indoor_temperature
      - sensor.indoor_humidity
      - sensor.indoor_co2
      - light.bedroom
    subscribe_events:
      - state_changed
      - service_registered
      - mobile_app_notification_action
Instance 2
remote_homeassistant:
  instances:
  - host: 192.168.20.1
    port: 8123
    entity_prefix: "ha1_"
    access_token: !secret access_token_to_1
    verify_ssl: false
    secure: false
    include:
      entities:
      - sensor.downstairs_temperature
      - sensor.upstairs_temperature

Problem

While one instance is stopped or being restarted, the other one works fine. When both instances are running, UI heavily decreases performance and it's almost impossible to interact with. I haven't been able to see what happens in live because both instances get collapsed and I cannot see any relevant error or warning in logs. I think it could be happening something like this:

I've tried to disable subscription to state_changed and service_registered on instance 1 and now there is no performance decrease, but sensors are not updated either.

    subscribe_events:
#      - state_changed
#      - service_registered
      - mobile_app_notification_action

Is there any known solution for it? Thanks!

mindtripper commented 3 years ago

@marc-romu I have the same issue using any version above 2.3. CPU goes through the roof on both instances. Using the 2.3 on one instance and 3.3 on the other works. Same goes for 2.3 on both instances. No performance impact.

Would like to be able to run 3.3 on both instances.

I only use the following;

    subscribe_events:
    - state_changed
postlund commented 3 years ago

I removed the service_registered event internally so it should work as before. A new release is out, should be available via HACS soon.

mindtripper commented 3 years ago

Hah! Problem solved. Running 3.4 on both instances with normal system utilization.

Thank you!

marc-romu commented 3 years ago

Yes, now works! Thanks!