Idiots Guide to running a python script


schford

5 posts in this topic Last Reply

Recommended Posts

Hi guys,

 

I have a python script that I use to pull info from my alarm system into MQTT which I then use in Home Assistant.  I always used to call this from home assistant.  They have now changed HA so that scripts can only run for 60 seconds and this needs to keep running.  Has anyone any advice on how I could do this natively in unraid?

 

I'd be very grateful for any help.

 

Cheers

 

Stuart

Link to post

So far as the python part goes my recommendation is to use a python docker container to run your python script in. So you would create a User Scripts script to launch your python script, but rather than call it directly you would do something like

docker run --rm -d -v /path/to/script/containing/folder/on/host:/mnt:ro --workdir /mnt python:3 ./your-script.py --argument-for-script YES

 

Edited by primeval_god
Link to post
  • 8 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.