Giter Site home page Giter Site logo

Can't run any scripts about docker-ha-bridge HOT 11 OPEN

aptalca avatar aptalca commented on June 2, 2024
Can't run any scripts

from docker-ha-bridge.

Comments (11)

aptalca avatar aptalca commented on June 2, 2024

The container only has access to locations that are mounted in the docker run command. By default, the config folder is mounted under /config

You need to use the internal maooed location of the script (and first make sure that location is mounted)

from docker-ha-bridge.

abtzero avatar abtzero commented on June 2, 2024

Thanks for Your response!
I added a mounted path to the existing folder /docker using the docker gui and setting the folder to /docker and mount-path to /docker (correct?).
Added a simple python script into the subfolder "py" and added the command /usr/bin/python3 /docker/py/test.py into ha-bridge.
It works manually with my user in a console but not with ha-bridge.
What else do I need to do?

from docker-ha-bridge.

aptalca avatar aptalca commented on June 2, 2024

I added a mounted path to the existing folder /docker using the docker gui and setting the folder to /docker and mount-path to /docker (correct?) I don't quite understand this statement but I'm assuming that on the host, the script is at /docker/py/test.py, in the docker run command you used -v /docker:/docker:rw and in the bridge you are using the location /docker/py/test.py
If so, that seems to be correct. As to why the script isn't firing, you should ask on bwssystems' github. I don't have any experience with firing python scripts from this bridge.

from docker-ha-bridge.

abtzero avatar abtzero commented on June 2, 2024

Well, I do not know how to manipulate the RUN command (I do not know where to put the -v /docker:/docker:rw
I am working on the synology's gui to do that:
image
And in ha-bridge:
image
I think, it should work having access to my added directory.
Firing up a shel script with it's name does not give me an 'file not found' - error anymore.
But does not work. (my test-script should write a file to my directory.)
Can I expect having access to all system programs (i.e. bash and python modules) root would have, without mounting any additional path?

EDIT:
I got a python script working now, which writes a text-output to my directory.
My script that should turn on/off my sharp-TV is still not working (could be something with the import socket command...)
But thanks man!
You pushed me into the right direction by telling me to add a mounted path.

from docker-ha-bridge.

aptalca avatar aptalca commented on June 2, 2024

Good to hear that python works. Just so you know, the script will only have access to the libraries and modules inside the container, which is ubuntu.

If you want to test/troubleshoot your python script, it is best to do inside the container so you can see the console output. You can exec into the container with docker exec -it <containername> bash from synology console.

from docker-ha-bridge.

abtzero avatar abtzero commented on June 2, 2024

Thanks for this hint!
When I connect as admin via SSH the command
docker exec -it aptalca-home-automation-bridge1 /bin/usr/python3 /docker/aquosON.py
gives me the response
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Wrong user?

from docker-ha-bridge.

aptalca avatar aptalca commented on June 2, 2024

maybe try with sudo ?

from docker-ha-bridge.

abtzero avatar abtzero commented on June 2, 2024

Yes, but then it doesn't find python3.
It is not the same environment, as executed by ha-bridge.

from docker-ha-bridge.

aptalca avatar aptalca commented on June 2, 2024

/usr/bin/python3

or just python3

from docker-ha-bridge.

abtzero avatar abtzero commented on June 2, 2024

OMG, sure ist has to be /usr/bin/
Now I have a script error output.
Thanks again!

from docker-ha-bridge.

abtzero avatar abtzero commented on June 2, 2024

YESSS!
For all readers in the background:
Firing up python scripts worked now, but my script, that should turn ON/OFF my Sharp Aquos TV failed with the error message:
TypeError: 'str' does not support the buffer interface
This is caused by using a socket send command like s.send(user + "\r" + password + "\r").
With python 3 this should be
s.send((user + "\r" + password + "\r").encode())
That way it works.

Buuuut:
My Sharp TV looses IP-connection after being more than 10 minutes in standby... lol

from docker-ha-bridge.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.