How do I change.py files

I need to make a change to a .py file. The fix is from another thread. I think.i found the file in /home/uername/.homeassistant/deps.

However when I make a change to that file and start HA the changes revert. How do.i get then to stick?

Do you have a virtual environment set up? If so, you’ll have to switch to the hass user, activate the venv and make the changes there.

But be advised anything you change will be gone in the next update if it isn’t something that is merged in the new version.

I don’t think I have a virtual environment. I installed it using the pip install homeassistant command.

And I don’t mind if it changes back during an update, it’s a small change I need to make.

What’s the other thread you’re referencing? Reading it may help us to help you.

Try:

find / -name filename.py

I still don’t understand the difference between the files that live in /homeassistant/deps and the normal component files that live in HASS’ install directory.

I found the exact lines, along with the correct line numbers, but it just reverts back after I change it and restart HA.

I also tried what @ih8gates said to fine the init.py file, and there are a lot of them, but the one at /usr/local/lib/python3.5/dist-packages/homeassistant/components/light/init.py seemed like the only one that might be a close match, but it’s way to small, and doesn’t contain those lines. There was also a flux_led.py, but that doesn’t have the right stuff in there either.

The flux_led.py has a line in there that says:

REQUIREMENTS = [‘https://github.com/Danielhiversen/flux_led/archive/0.7.zip
‘#flux_led==0.8’]

Could it be that it’s redownloading that file every time HA starts?

There is a bug in your version of HA, but it is fixed in the dev version.
You can try to change the line to

REQUIREMENTS = [‘https://github.com/Danielhiversen/flux_led/archive/0.8.zip’
‘#flux_led==0.8’]

Thanks @Danielhiversen. I made that change, and I guess it pulled down the 0.8.zip. However, I’m still having the same problem where I can’t change the LED. I took a look at lines 641 and 664 in the init.py, and they both still have 0x0F or 0xF0, when it looks like it should be 0x00. And I still can’t figure out how to make that change so I can at least test it.

Now that you gave the 0.8 version, try to change the init.py again.

Ah. I get it. The bug must have been that it redownloads the files every time. So I was editing the right files, but the bug was overwriting it. Thanks for your help with it. I tried out those values for those bytes from the other thread, and it still didn’t work. So I guess the model that I have is using some different values for this stuff.