#Shelly Gen2 plug US fails to add - no response to Script.GetCode

1 messages · Page 1 of 1 (latest)

vast night
#

Brand new ShellyPlug US Wifi+Bt -- device is setup and accessible via it's IP on the local network.
Auto discovery works.
Connecting to the device eventually reports Failed setup, will retry: Device communication error occurred for shellyplugus-048308deb2cc

Debug logs show a rpc call to "Script.GetCode" that never gets a reply
2025-07-19 11:32:31.611 DEBUG (MainThread) [aioshelly.rpc_device.wsrpc] send(192.168.86.45:80): {'id': 5, 'method': 'Script.GetCode', 'src': 'aios-546764120832', 'params': {'id': 1, 'offset': 0, 'len': 0}, 'dst': 'shellyplugus-048308deb2cc'}

Other rpc calls seem to be receiving responses just fine, including GetConfig.

I found this PR which seems to be related, but that was released a few versions ago.

I do not have any scripts on the device.

HA 2025.7.2
Updated plug to latest firmware: Shelly PlugUS 048308DEB2CC| 1.6.2| d0ab7d6d

Any help would be much appreciated!

GitHub

The problem Shelly 1 PM + Shelly Plus PM Mini don't work anymore with 2025.4.0 They throw communication errors Shelly 1 Mini Gen3 is working What version of Home Assistant Core has the issue? c...

vast night
#

Just found this issue as well. My logs don't look like "iz8mbw"s, but the problem surfaces the same

vast night
#

I went ahead and patched the code via a custom component to change init.py -- runtime_data.rpc_supports_scripts = False and bypass all the support_scripts logic -- and now the device is added successfully. It seems to then be... inconsistent? Sometimes entity data shows up, trying to toggle power on/off hasn't worked yet... still poking at it

#

curling toggling the switch via curl from homeassistant works fine curl "http://192.168.86.45/rpc/Switch.Set?id=0&on=true"

#

yet, bizarrely, the rpc send in the logs never gets a reply

...
2025-07-19 14:14:34.517 DEBUG (MainThread) [aioshelly.rpc_device.wsrpc] Connection issue with device 192.168.86.45:80
2025-07-19 14:14:34.517 DEBUG (MainThread) [aioshelly.rpc_device.wsrpc] Websocket client connection from 192.168.86.45:80 closed
2025-07-19 14:14:34.517 DEBUG (MainThread) [custom_components.shelly] Shelly shellyplugus-048308deb2cc handle update, type: RpcUpdateType.DISCONNECTED
2025-07-19 14:14:34.517 DEBUG (MainThread) [custom_components.shelly] Connecting to Shelly Device - shellyplugus-048308deb2cc
2025-07-19 14:14:34.517 DEBUG (MainThread) [aioshelly.rpc_device.device] host 192.168.86.45:80: RPC device initialize
2025-07-19 14:14:34.517 DEBUG (MainThread) [aioshelly.rpc_device.wsrpc] Trying to connect to device at 192.168.86.45
2025-07-19 14:14:34.519 DEBUG (MainThread) [custom_components.shelly] Manually updated shellyplugus-048308deb2cc data
2025-07-19 14:14:35.062 INFO (MainThread) [aioshelly.rpc_device.wsrpc] Connected to 192.168.86.45
2025-07-19 14:14:35.062 DEBUG (MainThread) [aioshelly.rpc_device.wsrpc] send(192.168.86.45:80): {'id': 9, 'method': 'Shelly.GetDeviceInfo', 'src': 'aios-547520286224', 'dst': 'shellyplugus-048308deb2cc'}
2025-07-19 14:14:35.120 DEBUG (MainThread) [aioshelly.rpc_device.wsrpc] recv(192.168.86.45:80): {'id': 9, 'src': 'shellyplugus-048308deb2cc', 'dst': 'aios-
#

(more testing)

2025-07-19 14:23:10.440 DEBUG (MainThread) [custom_components.shelly] Call RPC for entity None, method: Switch.Set, params: {'id': 0, 'on': False}, timeout: None
2025-07-19 14:23:10.440 DEBUG (MainThread) [aioshelly.rpc_device.wsrpc] send(192.168.86.45:80): {'id': 5, 'method': 'Switch.Set', 'src': 'aios-547499392224', 'params': {'id': 0, 'on': False}, 'dst': 'shellyplugus-048308deb2cc'}
2025-07-19 14:23:19.440 DEBUG (MainThread) [custom_components.shelly] Call RPC for entity None, method: Switch.Set, params: {'id': 0, 'on': True}, timeout: None
2025-07-19 14:23:19.441 DEBUG (MainThread) [aioshelly.rpc_device.wsrpc] send(192.168.86.45:80): {'id': 6, 'method': 'Switch.Set', 'src': 'aios-547499392224', 'params': {'id': 0, 'on': True}, 'dst': 'shellyplugus-048308deb2cc'}
2025-07-19 14:23:20.443 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547462087840] Error during service call to switch.turn_off: device_communication_action_error
2025-07-19 14:23:29.441 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547462087840] Error during service call to switch.turn_on: device_communication_action_error