I can't edit light.py in hassio

Hi ,
I don’t know if it is a correct place to post this issue, if not please redirect me to the correct one.
I had logs that said I have issue in light.py located in /usr/local/lib/python3.7/site-packages/tuyaha/devices/light.py,

File “/usr/local/lib/python3.7/site-packages/tuyaha/devices/light.py”, line 16, in brightness
brightness = int(self.data.get(‘color’).get(‘brightness’) * 255 / 100)
AttributeError: ‘NoneType’ object has no attribute ‘get’

but when I ssh to hassio and cd to this path : /usr/local/lib/python3.7/site-packages/tuyaha/devices/ it generate error said that this path not exist:

core-ssh:/usr/local/lib# core-ssh:/# cd /usr/local/lib/python3.7/
-bash: core-ssh:/#: No such file or directory
core-ssh:/usr/local/lib# -bash: cd: /usr/local/lib/python3.7/: No such file or directory

seems like it uses docker image , I can’t find either command docker to manipulate things.

could someone head me to the correct way how I can reach those directories and scripts.

thanks a lots.

I don’t use this myself, but i 've seen that the easiest way is to use the portainer addon.

But you should NOT edit files in the HA container.

thanks a lots for your help, I’ll take a look to this addon, and I know that I shouldn’t edit files in HA, but ou HA couldn’t get correct light stat because of bug in light.py, and there is a developer that find a workaround to fix that by modifying one specific line in this script:
https://github.com/home-assistant/home-assistant/issues/28602

I suggest you utilise custom_components to override light.py instead. This will persist rather than being reset every time you restart the container.

Hi mihalski, can you tell me how to do that , Just a link to how to will be appreciate, I’m expert in linux but nobbie in hassio OS.

This should get you started:

Ignore the original post and focus on the replies.

The custom_components directory goes inside your homeassistant config directory (the same directory that contains configuration.yaml). You have to create it yourself.

Have fun tinkering :slight_smile:

thanks man , that I want it since a while, it’s highly appreciated.