Hi,
I would like to be able to use the “requests” library in python, as documented here: http://docs.python-requests.org/en/master/.
Would someone please help me setup what I need in order to do that under Hass.io?
Thanks,
Bill
Hi,
I would like to be able to use the “requests” library in python, as documented here: http://docs.python-requests.org/en/master/.
Would someone please help me setup what I need in order to do that under Hass.io?
Thanks,
Bill
Currently searching for a “full” way to do this, there are several alternatives which one of the other community members found.
[Python script import issues in hass.io]
But basically, dump your python script in the config directory instead of the python_scripts folder and it’ll run with strangely, higher privileges - but it’s only useful if you run it as a switch (platform command_line) - this is extremely limited though if you are working on something like a remote control which has multiple buttons.
You just end up with a single switch where the on action is running the script and the off action does nothing.
Thank you for that suggestion. At this point I’m no longer using hass.io, but hasbian, and I just create custom components, which is working for me.
Very tempting, I like the idea… quick question for you though.
As I’m a bit vague on the major differences between hassio and hasbian - do you know if (on hasbian) - there is full access to the python environment? (in this context, can you run the import function in scripts without it failing because import isn’t available?)
My entire aim was to use a dynamic variable passing service/script configuration in conjunction with the tiles UI - I click a button, it calls a service and passes a variable (e.g. up, down, power off, etc) - the script takes the variable and executes the http post command to my TV with the variable integrated into the xml payload.
If I can use the import function in scripts in the native hasbian install, I’ll blow hassio out of the water and never look back
Let me preface my comments with the fact that, though I’m a long time programmer, I’m pretty new to Linux and Home Assistant.
I switched to Haspbian because I wanted to ssh into the Raspberry Pi and have access to a full Debian Linux environment. Now I can “sudo apt-get install…” to my hearts content. I can also type python3 and do whatever I want directly in Python.
From Home Assistant, using a custom component, I can import whatever I’ve installed in Python. I’m controlling my Bose Soundtouch speakers from scripts by making http posts. It sounds much like what you want to do. I “import requests”, and just have at it.