GithubHelp home page GithubHelp logo

custom-components / remote_homeassistant Goto Github PK

View Code? Open in Web Editor NEW
818.0 39.0 74.0 538 KB

Links multiple home-assistant instances together

License: Apache License 2.0

Python 100.00%
hacs home-assistant hacktoberfest

remote_homeassistant's Introduction

License

hacs Project Maintenance

App icon

Remote Home-Assistant

Component to link multiple Home-Assistant instances together.

This component will set up the following platforms.

Platform Description
remote_homeassistant Link multiple Home-Assistant instances together .

The main instance connects to the Websocket APIs of the remote instances (already enabled out of box), the connection options are specified via the host, port, and secure configuration parameters. If the remote instance requires an access token to connect (created on the Profile page), it can be set via the access_token parameter. To ignore SSL warnings in secure mode, set the verify_ssl parameter to false.

After the connection is completed, the remote states get populated into the master instance. The entity ids can optionally be prefixed via the entity_prefix parameter.

The component keeps track which objects originate from which instance. Whenever a service is called on an object, the call gets forwarded to the particular remote instance.

When the connection to the remote instance is lost, all previously published states are removed again from the local state registry.

A possible use case for this is to be able to use different Z-Wave networks, on different Z-Wave sticks (with the second one possible running on another computer in a different location).

Installation

This component must be installed on both the main and remote instance of Home Assistant

If you use HACS:

  1. Click install.

Otherwise:

  1. To use this plugin, copy the remote_homeassistant folder into your custom_components folder.

Remote instance

On the remote instance you also need to add this to configuration.yaml:

remote_homeassistant:
  instances:

This is not needed on the main instance.

Configuration (main instance)

Web (Config flow)

  1. Add a new Remote Home-Assistant integration

  1. Specify the connection details to the remote instance

You can generate an access token in the by logging into your remote instance, clicking on your user profile icon, and then selecting "Create Token" under "Long-Lived Access Tokens".

Check "Secure" if you want to connect via a secure (https/wss) connection

  1. After the instance is added, you can configure additional Options by clicking the "Options" button.

  1. You can configure an optional prefix that gets prepended to all remote entities (if unsure, leave this blank).

Click "Submit" to proceed to the next step.

  1. You can also define filters, that include/exclude specified entities or domains from the remote instance.


or via..

YAML

To integrate remote_homeassistant into Home Assistant, add the following section to your configuration.yaml file:

Simple example:

# Example configuration.yaml entry
remote_homeassistant:
  instances:
  - host: raspberrypi.local

Full example:

# Example configuration.yaml entry
remote_homeassistant:
  instances:
  - host: localhost
    port: 8124
  - host: localhost
    port: 8125
    secure: true
    verify_ssl: false
    access_token: !secret access_token
    entity_prefix: "instance02_"
    include:
      domains:
      - sensor
      - switch
      - group
      entities:
      - zwave.controller
      - zwave.desk_light
    exclude:
      domains:
      - persistent_notification
      entities:
      - group.all_switches
    filter:
    - entity_id: sensor.faulty_pc_energy
      above: 100
    - unit_of_measurement: W
      below: 0
      above: 1000
    - entity_id: sensor.faulty_*_power
      unit_of_measurement: W
      below: 500
    subscribe_events:
    - state_changed
    - service_registered
    - zwave.network_ready
    - zwave.node_event
    load_components:
    - zwave
host:
  host: Hostname or IP address of remote instance.
  required: true
  type: string
port:
  description: Port of remote instance.
  required: false
  type: int
