Skip to content

Home Assistant crashed and stopped loading UI after installation Pyscript #703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mspnr opened this issue Feb 26, 2025 · 10 comments
Open

Comments

@mspnr
Copy link

mspnr commented Feb 26, 2025

Home Assistant crashed and stopped loading UI after installation Pyscript.

Crash happened after activation of the integration and starting the first script.

Installation was performed from HACS, Pyscript version on moment of installation 1.6.1.

The situation was resolved by connecting display and keyboard to Raspberry Pi and surgically disabling integration. Then Home Assistant start load UI.

Be careful! I would consider such behavior as very dangerous.

Home Assistant versions:

Core 2025.2.5
Supervisor 2025.02.1
Operating System 14.2
Frontend 20250221.0

@IgnusG
Copy link
Contributor

IgnusG commented Feb 26, 2025

Hey @mspnr 👋

What script were you running?

@mspnr
Copy link
Author

mspnr commented Feb 26, 2025

Actually it was a couple of days ago. I started with the first script suggested in the tutorial https://hacs-pyscript.readthedocs.io/en/stable/tutorial.html and I think it was all right till the moment I started experiment and may insert some nonsense line, which probably ended up with compilation error.

My point here is no matter what error happens in this script it should not put into risk the whole system stops to not boot up.

@craigbarratt
Copy link
Member

As @IgnusG asked, the most important information you can provide is what script (code) you were running. It is possible to stall the main event loop by writing blocking code in pyscript. So it would be good to know whether that was the case, or whether something else happened. Being able to reproduce an error is the first step is debugging and fixing it.

@mspnr
Copy link
Author

mspnr commented Feb 26, 2025

I am not sure if it helps. I copied the line from the original HA python script. So far this is the script:

import os


@service
def hello_world(action=None, id=None):
    """hello_world example using pyscript."""
    # log.info(f"hello world: got action {action} id {id}")
    # if action == "turn_on" and id is not None:
    #     light.turn_on(entity_id=id, brightness=255)
    # elif action == "fire" and id is not None:
    # event.fire(id, param1=12, param2=80)

    os.remove("/config/snapshots/_temp/1.jpg") 
    hass.services.call("camera", "snapshot", { "entity_id": "camera.cam1", "filename": "/config/snapshots/_temp/1.jpg" })

@fdreckmann
Copy link

Same issue here... Troubleshooting from the hell

@alfonsomolaro
Copy link

Hi, same issue but after update to the last version of pyscript today.
I perform the update and reboot HA as raccomanded. After the reboot
HA doesn't start, I had to physically shutdown rasberryPi e restart because doesn't start the UI. After the physical reboot the UI started but doesn't work correctly (no update), only disable pyscript the system works properly. The only integration that uses pyscript is Irrigation unlimited.

Core 2025.3.3
Supervisor 2025.03.3
Operating System 15.0
Frontend 20250306.0

@alfonsomolaro
Copy link

Please anyone can investigate? The only way to resolve is uninstall pyscript.

@craigbarratt
Copy link
Member

I don't have access to that type of platform. Is there anything in the log files after you reboot?

@craigbarratt
Copy link
Member

The first thing to try is to make sure it runs reliably with no scripts present in the pyscript directory. If it runs reliably without any scripts, then the problem is likely due to user code in the scripts. In that case, try adding scripts to figure out which one is the culprit.

@alfonsomolaro
Copy link

I tried to reinstall from zero che pyscript integration (no update, but uninstall delete the conf and re-install) and so it's works fine. Something went wrong with the update....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants