Closed peterd550 closed 3 years ago
Hmmm with all that it just seems like a pip issue.all those errors relate to pyngrok.Can you try running it outside of docker?
Ok np I will do let you know how I go? Where are you based? Melbourne Australia 😄
Ah Colorado, say command is a easy fix had converted it to a test command
There you go version 5.6!
There you go version 5.6 Reinstall it and say should work now!
@peterd550 I also fixed the volume command by the way!
Release 5.6.5 is the patch of it
I tried to install them on my Raspberry Pi 4 runing pip3 install googlecontroller==5.6.5
and I get this
127.0.1.1
Traceback (most recent call last):
File "./test.py", line 7, in
from docker I the same error
Hmmm, either its a ip error, pyngrok, or python version not being right. I'm running on 3.9 with windows.I do have a raspi but can not test for a little while...Also your completely sure its the FULL path?
I have tried it different versions of pyngrok and get the same errror
Traceback (most recent call last):
File "./test.py", line 7, in
I have tried it different versions of pyngrok and get the same errror Traceback (most recent call last): File "./test.py", line 7, in
home.serve_media("HappyBirthdaySong.mp3", "/home/scripts") File "/home/busybox/.local/lib/python3.7/site-packages/googlecontroller/init.py", line 42, in serve_media spliced = http_tunnels.split('"')[1] IndexError: list index out of range
Ah I meant version of python, I am currently trying with 3.9 and succeeding.
Oh my lord I see the issue
home.serve_media("HappyBirthdaySong.mp3", "/home/scripts", opentunnel = 0) For the first time you must add that 3rd variable to open the pyngrok tunnel
Never after though...
That's the only issue, it didn't Initialize pyngrok, simple error!
OK I have the say working now My code is
from googlecontroller import GoogleAssistant
host = "10.0.0.1" #again your google homes ip home = GoogleAssistant(host=host) home.say("test") home.serve_media("HappyBirthdaySong.mp3", "/home/scripts", opentunnel = 0)
I have exposed port 80 in my Dockerfile. I am running once and I download the mp3 172.21.0.2 sh: 1: cmd: not found You are all set now! https://8d4a-155-143-180-128.ngrok.io/HappyBirthdaySong.mp3 t=2021-09-14T14:38:48+1000 lvl=warn msg="failed to open private leg" id=7c9571ac8ff8 privaddr=localhost:80 err="dial tcp 127.0.0.1:80: connect: connection refused"
The 2nd time 172.21.0.2 sh: 1: cmd: not found You are all set now! https://a1d3-155-143-180-128.ngrok.io/HappyBirthdaySong.mp3 t=2021-09-14T14:39:18+1000 lvl=warn msg="failed to open private leg" id=e09c2aad9d3f privaddr=localhost:80 err="dial tcp 127.0.0.1:80: connect: connection refused"
I dont know what this is sh: 1: cmd: not found
Any idea? Is there a pip3 install to new?
Actually no idea
Maybe the raspi local ip is different from 127.0.0.1...I honestly can't think atm I'll try it on a pi sometime this next week
127.0.0.1 is local host
Wait why is your Google homes ip like that?If you have a phone go to the app click the home settings, device info.The ip should look like 192.168.0.123 or something.
That's a stupid thing I just said, because say does work.But do try to replace it with something similar to that! Just for curiositys sake
My IP Range is 10.0.0.1 to 10.0.0.255
Yeah I know, the say command works so that is fine. Although I do not know if pyngrok is struggling or what
You could remove the pyngrok part in init py and replace it with a new link from pyngrok running in a separate terminal on the pi. Just try to run pyngrok generally, even a sample script
See if that works, if it doesn't that is a issue.
Im not sure what you wanted me to do I did RUN pip3 install googlecontroller RUN pip3 install pyngrok
and got 172.19.0.2 sh: 1: cmd: not found You are all set now! https://e9a4-155-143-180-128.ngrok.io/HappyBirthdaySong.mp3 t=2021-09-29T18:30:49+1000 lvl=warn msg="failed to open private leg" id=0a11ff9031fb privaddr=localhost:80 err="dial tcp 127.0.0.1:80: connect: connection refused"
Im running this and the say works
from googlecontroller import GoogleAssistant
host = "10.0.0.1" #again your google homes ip home = GoogleAssistant(host=host) home.say("test") home.serve_media("HappyBirthdaySong.mp3","/home/scripts",opentunnel = 0)
Ok that's good I think
Very good actually this part right here seems to be the issue then.
def httpserver(path):
os.chdir(path)
os.system('cmd /k "python -m http.server 80 --bind 127.0.0.1"')
Can you run this?
import os
os.system('cmd /k "python -m http.server 80 --bind 127.0.0.1"')
I believe that may be the issue, you might have to go into the init.py file in your modules folder for python. Then replace http.server with SimpleHTTPServer caps do matter!
Sorry for not seeing that sooner, keep forgetting your running on a raspi not windows. I'll write a patch that works for both not soon though do what is in previous comment.
Ok thanks Please let me know when 😀
Not gonna be for a little while but you can just change that simple line in init.py in the googlecontroller folder in the python modules directory! Lemme know if you get it working.
Patch is done uploading to pypi in a few hours
I used your example - please note I am using Python3
!/usr/bin/env python3
from googlecontroller import GoogleAssistant
host = "10.0.0.1" #again your google homes ip home = GoogleAssistant(host=host) home.serve_media("HappyBirthdaySong.mp3", "/home/scripts") with this version i got
googlecontroller==5 Traceback (most recent call last): File "./test.py", line 2, in
from googlecontroller import GoogleAssistant
File "/home/busybox/.local/lib/python3.7/site-packages/googlecontroller/init.py", line 1, in
from pyngrok import ngrok
ModuleNotFoundError: No module named 'pyngrok'
i pip installed pyngrok
172.24.0.2
Traceback (most recent call last):
File "./test.py", line 7, in
home.serve_media("HappyBirthdaySong.mp3", "/home/scripts")
File "/home/busybox/.local/lib/python3.7/site-packages/googlecontroller/init.py", line 38, in serve_media
http_tunnels = str(http_tunnel)
UnboundLocalError: local variable 'http_tunnel' referenced before assignment
With this version I got googlecontroller==5.5.6 172.25.0.2 Traceback (most recent call last): File "./test.py", line 7, in
home.serve_media("HappyBirthdaySong.mp3", "/home/scripts")
File "/home/busybox/.local/lib/python3.7/site-packages/googlecontroller/init.py", line 42, in serve_media
spliced = http_tunnels.split('"')[1]
IndexError: list index out of range
Also say is also not working. Im using docker in my environment