secure:
  description: Use TLS (wss://) to connect to the remote instance.
  required: false
  type: bool
verify_ssl:
  description: Enables / disables verification of the SSL certificate of the remote instance.
  required: false
  type: bool
  default: true
access_token:
  description: Access token of the remote instance, if set.
  required: false
  type: string
max_message_size:
  description: Maximum message size, you can expand size limit in case of an error.
  required: false
  type: int
entity_prefix:
  description: Prefix for all entities of the remote instance.
  required: false
  type: string
include:
  description: Configures what should be included from the remote instance. Values set by the exclude lists will take precedence.
  required: false
  default: include everything
  type: mapping of
    entities:
      description: The list of entity ids to be included from the remote instance
      type: list
    domains:
      description: The list of domains to be included from the remote instance
      type: list
exclude:
  description: Configures what should be excluded from the remote instance
  required: false
  default: exclude nothing
  type: mapping of
    entities:
      description: The list of entity ids to be excluded from the remote instance
      type: list
    domains:
      description: The list of domains to be excluded from the remote instance
      type: list
filter:
  description: Filters out states above or below a certain threshold, e.g. outliers reported by faulty sensors
  required: false
  type: list of
    entity_id:
      description: which entities the filter should match, supports wildcards
      required: false
      type: string
    unit_of_measurement
      description: which units of measurement the filter should match
      required: false
      type: string
    above:
      description: states above this threshold will be ignored
      required: false
      type: float
    below:
      description: states below this threshold will be ignored
      required: false
      type: float
subscribe_events:
  description: Further list of events, which should be forwarded from the remote instance. If you override this, you probably will want to add state_changed!!
  required: false
  type: list
  default: 
  - state_changed
  - service_registered
load_components:
  description: Load components of specified domains only present on the remote instance, e.g. to register services that would otherwise not be available.
  required: false
  type: list
service_prefix: garage_
  description: Prefix used for proxy services. Must be unique for all instances.
  required: false
  type: str
  default: remote_
services:
  description: Name of services to set up proxy services for.
  required: false
  type: list

Special notes

Missing Components

If you have remote domains (e.g. switch), that are not loaded on the main instance you need to list them under load_components, otherwise you'll get a Call service failed error.

E.g. on the master:

remote_homeassistant:
  instances:
  - host: 10.0.0.2
    load_components:
    - zwave

to enable all zwave services. This can also be configured via options under Configuration->Integrations.

Proxy Services

Some components do not use entities to handle service calls, but handle the service calls themselves. One such example is hdmi_cec. This becomes a problem as it is not possible to forward the service calls properly. To work around this limitation, it's possible to set up a proxy service.

A proxy service is registered like a new service on the master instance, but it mirrors a service on the remote instance. When the proxy service is called on the master, the mirrored service is called on the remote instance. Any error is propagated back to the master. To distinguish proxy services from regular services, a service prefix must be provided.

Example: If a proxy service is set up for hdmi_cec.volume with service prefix remote_, a new service called hdmi_cec.remote_volume will be registered on the master instance. When called, the actual call will be forwarded to hdmi_cec.volume on the remote instance. The YAML config would look like this:

remote_homeassistant:
  instances:
  - host: 10.0.0.
    service_prefix: remote_
    services:
      - hdmi_cec.volume

This can also be set up via Options for the integration under Configuration -> Integrations.


See also the discussion on home-assistant/core#13876 and home-assistant/architecture#246 for this component

remote_homeassistant's People

Contributors

acigl avatar borpin avatar davemuench avatar epenet avatar jbbde avatar jo-me avatar leandroissa avatar lukas-hetzenecker avatar marcucio avatar mattlongman avatar mcn18 avatar postlund avatar psarossy avatar tmcarr avatar tomrosenback avatar vwt12eh8 avatar wojked avatar wrt54g avatar zen3515 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

remote_homeassistant's Issues

step by step please

I don't know if this could be considered an issue but I don't understand how to make this work.
I read, once, twice, ten times the instructions... Still

  1. I added the integration using HACS but if I go to Configuration->Integration and press + there's no integration with the 'remote' word in its name

  2. As far as I understand, the slave Home Assistant machine is already a server which answers requests from the main one, the master.
    If so, do I still have to add
    websocket_api:
    in the slave machine configuration.yaml ? as stated in https://www.home-assistant.io/integrations/websocket_api/

  3. I found (2) while I was looking for the port number of the websocket, where do I find it ? If it's 8123, why would I change this port on a standard Home Assistant install. If it's the standard Home Assistant port number, not once it is mentioned "if ever you changed HA's port number you can specify your specific port number" the readme only says port number as if everybody knows what is the websocket api port number.

  4. Nohting in the readme says that the configuration should be added to the master configuration.yaml file (and even writing this I'm still not sure of it)

So please, be kind enough to write a few lines with very clear instructions on

  • what should be done on the master,
  • what should be done on the slave,
  • where the find the parameters (IP, port,etc),
  • when to restart Home Assistant and
  • how to acknoledge everything has been done right.

Thanks for your help

Regards

Vart

Not able to make home-assistant-remote work

Hi guys,

I am trying to figure out what to do in order to make the addon functional in my setup. Do you have any clues on why it does not work? Thank you so much for all your help. This is what I did:

-I checked that I can access both HA instances from outside of the network. (I did this with the help of ZeroTier One. Both are in the same virtual network now along with a laptop from where I can access them. From my laptop I can ping both HA instances and I can also access them in the browser by going to their IP address as created in ZeroTier One)
-I installed HACS on both HA devices and installed remote_homeassistant in HACS
-I created an access token in the remote instance of HA.
-In the remote HA instance (I called ggs) in the configuration.yaml file I only added remote_homeassistant:
-in the main HA instance (I called home) in the configuration.yaml file I added the following:

remote_homeassistant:
   instances:
   - host: [IP_ADDRESS_of_REMOTE_Instance_provided_by_ZEROTIER_ONE]
     port: 8123
     secure: false
     verify_ssl: true
     access_token: !secret ggs_access_token
     entity_prefix: "ggs_"

What else should I do?
Thank you once again for any help you can provide!
ygr

Include should take precedence over exclude...

In integrating my systems, I have many more entities which I would like to exclude than include.
It would be great to exclude specific domains and then list the particular entities I would like to include from those domains. I think it would make for a much smaller config file. In fact, I don't understand why there is an include section at all, if exclude takes precedence.
At the very least, include entities should take precedence over exclude domains.
Also, the acceptance of wildcards would be nice... Thank you for reading.

Error when starting homekit

Firstly, this component seems like a true miracle after messing around with socat, ser2net and usbip for what seems like forever, so, thank you!

I'm having an issue with with it when I start the homekit component. I have homekit disabled on startup, but when I run homekit.start, I immediately see the following in the log:

019-10-30 18:36:54 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/remote_homeassistant/__init__.py", line 264, in _recv callback(message) File "/config/custom_components/remote_homeassistant/__init__.py", line 387, in fire_event self._entities.remove(entity_id) KeyError: 'persistent_notification.config_entry_discovery'

After that, I might be able to switch one or two devices on or off (status might update in master hassio or homekit, mainly doesn't) before the devices on the remote instance stop being controllable from the master (locally and through homekit control).

I'm using the current version. I've tried changing the default port, but get the same result. Also tried removing all subscribe events, same result.

I'm seeing this behaviour in homeassistant version 0.100.3 & 0.101.0.

My config:

remote_homeassistant:
  instances:
  - host: !secret usb_ip
    port: 8234
    access_token: !secret usb
    entity_prefix: "usb_"
    include:
      domains:
      - sensor
      - switch
      - group
      - light
      - climate
    subscribe_events:
    - state_changed
    - service_registered
    - zwave.network_ready
    - zwave.node_event

Is there anything I'm missing?

Connected but sensors don't update

I'm connected to my remote instance, the binary sensor shows connected, but my sensors aren't updating. Is there any other way, besides the sensor, I can see why things aren't working? The remote assistant pointing the OTHER direction is working a treat, sensors ARE updating.
Is it perhaps not possible to have two remote assistants working bidirectionally?
Cheers

Client exceeded max pending messages

Hi,
I'm regularly (several times a day) seeing this message in the log of my master instance.
Is this related to home-assistant-remote?

Client exceeded max pending messages [2]: 512
11. September 2019, 21:19 components/websocket_api/http.py (ERROR) - message first occured at 11. September 2019, 20:33 and shows up 2 times

Thanks

Slave visible but not able to operate from master

So will open this as a new topic.

I have a master and slave instance connected and slave devices show up correctly on the master. I can see the correct state of my switches on my slave on the master, so if I switch to "on" on the slave this state mimics correctly on the master.

So all good except that I cannot operate the slave switches from my master. What would be the best way to investigate what is not working? When I try to switch from master the following appears in the log of the master:

Unable to find referenced entities switch.gardenpi_pool_lights
11:03:31 PM – helpers/service.py (WARNING) - message first occurred at 10:54:31 PM and shows up 3 times

Thanks a lot for your help!

Component sensor says it's connected when connection is refused for lack of token or password

I was going to use this without any security at all, since I don't need it (you'd have to get past my pfSense and know the internal IP address to get to my Hass instances - they are not accessible from outside). It seemed to work, but nothing populated. Finally after a tip from @postlund I checked the master Hass log, and that said it couldn't connect without an API password or a token. Adding a token fixed it right away. But the sensor said “hytte pi remote connection 192 168 1 101 8123” and had this info:

192.168.1.101
port
8123
secure
false
verify ssl
true
entity prefix
hytte_pi_

Here's the tread about this:
https://community.home-assistant.io/t/master-ha-instance-with-multiple-slaves/109849/79?u=mastiff

Support for template in host config?

For some reason, the DuckDNS add-on on a remote hassio keeps turning off so, I’m trying to set up a backup system for my ‘remote_homeassistant’ component.
I set up an automation on the remote home assistant to email me its ip every x hours, and i have created an SMTP sensor to read the ip.
So now i have a sensor.remote_ip which is (almost) always up to date.
Unfortunatelly, i guess the component does not support templating so my following config does not work.

remote_homeassistant:
  instances:
  - host: {{states.sensor.ha_remote_ip.state}}
    port: !secret ha_remote_port
    secure: true
    access_token: !secret ha_remote_access_token
    entity_prefix: !secret ha_remote_entity_prefix

Is there any way to work around this?

Unable to find referenced entities

Everything works fine but in the master HAss I get the following error in my log constantly:
Unable to find referenced entities switch.table_lamp

I get this for each switch I have exposed from the remote HAss

Accessing zwave.set_config_parameter from master instance

I have a master instance which is where I have almost everything (automations, scripts, scenes, etc.). My secondary instance is where a zwave radio is being used to connect zwave devices. One such device is an Inovelli Dimmer Switch, which has a LED on it that can be used for custom notifications.

To make use of this LED, I need to call the zwave.set_config_parameter service. I have done this successfully from my secondary instance (where zwave is configured), but (not surprisingly) my master instance doesn't know what the zwave.set_config_parameter service is.

I tried adding zwave.set_config_parameter to the list of subscribe_events: in my master instance config, but that didn't seem to work.

Is there any way to expose the zwave.set_config_parameter service to the master instance?

Thanks!

Camera stream not working

I am not sure if this is a limitation of home-assistant-remote, or perhaps an issue on my end. However, I am unable to get a camera stream working on the master instance of my Home Assistant. The console shows the following error, basically a 404: https://pastebin.com/raw/EUP8dVYj

{code: "start_stream_failed", message: "Camera not found"}
camera.brz_side:1 GET https://ha-instance.com/api/camera_proxy_stream/camera.brz_side?token=XXXX 404

EDIT: Taking a closer look at the README, it seems that only remote states are populated? So no luck getting the camera working I assume.

Location based items reporting as if at remote loaction

I have my master set up at my house and remote location is 700 miles away. For all my "Home" cards that are location based, such as my Home/Away status, sunset, sunrise are reporting as if from remote location.

Even though I am home with my phone, on my Home panel, it shows me as "Away". My sunset/sunrise time on my Home panel shows the sunset/sunrise time of the remote location.

Can this be solved by excluding some entities from coming from the remote location? Or is there something I ca put in config file to stop this from happening?

Other than this small issue - everything is working great. Love the functionality.

Thanks!

Setup instructions are not clear

It is not clear what needs to be done on the main host connecting out and or the remote host authentication-wise or if anything is needed at all.

Can you please update the readme to include an installation step by step and on what host steps are performed?

Does the remote_homeassistant module get installed on both the main and remote HA hosts?

TypeError: 'NoneType' object is not subscriptable

After noticing a dropped websocket connection in the slave instance I saw this log in the master instance:

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/remote_homeassistant.py", line 206, in _recv
    callback(message)
  File "/config/custom_components/remote_homeassistant.py", line 291, in fire_event
    state = message['event']['data']['new_state']['state']
TypeError: 'NoneType' object is not subscriptable

I just added the Zwave stick & zwave integration to the remote HA.

Toggle a switch on master is not working

I have a remote HASS.IO installation with a usb Z-Wave stick and some nodes. I see all the data correct in the master.
But when I try to switch on or off a z-wave device from the master nothing happens..

What can be wrong?
I think I don't see anything in a log-file but maybe I'm checking the correct log-file?

I'm not able to link to hassio

Can someone help me to link it ?

Thank you!

my log:
`
Logger: custom_components.remote_homeassistant
Source: custom_components/remote_homeassistant/init.py:176
First occurred: 16:54:39 (133 occurrences)
Last logged: 17:23:22

Could not connect to ws://10.0.50.50:8123/api/websocket, retry in 10 seconds.`

my cofing:
`
remote_homeassistant:
instances:

  • host: localhost
    port: 8123
  • host: 10.0.50.11
    port: 8123
    api_password: !secret hassio_zwave_api_key
    entity_prefix: "hassio-zwave"
    subscribe_events:
    • state_changed
    • service_registered
    • zwave.network_ready
    • zwave.node_event
      `

No connection with (self-signed) SSL configured

Hi,
I'm trying out your component on Hassio 0.98.4 in combination with a fresh remote HA instance with the same version.

When the remote instance has no ssl configured a connection seems to be established (at least no error in the log and the websocket connection counter increases on the remote instance.

Config in remote HA is like this:

http:

websocket_api:

Config in master HA instance is like this:

remote_homeassistant:
  instances:
  - host: <hostname>
    port: 8124
    secure: false
    access_token: !secret hazwave_token
    entity_prefix: "hazwave_"
    subscribe_events:
    - state_changed
    - service_registered
    - zwave.network_ready
    - zwave.node_event

However, when I enable SSL on the remote instance and set "secure: true" on the master instance I only get repeated connection errors without further hints.

The config of the remote instance is like this:

http:
  ssl_certificate: ssl/hassio.pem
  ssl_key: ssl/hassio.key

websocket_api:

The HA web interface works as expected. Due to the imported root cert, the connection is trusted and green in Chrome.

Could it be that there is an issue when self-signed certificates are used?
Is there an option to ignore ssl warnings?

Thanks!

Sensor Data do not get updated

remote connected

Screenshot from 2020-11-12 20-00-09

The sensor state is from that time (connected and ago time are the same)
Screenshot from 2020-11-12 20-00-42

After that nothing happens. On the remote machine the sensors get updated
Screenshot from 2020-11-12 20-02-06

Here is my config

remote_homeassistant:
  instances:
  - host: 192.168.1.78
    port: 8123
    access_token: !secret slave_token
    entity_prefix: slave_
    include:
      domains:
      - sensor

Unhandled exception during restart fails the process of restart

First of all - great component, saved me lot of work syncing my 2 instances very easy, thank you!!!!

I found that during restart of HA there is an exception in the code that causes timeout of restart service which stuck the process of HA,
I applied local fix for that which is very simple, would be great if you can add it to the offical component:

  1. Missing argument in the function that handles shutdown,
    self._hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, stop) send an argument that the stop function is not receiving which causes an issue,
    I added event argument and it solved it.
async def stop(event):
  1. Not handling all kind of closing websocket connection (the try / catch block of - websocket connection is closing) in async def _recv(self)::
    I added aiohttp.WSMsgType.CLOSING state to the if statement:
if data.type in (aiohttp.WSMsgType.CLOSE, aiohttp.WSMsgType.CLOSED):
                            
                _LOGGER.error('websocket connection is closing')
                break
  1. In the initialization (async_connect) the while loop is running always until there is an exception, the issue is when the AH is being restarted, it will try still to connect as long as the HA will disconnect all the sessions, during that time, the component's session can be terminated while it will keep retry to connect, the fix I applied for that was:
    in the constructor I added:
    self._is_shutting_down = False

in async_connect I changed while True: to while not self._is_shutting_down:

in def close I added in the first line of the function:
self._is_shutting_down = True

Error doing job: Task exception was never retrieved

I'm getting this issue....

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/home/homeassistant/.homeassistant/custom_components/remote_homeassistant.py", line 158, in _recv
    if message['type'] == api.TYPE_AUTH_OK:
AttributeError: module 'homeassistant.components.websocket_api' has no attribute 'TYPE_AUTH_OK'

bi-directional use?

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:)

Setup failed for remote_homeassistant: No setup function defined.

Hi!
I would like to use that custom component, but doesnt work on Hassio v0.94.3.
Below errors:

2019-07-08 11:52:27 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for remote_homeassistant which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-07-08 11:52:30 ERROR (MainThread) [homeassistant.setup] Setup failed for remote_homeassistant: No setup function defined.

How to ensure proper status of device updates...

It seems like it’s not properly updating state of my devices from my other instances. And if the instances aren’t started in the right order it would seem to complicate things there as well.

Is there a service or state somewhere I can track and restart my main instance if it can’t get proper status or something? Or send a notification maybe. Trying to track it down.

Temp and Humidity Sensors update issue

Hi, thanks for the nice component, very useful for me.
I have temperature and humidity sensors that update every 60 seconds on another HA instance. Locally, they work fine.
But values are not updated consistently on my main HA machine. Sometimes it takes 15-30 minutes before they get updated.

Mediaplayer component (custom:mini-media-player and media-control) not showing artwork in Lovelace

Hi!

This is a great component! Home Assistant Remote simplifies my setup immensely. Tip of the hat to the devs!

I have a question relating to media_player component.
Album artwork will not show in lovelace, but controlling media works just fine.

Primary and Secondary instance of the media_player show the same attributes and values:
Primary (media_player.vardagsrum_2)
volume_level: 0.21229049563407898
is_volume_muted: false
media_content_id: spotify:track:27Xlqkl3rtEzAOaN4VM7zd
media_content_type: music
media_duration: 202.306
media_position: 0.67
media_position_updated_at: 2020-07-23T06:54:11.329444+00:00
media_title: I Really Want It
media_artist: A Great Big World
media_album_name: Is There Anybody Out There?
app_id: CC32E753
app_name: Spotify
entity_picture_local: /api/media_player_proxy/media_player.vardagsrum_2?token=
friendly_name: Vardagsrum
entity_picture: https://i.scdn.co/image/ab67616d00001e02554488d0c51967b1654d8ce5
supported_features: 21439

Secondary (media_player.vardagsrum_2)
volume_level: 0.21229049563407898
is_volume_muted: false
media_content_id: spotify:track:27Xlqkl3rtEzAOaN4VM7zd
media_content_type: music
media_duration: 202.306
media_position: 0.67
media_position_updated_at: 2020-07-23T06:54:11.329444+00:00
media_title: I Really Want It
media_artist: A Great Big World
media_album_name: Is There Anybody Out There?
app_id: CC32E753
app_name: Spotify
entity_picture_local: /api/media_player_proxy/media_player.vardagsrum_2?token=
friendly_name: Vardagsrum
entity_picture: https://i.scdn.co/image/ab67616d00001e02554488d0c51967b1654d8ce5
supported_features: 21439

Artwork shows just fine on Primary, but not on Secondary. It's just blank/orange. but interestingly album art shows up in "more-info" . Anyone had similar issues or ideas as to how to make artwork display properly?

media

Thanks in advance

Calling services from python script on remote entity ot working

Hi,

I run version 2.1 of your component - it's great.
But i've noticed a problem with calling sevrices via python script. It doesn't work, no errors in logs.
Same service call works ok from UI or directly from yaml.

Here is python snippet:
service_data_hvac = { 'entity_id': thermostat_entity }
[.....]
service_data_hvac['hvac_mode'] = 'heat'
hass.services.call('climate', 'set_hvac_mode', service_data_hvac)

In log i see that script was executed and there are no any errors.

2020-01-06 11:48:35 INFO (SyncWorker_18) [homeassistant.components.python_script] Executing set_proper_floor_heating_mode.py: {'thermostat_entity': ['climate.slave1_thermofloor_as_heatit_thermostat_tf_021_mode_2']}

Please help.

Remove requirement of port in hostname

I connect to my HA server with a URL such as:

https://myha.server.com

with no port allowed in the URL. I do not know enough to modify and make a pull request. But I was able to solve the issue for myself by modifying lines 185 & 186 to remove the port:

return '%s://%s/api/websocket' % (
            'wss' if self._secure else 'ws', self._host)

With this change, the connection works. I wonder (since I imagine I cannot be the only one with this connection type) if the default behavior could be that with no port specified in the config, then there is no port added to the host URL rather than defaulting to 8123.

Thanks!

HACS release is outdated

When installing the component via HACS, the version 2.1 is installed. This corresponds to the git tag from ~Nov 2019.

I encountered issues setting the component up until I found out that the installed version didn't match the master branch and lot of the issues were already fixed.

Call service failed

Hi @lukas-hetzenecker,
First off all nice pice of work. You saved my from hours or doing mqtt switches :)
I will cut to the chase:
In the remote site I have covers on z-wave. They import fine show the status and everything.
The problem is that on the host itself I don't have any "native" covers configured. And when I try to controll a cover I get a error in the web UI:
Cant find service cover/open.

