Trying to get a python script to run. When I click on “Activate” it says it’s activated, but nothing happens.
If I run the script manually from command line, it works fine. Using the pi image if that makes any difference.
I’ve tried with and without quotes, python/python2/python3, adding sudo (Not sure if that makes a difference?)
Also made the script executable, tried removing python from the path, but still no change.
I use shell_command’s for some bash scripts, but not any Python scripts. In mine, I have no quotes around anything - not the script itself or any arguments I might pass it.
To help diagnose ownership/permission issues, you could sudo to the HASS user: sudo su -s /bin/bash hass
then run your script. That may not help, but it would rule out permissions. Do you see anything in home_assistant.log?
You might need to tweak this per your installation. I’m running All-in-one. That’ll affect the location of the hass user. I’m not a linux guy, so can’t give you the exact info.
Weird that you’re getting that error on subsequent clicks. It almost seems like the previous command hangs. But it might also depend on how long you wait between clicks. Running the command from the command line will give you a feel for how long it takes to complete. I wonder if it’s a problem with the py script itself? Since it’s running as hass instead of pi (which you are likely logged in as), it may not get the same environment. Maybe it’s missing a dependency for the pushbullet code (or are you using native python rather than importing any libraries).
If you’re installed in a virtual env, you’ll need to make sure that any necessary code is also installed to that environment. With the A-I-O install, you enter the VENV with: source /srv/hass/hass_venv/bin/activate
When I set up the script originally, and ran tests, it created the snapshot.jpg with root privileges.
Deleted that, and now it seems to be working, so I assume the homeassistant user couldn’t modify the file.