Core: Shelly RGBW2 light entities no longer available after 0.116 upgrade

Created on 9 Oct 2020  路  17Comments  路  Source: home-assistant/core

The problem


After an update to 0.116 the 4 light entities of the rgbw2 are no longer available, the only sensor available is binary_sensor.shellyrgbw2_XXXXXX_overpowering. I have tried removing and re-adding the integration, I upgraded to 0.116.1, and rebooted the shelly device

Environment

  • Home Assistant Core release with the issue: 0.116
  • Last working Home Assistant Core release (if known): 0.115.X
  • Operating environment (OS/Container/Supervised/Core): HassOS 4.13
  • Integration causing this issue: Shelly
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/shelly

Problem-relevant configuration.yaml

N/a

Traceback/Error logs

N/a

Additional information

The Shelly is running the latest firmware available

shelly

Most helpful comment

Success!

In order to edit files in core/homeassistant/ from the console in proxmox which puts you into the homeassistant cli.

  1. login as root (no password)
  2. Then type 'login' to get into the host system
  3. "docker ps | grep homeassistant:0.116" This is to get your container ID of homeassistant. It's the first string of characters mine was '1166cf2a5c1a' yours will be different.
  4. run 'docker exec -it 'container ID' bash (this opens a shell within the homeassistant container)
  5. 'cd /usr/src/homeassistant/homeassistant/components/shelly'
  6. 'vi entity.py' , and make the changes @chemelli74 suggested

restarted homeassistant and the light entities came back!
Thanks @chemelli74

All 17 comments

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

Hi, is log showing something ?