I will try to make one mqtt cover and see if this resolves the problem. the master HA should load the cover service at this point.

KR
Dawid

Connect via Nabu Casa

Trying to make a connection through Nabu Casa. Doesn't work.
Both master and instance are running Nabu Casa with different accounts
Error is
Could not connect to ws://xxxxxxxxxxxxxxxxxx.ui.nabu.casa:8123/api/websocket, retry in 10 seconds...
When I connect using local IP there ar no problems
Anybody help, please

Master and Slave config

Lukas
When adding this... I add this to both the master and slave instances correct?
What do I setup on the remote HA instance for it to allow the master to talk to it?

Recover WebSocket Connections when closing

After sometime, my connection appears to be stuck closing. Any time I try to control the remote instance from my main instance, I receive the following error message:

�[36mhomeassistant_1  |�[0m 2018-12-21 13:03:29 WARNING (MainThread) [aiohttp.websocket] websocket connection is closing.
�[36mhomeassistant_1  |�[0m 2018-12-21 13:03:29 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
�[36mhomeassistant_1  |�[0m Traceback (most recent call last):
�[36mhomeassistant_1  |�[0m   File "/config/custom_components/remote_homeassistant.py", line 235, in forward_event
�[36mhomeassistant_1  |�[0m     await self._connection.send_json(data)
�[36mhomeassistant_1  |�[0m   File "/usr/local/lib/python3.6/site-packages/aiohttp/client_ws.py", line 137, in send_json
�[36mhomeassistant_1  |�[0m     await self.send_str(dumps(data), compress=compress)
�[36mhomeassistant_1  |�[0m   File "/usr/local/lib/python3.6/site-packages/aiohttp/client_ws.py", line 125, in send_str
�[36mhomeassistant_1  |�[0m     await self._writer.send(data, binary=False, compress=compress)
�[36mhomeassistant_1  |�[0m   File "/usr/local/lib/python3.6/site-packages/aiohttp/http_websocket.py", line 630, in send
�[36mhomeassistant_1  |�[0m     return await self._send_frame(message, WSMsgType.TEXT, compress)
�[36mhomeassistant_1  |�[0m   File "/usr/local/lib/python3.6/site-packages/aiohttp/http_websocket.py", line 596, in _send_frame
�[36mhomeassistant_1  |�[0m     self.transport.write(header + mask + message)
�[36mhomeassistant_1  |�[0m   File "uvloop/handles/stream.pyx", line 671, in uvloop.loop.UVStream.write
�[36mhomeassistant_1  |�[0m   File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
�[36mhomeassistant_1  |�[0m RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0x557207f2a308>; the handler is closed

I've added some comments to the top of my custom component file so line 235 on my install is 229 in the repo.

access_token how to set it up

Hi,
so for two instances of HA, I setup as custom_components remote_homeassistant.

config is super simple but access_token is required and when I created on master latest version HA and on remote I get on slave - remote request with invalid auth
Could someone explain why is this...

Warning messages in logs: Unable to find referenced entities

Since version 0.106.x i get warinings in HA logs like:

2020-03-09 00:15:46 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities switch.slave2_shenzhen_neo_electronics_co_ltd_wall_switch_1_channel_switch_5

remote home assistant slave devices not connected automatically after WAN outage

Hi,
I have this setup at two locations, one haster home assistant at a stable fiber WAN link and a "slave" home assistant at with a 4G mobile WAN link. Sometimes the 4G WAN links drops for some time and I think that is normal with mobile WAN links. Sometimes everything works when 4G WAN link is back but sometimes not.
Another case is that if I restart the slave home assistant device after for example changed some configuration the "remote entites" in the haster home assistant are not updated and the connection between them are lost.

The solution to get this connection up and running aging is to restart the master home assistant device and then everything is ok.

I am wondering if it is possible to implement some kind of heartbeat in this plugin so the master home assistant talk to the "slaves" regularly even if no event is sent between them. Then if that fail maybe try to reestablish the connection between them.

States Stop Updating after Some Time

All entities synced perfectly when first set up the config and when I restart the server. However, after some time (sometimes an hour, sometimes four), the states stop updating on the master. The values are accurate on my remote instance. I first noticed the issue with the climate domain, but from the history, I think all the remote entities stopped syncing at the same time.

What information would help narrow in on this issue?

host using https setup?

for some reason having a hard time to se connection when using https:,i have tried almost everything and the erro is always same, when i tried local was no problem

remote_homeassistant:
  instances:
  - host: https://xxxxxxxxxxxx.duckdns.org:8123
    port: 8123
    secure: false
    verify_ssl: false
    access_token: !secret test
    entity_prefix: "slave_"
    subscribe_events:
     - state_changed
     - service_registered

dont matter what i do the erro is always same
Could not connect to ws://xxxxxxxxxxxxxxxxxxxx.duckdns.org:8123:8123/api/websocket,

Error during setup of component remote_homeassistant InvalidEntityFormatError

Hi there,
Error during setup of component remote_homeassistant Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component result = await task File "/config/custom_components/remote_homeassistant/__init__.py", line 109, in async_setup connection = RemoteConnection(hass, instance) File "/config/custom_components/remote_homeassistant/__init__.py", line 187, in __init__ self.set_connection_state(STATE_CONNECTING) File "/config/custom_components/remote_homeassistant/__init__.py", line 201, in set_connection_state self._hass.states.async_set(self._connection_state_entity, state, self._instance_attrs) File "/usr/src/homeassistant/homeassistant/core.py", line 1183, in async_set state = State( File "/usr/src/homeassistant/homeassistant/core.py", line 865, in __init__ raise InvalidEntityFormatError( homeassistant.exceptions.InvalidEntityFormatError: Invalid entity id encountered: sensor.remote_connection_https://domaine_duckdns_org_443. Format should be <domain>.<object_id>

my config yaml :

remote_homeassistant:
instances:

Any idea to fix this?
Thanks!

Could not connect to websocket

I generated the long term token and successfuly tried it manualy to get sensor data. But I am getting error when I setup this component. Am I missing something, please help.

2020-10-20 10:54:14 ERROR (MainThread) [custom_components.remote_homeassistant] Could not connect to ws://192.168.X.XX:8123/api/websocket, retry in 10 seconds...

my config:

remote_homeassistant:
  instances:
    - host: 192.168.X.XX
      port: 8123
      access_token: "token"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.