core icon indicating copy to clipboard operation
core copied to clipboard

Shelly integration does not support devices connected via Shelly range extenders

Open tempesta-home opened this issue 2 years ago • 2 comments

The problem

I'm trying the new feature "Range Extender" of the shelly Pro and Plus series. You can connect Shelly devices through other Shelly devices, but the result is that you can have one IP address (the shelly device that acts as gateway/proxy) that maps on many shelly devices on different ports. The Shelly App works regularly. When you try to connect HA Shelly integration with an IP:Port pattern the result is: "Unexpected Error"

Unexpected exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aioshelly/common.py", line 52, in process_ip_or_options
    ipaddress.ip_address(options.ip_address)
  File "/usr/local/lib/python3.10/ipaddress.py", line 54, in ip_address
    raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 address')
ValueError: '10.82.55.43:8083' does not appear to be an IPv4 or IPv6 address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/shelly/config_flow.py", line 119, in async_step_user
    device_info = await validate_input(
  File "/usr/src/homeassistant/homeassistant/components/shelly/config_flow.py", line 72, in validate_input
    block_device = await BlockDevice.create(
  File "/usr/local/lib/python3.10/site-packages/aioshelly/block_device.py", line 75, in create
    options = await process_ip_or_options(ip_or_options)
  File "/usr/local/lib/python3.10/site-packages/aioshelly/common.py", line 55, in process_ip_or_options
    options.ip_address = await loop.run_in_executor(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
socket.gaierror: [Errno -2] Name does not resolve

What version of Home Assistant Core has the issue?

2022.9.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Shelly

Link to integration documentation on our website

https://www.home-assistant.io/integrations/shelly/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

tempesta-home avatar Sep 20 '22 09:09 tempesta-home

Hey there @balloob, @bieniu, @thecode, @chemelli74, mind taking a look at this issue as it has been labeled with an integration (shelly) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


shelly documentation shelly source (message by IssueLinks)

Shelly integration does not support this feature, we currently have other Shelly features with higher priority that are already in work so I can't update on a timeline for that.

thecode avatar Sep 20 '22 21:09 thecode

Ran into the same problem. Although, the shelly "Range Extender" feature is still in BETA, it seems to work quite promising. According to @thecode, the feature won't be supported within the near future. Therefore I was giving it a shot to work-around the issue.

  1. Enable "Range Extender" feature on primary shelly
  2. Connect secondary shelly to primary shelly
  3. Secondary shelly should be available at "primary-ip:port" (eg. 10.0.0.1:8002)
  4. Set up a "proxy" that forwards http/websocket requests to that url (10.0.0.1:8002)

In my case I've used apache2 with "mod_proxy, mod_proxy_http and mod_proxy_wstunnel" to handle the requests.

<VirtualHost 10.0.0.2:80>
    ProxyRequests Off
    ProxyPreserveHost On

    RewriteEngine On
    RewriteCond %{HTTP:Connection} Upgrade [NC]
    RewriteCond %{HTTP:Upgrade} websocket [NC]
    RewriteRule /(.*) ws://10.0.0.1:8002/$1  [P,L]

    ProxyPass / http://10.0.0.1:8002/ retry=1
    ProxyPassReverse / http://10.0.0.1:8002/
</VirtualHost>

All requests to 10.0.0.2 will be forwarded to 10.0.0.1:8002 (secondary shelly) and it's possible to be used within home-assistant. Unfortunately, this is nothing more that a proof-of-concept.

JZach avatar Oct 01 '22 19:10 JZach

I would love this feature! I would like to add a "Shelly 3EM" next to my "Pro 4PM" and share the "4PMs" ethernet connection to the 3EM with this "Range Extender" feature.

iamthe1st avatar Oct 21 '22 16:10 iamthe1st

I would love this feature! I would like to add a "Shelly 3EM" next to my "Pro 4PM" and share the "4PMs" ethernet connection to the 3EM with this "Range Extender" feature.

Yeah me to... i hope some day this will be fixed :)

bluechris avatar Dec 09 '22 09:12 bluechris

Please create a feature request here: https://community.home-assistant.io/c/feature-requests/13 Locking this issue, it is on my todo list, when there are news I will link to this issue.

thecode avatar Dec 09 '22 09:12 thecode