2020-10-09 08:30:59 ERROR (MainThread) [homeassistant.components.shelly] Timeout fetching shellyrgbw2-2BB079 data
2020-10-09 08:59:30 ERROR (MainThread) [homeassistant.components.shelly] Timeout fetching shelly1-93EAA3 data
2020-10-09 08:59:45 ERROR (MainThread) [homeassistant.components.shelly] Timeout fetching shelly1-93EAA3 data
2020-10-09 09:42:45 ERROR (MainThread) [homeassistant.components.shelly] Timeout fetching shelly1-93EAA3 data
2020-10-09 10:04:05 ERROR (MainThread) [homeassistant.components.shelly] Timeout fetching shelly1-93EAA3 data
2020-10-09 10:13:34 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 296, in async_add_entities
    tasks = [
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 296, in <listcomp>
    tasks = [
  File "/usr/src/homeassistant/homeassistant/components/shelly/light.py", line 32, in <genexpr>
    async_add_entities(ShellyLight(wrapper, block) for block in blocks)
  File "/usr/src/homeassistant/homeassistant/components/shelly/light.py", line 40, in __init__
    super().__init__(wrapper, block)
  File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 119, in __init__
    self._name = shelly_naming(self, block, "switch")
  File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 44, in shelly_naming
    if "name" in self.wrapper.device.settings[mode][int(block.channel)]:
KeyError: 'relays'
2020-10-09 10:13:34 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up shelly platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/shelly/sensor.py", line 129, in async_setup_entry
    await async_setup_entry_attribute_entities(
  File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 89, in async_setup_entry_attribute_entities
    [
  File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 90, in <listcomp>
    sensor_class(wrapper, block, sensor_id, description, counts[sensor_id])
  File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 174, in __init__
    super().__init__(wrapper, block)
  File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 119, in __init__
    self._name = shelly_naming(self, block, "switch")
  File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 44, in shelly_naming
    if "name" in self.wrapper.device.settings[mode][int(block.channel)]:
KeyError: 'relays'

I went ahead and deleted and re-added it just now, here's the tail end of home-assistant.log

Same issue here, 2 errors in logs:

`Logger: homeassistant
Source: components/shelly/entity.py:44
First occurred: 11:41:42 AM (1 occurrences)
Last logged: 11:41:42 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 296, in async_add_entities
tasks = [
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 296, in
tasks = [
File "/usr/src/homeassistant/homeassistant/components/shelly/light.py", line 32, in
async_add_entities(ShellyLight(wrapper, block) for block in blocks)
File "/usr/src/homeassistant/homeassistant/components/shelly/light.py", line 40, in __init__
super().__init__(wrapper, block)
File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 119, in __init__
self._name = shelly_naming(self, block, "switch")
File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 44, in shelly_naming
if "name" in self.wrapper.device.settings[mode][int(block.channel)]:
KeyError: 'relays'`

`Logger: homeassistant.components.sensor
Source: components/shelly/entity.py:44
Integration: Sensor (documentation, issues)
First occurred: 11:41:42 AM (1 occurrences)
Last logged: 11:41:42 AM

Error while setting up shelly platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/shelly/sensor.py", line 129, in async_setup_entry
await async_setup_entry_attribute_entities(
File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 89, in async_setup_entry_attribute_entities
[
File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 90, in
sensor_class(wrapper, block, sensor_id, description, counts[sensor_id])
File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 174, in __init__
super().__init__(wrapper, block)
File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 119, in __init__
self._name = shelly_naming(self, block, "switch")
File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 44, in shelly_naming
if "name" in self.wrapper.device.settings[mode][int(block.channel)]:
KeyError: 'relays'`

@cameronblunt, @PascalBu can you please post the output of http://shelly_ip/settings for those devices ?

Thx,

Simone

{"device":{"type":"SHRGBW2","mac":"XXXXXXXXXX","hostname":"shellyrgbw2-6CD3B1","num_outputs":4},"wifi_ap":{"enabled":false,"ssid":"shellyrgbw2-6CD3B1","key":""},"wifi_sta":{"enabled":true,"ssid":"XXXXXXX","ipv4_method":"static","ip":"192.168.2.16","gw":"192.168.2.1","mask":"255.255.255.0","dns":null},"wifi_sta1":{"enabled":true,"ssid":"XXXXXXX","ipv4_method":"dhcp","ip":null,"gw":null,"mask":null,"dns":null},"mqtt": {"enable":true,"server":"192.168.XXXX:1883","user":"mqtt","id":"shellyrgbw2-6CD3B1","reconnect_timeout_max":60.000000,"reconnect_timeout_min":2.000000,"clean_session":true,"keep_alive":60,"max_qos":0,"retain":false,"update_period":30},"coiot": {"update_period":15},"sntp":{"server":"time.google.com","enabled":true},"login":{"enabled":true,"unprotected":false,"username":"XXXXXX"},"pin_code":"","name":null,"fw":"20200827-070232/v1.8.3@4a8bc427","factory_reset_from_switch":true,"discoverable":true,"build_info":{"build_id":"20200827-070232/v1.8.3@4a8bc427","build_timestamp":"2020-08-27T07:02:32Z","build_version":"1.0"},"cloud":{"enabled":false,"connected":false},"timezone":"Europe/Amsterdam","lat":51.924400,"lng":4.477730,"tzautodetect":true,"tz_utc_offset":7200,"tz_dst":true,"tz_dst_auto":true,"time":"13:07","unixtime":1602680851,"led_status_disable":false,"fw_mode":"SHRGBW2!white","actions":{"active":false,"names":["btn_on_url","btn_off_url","longpush_url","shortpush_url","out_on_url","out_off_url","out_on_url","out_off_url","out_on_url","out_off_url","out_on_url","out_off_url"]},"hwinfo": {"hw_revision":"prod-190822","batch_id":1},"mode":"white","dcpower":0,"lights":[{"name":null,"ison":false,"brightness":100,"default_state":"switch","auto_on":0.00,"auto_off":0.00,"schedule":false,"btn_type":"detached","btn_reverse":0,"schedule_rules":[],"out_on_url":"","out_off_url":""},{"name":null,"ison":false,"brightness":50,"default_state":"switch","auto_on":0.00,"auto_off":0.00,"schedule":false,"schedule_rules":[],"out_on_url":"","out_off_url":""},{"name":null,"ison":false,"brightness":50,"default_state":"switch","auto_on":0.00,"auto_off":0.00,"schedule":false,"schedule_rules":[],"out_on_url":"","out_off_url":""},{"name":null,"ison":false,"brightness":50,"default_state":"switch","auto_on":0.00,"auto_off":0.00,"schedule":false,"schedule_rules":[],"out_on_url":"","out_off_url":""}]}

Found the issue, will make a fix in a while.

Can you update manually the code of the integration for a quick test ?

Simone

Not sure, how to do that?

Not sure, how to do that?

I did a quick test (no RGB device here) and you need to change https://github.com/home-assistant/core/blob/9ee97cb213d659aa9b6149484c0a42522decba78/homeassistant/components/shelly/entity.py#L31 from:

mode = "relays"

to

mode = block.type + "s"

Simone

Actually don't know how to do that. Running Home Assistant OS on a Proxmox VM.

Actually don't know how to do that. Running Home Assistant OS on a Proxmox VM.

You can SSH on HA ?

Simone

I've got the same setup as @PascalBu and I also don't know how to edit files in core/homeassistant/. Just installed the SSH addon, I'm at the homeassistant cli, but do not know where to go from there.

Something else I tried was to make a custom component with the modified entity.py as in this thread:
https://community.home-assistant.io/t/editing-component-files-in-hassio/24273
But was not able to see any difference

I guess the console in Proxmox should have the necessary access?

I guess the console in Proxmox should have the necessary access?

Yeah, I opened that too before installing the SSH addon. Then my issue is still how to use the homeassistant cli to navigate the file system and edit files. (If that's even the right way to go about it)

I've got the same setup as @PascalBu and I also don't know how to edit files in core/homeassistant/. Just installed the SSH addon, I'm at the homeassistant cli, but do not know where to go from there.

cd /usr/src/homeassistant/homeassistant/components/shelly
vi entity.py

Simone

Success!

In order to edit files in core/homeassistant/ from the console in proxmox which puts you into the homeassistant cli.

  1. login as root (no password)
  2. Then type 'login' to get into the host system
  3. "docker ps | grep homeassistant:0.116" This is to get your container ID of homeassistant. It's the first string of characters mine was '1166cf2a5c1a' yours will be different.
  4. run 'docker exec -it 'container ID' bash (this opens a shell within the homeassistant container)
  5. 'cd /usr/src/homeassistant/homeassistant/components/shelly'
  6. 'vi entity.py' , and make the changes @chemelli74 suggested

restarted homeassistant and the light entities came back!
Thanks @chemelli74

Thanks for pointing in the right direction. Somehow did not manage to get there via Proxmox, so tried Portainer and that also worked to get to the proper shell. Works fine now here also!

Was this page helpful?
0 / 5 - 0 ratings