Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting instances together, recurssive hell #294

Open
samuelkadolph opened this issue Jul 2, 2024 · 3 comments
Open

Connecting instances together, recurssive hell #294

samuelkadolph opened this issue Jul 2, 2024 · 3 comments

Comments

@samuelkadolph
Copy link

samuelkadolph commented Jul 2, 2024

I have two locations and I want to be able to trigger an automation when moving between them that turns lights on/off or AC on/off depending on which direction. I've tried now to cross connect the two instances with remote_homeassistant and it eventually breaks one of the instances with tens of thousands of entities with recurssive prefixes despite setting all domains to exclude. I only want 1 script shared on both sides. Is this a supported use case or a big no-no?

My .storage/core.entity_registry went from 580 lines to 15k and some things grind to a halt. Such as voice assistant expose list. You cannot remove all of the entities using the UI. I had to edit the file to remove the entries to restore that instance.

For example:

{"config_entry_id":null,"entity_id":"cover.home_home_home_home_home_home_home_home_home_home_home_nook_shade","id":"xxxxxx","orphaned_timestamp":1719811682.3736324,"platform":"remote_homeassistant","unique_id":"xxxxxx_cover.home_home_home_home_home_home_home_home_home_home_home_nook_shade"},

{"config_entry_id":null,"entity_id":"cover.home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_nook_shade","id":"xxxxxx","orphaned_timestamp":1719811737.5438871,"platform":"remote_homeassistant","unique_id":"xxxxxx_cover.home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_nook_shade"},

      {"aliases":[],"area_id":null,"categories":{},"capabilities":null,"config_entry_id":null,"device_class":null,"device_id":null,"disabled_by":null,"entity_category":null,"entity_id":"cover.home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_4453","hidden_by":null,"icon":null,"id":"xxxxxx","has_entity_name":false,"labels":[],"name":null,"options":{"cloud.alexa":{"should_expose":false}},"original_device_class":null,"original_icon":null,"original_name":null,"platform":"remote_homeassistant","supported_features":0,"translation_key":null,"unique_id":"xxxxxx_cover.home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_home_nook_shade","previous_unique_id":null,"unit_of_measurement":null},
@jaym25
Copy link
Collaborator

jaym25 commented Jul 2, 2024

@samuelkadolph
I would use Remote HA to transfer entities you're interested in and run scripts and automations locally...

If you would like to post your Remote HA config YAML and any scripts or automations referenced in it, a solution may come.

@samuelkadolph
Copy link
Author

I'm thinking this is just a flaw that no one has run into yet. Importing some entities or the script wouldn't make a difference. After digging into the code a bit I made a yaml config (was using UI before) that by default no domains or entities are included and that solved the issue for me. Working configs:

hass2
remote_homeassistant:
  instances:
  - host: hass1
    port: 443
    secure: true
    verify_ssl: false
    access_token: XXX
    include:
      domains: ["none"]
      entities: ["light.does_not_exist"]
    service_prefix: hass1_
    services:
    - script.travel_arriving
hass1
remote_homeassistant:
  instances:
  - host: hass2
    port: 443
    secure: true
    verify_ssl: false
    access_token: XXX
    entity_prefix: hass2_
    include:
      domains: ["none"]
      entities: ["light.does_not_exist"]
    service_prefix: hass2_
    services:
    - script.travel_arriving

To test the recursive entity I created a counter helper because I am not using any. Using this config you end up with a very quick growing recursive entity list of counter.hass1_hass2_hass1_hass2_hass1_hass2_hass1_hass2_hass1_hass2_hass1_hass2_abc.

hass2
remote_homeassistant:
  instances:
  - host: hass1
    port: 443
    secure: true
    verify_ssl: false
    access_token: XXX
    include:
      domains: ["none", "counter"]
      entities: ["light.does_not_exist"]
    service_prefix: hass1_
    services:
    - script.travel_arriving
hass1
remote_homeassistant:
  instances:
  - host: hass2
    port: 443
    secure: true
    verify_ssl: false
    access_token: XXX
    entity_prefix: hass2_
    include:
      domains: ["none", "counter"]
      entities: ["light.does_not_exist"]
    service_prefix: hass2_
    services:
    - script.travel_arriving

There either needs to be a way to detect the entity recursion and stop it, prevent cross connecting instances like this with an error, or an option to disable entity includes by default.

@samuelkadolph
Copy link
Author

Also this really hoses your hass core.entitiy_registry and requires manual editing to remove the entities and borks the voice assistant UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants