OllisGit / OctoPrint-SpoolManager

Plugin for managing Spools
168 stars 58 forks source link

Siri shortcuts not working #308

Closed aheath70 closed 1 year ago

aheath70 commented 1 year ago

I am trying to get Siri shortcuts to work. I have followed the instructions at https://github-wiki-see.page/m/OllisGit/OctoPrint-SpoolManager/wiki/Siri-Shortcut and unfortunately, it just doesn't change the spool. When I try to change it, nothing happens - no change, no MQTT message, nothing in the Octoprint logs.

I have adjusted the URL for my Octoprint host. It looks like

http://192.168.0.186/plugin/SpoolManager/selectSpoolByQRCode/1

IMG_9D6A5320E72D-1

I have added the headers and I know that my API key works, as I am using it elsewhere.

During troubleshootinhg, I used the following curl command

curl "http://octoprint.local/plugin/SpoolManager/selectSpoolByQRCode/2" -H "Key:X-Api-Key" -H "Text:aloadofjumbledtextwhichismyapkey"

and got the following output

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to target URL: <a href="http://octoprint.local/#tab_plugin_SpoolManager-spoolId1">http://octoprint.local/#tab_plugin_SpoolManager-spoolId1</a>. If not click the link

The only time I see an MQTT message or anything in the Octoprint log is when I run the above command on the spool that is already selected. When I attempt to change it to another spool, I get no MQTT message and nothing in the Octoprint logs.

Is this a bug, or am I doing something wrong here. I am using curl for testing only. I plan on eventually having a button in Home Assistant which runs the requisite REST command to change the spool.

I am running Octoprint version 1.8.6, OctoPi version 0.18.0, on Raspberry Pi 3 Model B Rev 1.2.

aheath70 commented 1 year ago

More troubleshooting on this.

I am now managing to get consistent entries in the log files. When I scan a QR code for one of the filaments, it successfully changes the active filament to the one scanned. I think that is because it has cached my username and password and so therefore logs me in and the filament is changed successfuly.

If I put in the same URL into an incognito window, the first time I do it it redirects to the OctoPrint login page, I key in username and password. The normal redirection to the filament spool page does not happen and it does not change the spool. I then open another window in the same incognito session, enter the URL and I am automatically logged into OctoPrint the redirection to the spool page works, and it changes the active spool as expected.

I wonder whether the Siri shortcuts and curls not working has something to do with the above behaviour.

Relevant log on first entry of URL in Incognito Window. I am trying to change from the "Black" spool which is QR code 1 to the white spool which is QR code 3.

2023-01-25 00:55:56,133 - octoprint.plugins.SpoolManager - INFO - API select spool by QR code3
2023-01-25 00:55:56,159 - octoprint.plugins.SpoolManager - INFO - Store selected spool Black for tool 0 in settings.
2023-01-25 00:55:56,160 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 00:55:56,239 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 00:55:57,073 - octoprint.server.util.sockjs - INFO - New connection from client: ::ffff:192.168.0.198
2023-01-25 00:55:57,117 - octoprint.plugins.PrintJobHistory - INFO - Plugin-State:
| PreHeat=enabled (0.8.0)
| filamentmanager=missing (None)
| DisplayLayerProgress=enabled (1.28.0)
| SpoolManager=enabled (1.7.0)
| UltimakerFormat=enabled (1.0.2)
| PrusaSlicerThumbnail=enabled (1.0.1)
| costestimation=enabled (3.5.0)

2023-01-25 00:56:00,218 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 00:56:00,287 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 00:56:01,115 - octoprint.access.users - INFO - Logged in user: admin
2023-01-25 00:56:01,118 - octoprint.server.api - INFO - Actively logging in user admin from ::ffff:192.168.0.198
2023-01-25 00:56:01,267 - octoprint.server.util.flask - INFO - Passively logging in user admin from ::ffff:192.168.0.198
2023-01-25 00:56:01,268 - octoprint.access.users - INFO - Logged in user: admin
2023-01-25 00:56:01,556 - octoprint.server.util.sockjs - INFO - Client connection closed: ::ffff:192.168.0.198
2023-01-25 00:56:03,179 - octoprint.server.util.flask - INFO - Passively logging in user admin from ::ffff:192.168.0.198
2023-01-25 00:56:03,180 - octoprint.access.users - INFO - Logged in user: admin
2023-01-25 00:56:04,286 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 00:56:04,449 - octoprint.server.util.sockjs - INFO - New connection from client: ::ffff:192.168.0.198
2023-01-25 00:56:04,478 - octoprint.plugins.PrintJobHistory - INFO - Plugin-State:
| PreHeat=enabled (0.8.0)
| filamentmanager=missing (None)
| DisplayLayerProgress=enabled (1.28.0)
| SpoolManager=enabled (1.7.0)
| UltimakerFormat=enabled (1.0.2)
| PrusaSlicerThumbnail=enabled (1.0.1)
| costestimation=enabled (3.5.0)

2023-01-25 00:56:04,554 - octoprint.server.util.flask - INFO - Passively logging in user admin from ::ffff:192.168.0.198
2023-01-25 00:56:04,555 - octoprint.access.users - INFO - Logged in user: admin
2023-01-25 00:56:07,673 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 00:56:07,737 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 00:56:13,530 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 00:56:13,659 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 00:56:13,806 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 00:56:13,924 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 00:56:14,044 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 00:56:14,089 - octoprint.server.util.sockjs - INFO - User admin logged in on the socket from client ::ffff:192.168.0.198
2023-01-25 00:56:17,125 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 00:56:17,964 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus

As you can see, it never changes from black to white.

Now the log on the subsequent entry of teh URL within a new window in the same incognito session.

2023-01-25 01:02:50,518 - octoprint.plugins.SpoolManager - INFO - API select spool by QR code3
2023-01-25 01:02:50,538 - octoprint.plugins.SpoolManager - INFO - Store selected spool Black for tool 0 in settings.
2023-01-25 01:02:50,538 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 01:02:50,590 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 01:02:50,818 - octoprint.server.util.flask - INFO - Passively logging in user admin from ::ffff:192.168.0.198
2023-01-25 01:02:50,818 - octoprint.access.users - INFO - Logged in user: admin
2023-01-25 01:02:52,556 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 01:02:52,689 - octoprint.server.util.flask - INFO - Passively logging in user admin from ::ffff:192.168.0.198
2023-01-25 01:02:52,690 - octoprint.access.users - INFO - Logged in user: admin
2023-01-25 01:02:53,011 - octoprint.server.util.sockjs - INFO - New connection from client: ::ffff:192.168.0.198
2023-01-25 01:02:53,085 - octoprint.plugins.PrintJobHistory - INFO - Plugin-State:
| PreHeat=enabled (0.8.0)
| filamentmanager=missing (None)
| DisplayLayerProgress=enabled (1.28.0)
| SpoolManager=enabled (1.7.0)
| UltimakerFormat=enabled (1.0.2)
| PrusaSlicerThumbnail=enabled (1.0.1)
| costestimation=enabled (3.5.0)

2023-01-25 01:02:53,184 - octoprint.server.util.flask - INFO - Passively logging in user admin from ::ffff:192.168.0.198
2023-01-25 01:02:53,184 - octoprint.access.users - INFO - Logged in user: admin
2023-01-25 01:02:56,231 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 01:02:56,353 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 01:02:57,812 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 01:02:57,933 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 01:02:58,158 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 01:02:58,285 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 01:02:58,404 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 01:02:58,444 - octoprint.server.util.sockjs - INFO - User admin logged in on the socket from client ::ffff:192.168.0.198
2023-01-25 01:03:00,704 - octoprint.plugins.SpoolManager - INFO - Store selected spool White for tool 0 in settings.
2023-01-25 01:03:00,705 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 3, 'spoolName': 'White', 'material': 'PLA', 'colorName': 'white', 'remainingWeight': 766.8}' to event-bus
2023-01-25 01:03:01,229 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 3, 'spoolName': 'White', 'material': 'PLA', 'colorName': 'white', 'remainingWeight': 766.8}' to event-bus
2023-01-25 01:03:01,281 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 3, 'spoolName': 'White', 'material': 'PLA', 'colorName': 'white', 'remainingWeight': 766.8}' to event-bus
2023-01-25 01:03:01,410 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 3, 'spoolName': 'White', 'material': 'PLA', 'colorName': 'white', 'remainingWeight': 766.8}' to event-bus
2023-01-25 01:03:02,565 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 3, 'spoolName': 'White', 'material': 'PLA', 'colorName': 'white', 'remainingWeight': 766.8}' to event-bus
2023-01-25 01:03:02,635 - octoprint.plugins.SpoolManager - INFO - API generate QR code for Spool with databaseId: 3

You can see the entries where it changes from black to white.

Now the log file entries when I try to enter the commands using CURL with HTTP headers trying to change filament from black to white

2023-01-25 01:08:06,889 - octoprint.plugins.SpoolManager - INFO - API select spool by QR code3
2023-01-25 01:08:06,908 - octoprint.plugins.SpoolManager - INFO - Store selected spool Black for tool 0 in settings.
2023-01-25 01:08:06,908 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 01:08:07,336 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus
2023-01-25 01:08:20,353 - octoprint.plugins.SpoolManager - INFO - Send Event 'plugin_spoolmanager_spool_selected' with payload '{'toolId': 0, 'databaseId': 1, 'spoolName': 'Black', 'material': 'PLA', 'colorName': 'Black', 'remainingWeight': 578.1}' to event-bus

That's it ... just a few lines - something is stopping from this from working. I get the exact same lines in the log file when trying to use the Siri shortcuts as I do for CURL (date/time on each line is different obviously).

github-actions[bot] commented 1 year ago

This issue has been automatically marked for closing, because it has not had activity in 30 days. It will be closed if no further activity occurs in 10 days.

github-actions[bot] commented 1 year ago

This issue was closed, because it has been already marked for 10 days with no activity.