Hass.io need to modify a py file where are they?

I used to run hassbian and have home assistant to control an old light system by centralite. It uses the litejet config which is built in. But for whatever reason it would not update when I would turn a light on or off. I found /srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/litejet.py and had to edit this line from False to True. Everything worked like a charm.

@property
def should_poll(self):
    """Return that lights do not require polling."""
    return True

Recently my SD card took a dump so I figured what the hell I will just go with hass.io and I added the lines to the config.yaml through hass.io but I am running into that same problem where it turns the light on but after a few seconds home assistant switches back to the off state (but the light stays on) but now I can’t turn the light off. Where is this light.py file kept or how can I use hass.io change this? I run an emulated hue setup so my Echo can turn all the lights on and off as well and would love this to just work again.


If it’s hass.io, you’d need to SSH into the Docker container to find and edit the file there.

and then lose any changes when you update… The solution is to create it as a custom component which will overide the core component.

3 Likes

So I can have custom component with all the same info as the built in component? Do I just create a custom_components folder to the /config and put in all the code from here https://github.com/home-assistant/home-assistant/tree/dev/homeassistant/components/litejet in it (with my modification)? Or is there something else I need to do?

1 Like

that’s exactly it

Thanks worked like a charm. I knew it had to be something easy I just didn’t want to screw something up. Thanks again!

1 Like

Ok it took a shit again. Another update (needed to get some other stuff to work) and now litejet stuff stopped working correctly. I have a litejet folder in custom_components and all the files from core/homeassistant/components/litejet at dev · home-assistant/core · GitHub and I went and changed the polling parts mentioned above to True but home assistant doesn’t update. When it loads up it shows everything as off. I can turn the lights on using Home Assistant but a few seconds later the slider goes back to OFF (the light stays on though) then to turn the light off I have to quickly turn the device in home assistant to ON and then OFF. Same happens if when HA boots up the light is already on it will turn off if I click it but the slider goes back to ON (light stays off though) Not sure what changed but it’s driving me crazy. Any ideas?