I am running LMS on a Pi4 using Raspbian OS. I have been trying on and off for several weeks now to get the updater to work with no success, probably because I am very much a Linux novice!
1.My ngork.yml file (Autostart works.) looks like this with personal info "X'd" out ( Command: nano ~/.ngrok2/ngrok.yml): authtoken: XXXXX... web_addr: 0.0.0.0:4040 inspect: false region: us tunnels: mediaservertunnel: proto: http bind_tls: true inspect: false addr: 192.168.10.79:9000 auth: "XX:XX" 2. This is the service file ( Command:sudo nano /etc/systemd/system/ngrok.service): [Unit] Description=ngrok autostart Wants=network.target After=network.target [Service] Type=simple WorkingDirectory=/tmp ExecStartPre=/bin/sleep 5 ExecStart=/usr/local/bin/ngrok start -config=/home/pi/.ngrok2/ngrok.yml media$ ExecStartPost=/usr/bin/python3 /home/pi/updater.py RestartSec=30 (NOTE: I have tried increasing this to 90.) StandardOutput=syslog StandardError=syslog SyslogIdentifier=ngrok [Install] WantedBy=multi-user.target 3. This is the updater.py script with personal info "X'd": #!/usr/bin/python3 # (c) smartskills.tech 2020, all rights reserved # This script updates the ngrok tunnel details used by your LMS skill(s) import requests import json import urllib.parse # Change these 3 parameters to match your setup myNgrok = 'http://192.168.10.79:4040/api/tunnels' myTunnels = ['mediaservertunnel'] myUuid = ['XXX...'] # No changes after this line def getTunnel(): try: subdomains = [] res = requests.get(myNgrok) res_unicode = res.content.decode("utf-8") res_json = json.loads(res_unicode) for tunnel in res_json["tunnels"]: if tunnel["proto"] != "https": continue if not tunnel["name"] in myTunnels: continue publicURL = tunnel["public_url"] name = tunnel["name"] subdomains.append({"name": name, "url": publicURL}) except Exception as err: print('ngrok inspection error: ', err) exit() return subdomains def performUpdate(subdomains, uuid): url = 'https://smartskills.tech/linking/updateNgrok.php?uuid=' + \ uuid + '&data=' + urllib.parse.quote(json.dumps(subdomains, separators=(',', ':'))) response = requests.get(url) return response subdomains = getTunnel() print(json.dumps(subdomains)) for uuid in myUuid: res = performUpdate(subdomains, uuid) print(res.text) print('Finished') 4. It appears that the script is executable (using "chmod +x) because running "/usr/bin/python3 /home/pi/updater.py" yields: [{"name": "mediaservertunnel", "url": "https://XXX..."}] OK 1 Finished The "url" agrees with the one shown on the Alexa app link page. Any suggestions on where I am going wrong would be appreciated. ------------------------------------------------------------------------ raglencross's Profile: http://forums.slimdevices.com/member.php?userid=7239 View this thread: http://forums.slimdevices.com/showthread.php?t=111016 _______________________________________________ plugins mailing list [email protected] http://lists.slimdevices.com/mailman/listinfo/plugins
