matryer / xbar-plugins

Plugin repository for xbar (the BitBar reboot)
https://xbarapp.com
2.46k stars 1.04k forks source link

re: Octoprint #1289

Closed gts1117 closed 11 months ago

gts1117 commented 5 years ago

FAO: (@m0a)

I keep getting an ENDPOINT error, this is what I have in the file.

please setup

APIKEY="myapikey" ENDPOINT="http://127.0.0.1:5000" SNAPSHOTURL="http://127.0.0.1:8080/?action=snapshot" IMAGEWIDTH=300x

Any and all suggestions are greatly appreciated.

gingerbeardman commented 5 years ago

Looks like you need an API key. Maybe you do and you redacted it?

And are you running the software locally at 127.0.0.1? That's localhost and not what I would expect for setup.

gts1117 commented 5 years ago

Yes, I redacted the API key for privacy.

As for 127.0.0.1, that's the address that OctoPrint gives me when I go into the settings for snapshots, so that's what I put into the plugin. Does it need to be something else?

gingerbeardman commented 5 years ago

I'd have expected it to be the LAN IP address of your printer. More like the script defaults:

https://github.com/matryer/bitbar-plugins/blob/ec3ac184198936271503018330314fa38ad63a1a/Tools/octoprint.1m.sh#L12-L13

But I do not have a printer so I am only going on what the code seems to do (remote control the printer using the same interface as OctoPrint, not control OctoPrint).

gts1117 commented 5 years ago

I had tried that at first, but it was still throwing errors at me. I'g going to try setting a static IP when I get back into work next week and see if that helps at all.

gingerbeardman commented 5 years ago

There is no guess work or trying involved. You just need to find the printer IP.

gts1117 commented 5 years ago

There's apparently some guesswork and trying involved, giving the Pi a static IP and entering that IP into the plugin file still gives me an ENDPOINT error.

gingerbeardman commented 5 years ago

Let's see if we can figure this out using logic. Happy to help troubleshoot.

Please copy and paste error messages here.

gts1117 commented 5 years ago

All that the menubar error says is "please edit this file and change ENDPOINT."

Within the plugin file, I have it set to:

please setup

APIKEY="myapikey" ENDPOINT="http://http://192.168.5.15/:5000" SNAPSHOTURL="http://http://192.168.5.15/:8080/?action=snapshot" IMAGEWIDTH=300x

Within OctoPrint, the snapshot url it gives me is "http://127.0.0.1:8080/?action=snapshot"

The IP address of my Pi has been set to a static IP of 192.168.5.15

Is there any other info that would be useful?

gingerbeardman commented 5 years ago

OK, so there are two http:// in each URL, and extraneous forward slash /

127.0.0.1 is local to your computer, which makes sense for the software running on it to refer to itself. But not to point to your printer, for that the 192.168 is LAN address which makes sense as the address of something else on your network like your printer.

What happens changing the below two lines?

ENDPOINT="http://192.168.5.15:5000"
SNAPSHOTURL="http://192.168.5.15:8080/?action=snapshot"
gts1117 commented 5 years ago

..........Let's pretend that never happened. Jeez myself.

So that totally fixed the ENDPOINT error, now it's throwing "parse error: Invalid numeric literal at line 1, column 10" at me over and over.

gingerbeardman commented 5 years ago

assuming the error is about the script itself (it may not be you'd need to check the full error message) then line 1, column 10 is the end of line 1?

what line endings does the file have? how dod you initially create the file?

gts1117 commented 5 years ago

The only think on line 1 is

!/bin/bash

If I understand what you mean by line endings, some of them end in curly brackets {} some in square [] some in semicolons, some with nothing special.

All I did to create the file was download the plugin script from the BitBar repository.

gingerbeardman commented 5 years ago

So line endings in my meaning are whether the hidden character signalling the end of a line is of Windows or Unix (macOS) format. You'd only see this by using an editor that support showing you that information, like BBEdit.

First line error must be something else. Very odd.

What I will do is prepare you a file as I would do it and see if it works for you. octoprint.1m.sh.zip

Let me know if this is any different.

gts1117 commented 5 years ago

I've been using Visual Studio Code to view and edit the plugin file.

Except for the API key, your file is the exact same as what I have and throws the same errors at me.

Also thank you very much for helping troubleshoot this with me.

gingerbeardman commented 5 years ago

OK, we need to get the error in more detail.

Can you run the plugin script from Terminal?

gts1117 commented 5 years ago

Yep, here's what I get running from Terminal

myComputer:~ myUsername$ /Users/myUsername/Documents/BitBar\ Plugins/octoprint.1m.sh
parse error: Invalid numeric literal at line 1, column 10
parse error: Invalid numeric literal at line 1, column 10
parse error: Invalid numeric literal at line 1, column 10
 | color=black
---
parse error: Invalid numeric literal at line 1, column 10
parse error: Invalid numeric literal at line 1, column 10
hotend:?C  bed:?C | color=black
parse error: Invalid numeric literal at line 1, column 10
parse error: Invalid numeric literal at line 1, column 10
octoprint: api: | color=green href=http://192.168.5.15/:5000
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/556.
convert: no images defined `-' @ error/convert.c/ConvertImageCommand/3273.
| image= refresh=true
---
parse error: Invalid numeric literal at line 1, column 10
gingerbeardman commented 5 years ago

In hindsight, that's not useful as it's not running through BitBar. Will need to have a think.

gts1117 commented 5 years ago

No rush, and thank you again for your assistance.

sprak3000 commented 11 months ago

Closing due to age.