Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change default profile via API #1541

Closed
MoonshineSG opened this issue Oct 10, 2016 · 7 comments
Closed

change default profile via API #1541

MoonshineSG opened this issue Oct 10, 2016 · 7 comments
Labels
bug Issue describes a bug done Done but not yet released

Comments

@MoonshineSG
Copy link

What were you doing?

change the default printer profile via the API

curl --insecure --connect-timeout 15 --request PATCH -H "Content-Type: application/json" -H "X-Api-Key: XXXXX" --data '{ "profile": { "default": true } }' https://octoprint.local/api/printerprofiles/_marlin

What did you expect to happen?

the new profile to be set as default.

What happened instead?

the new profile is shown as default both in Settings and via the api (https://octoprint.local/api/printerprofiles), but an OctoPrint restart "forgets" about it and resets the default profile to the old one

Branch & Commit or Version of OctoPrint

Version: 1.3.0.dev1417+g73e8d5e (devel branch)

Printer model & used firmware incl. version

not important

Browser and Version of Browser, Operating System running Browser

Chrome & API via CURL

Link to octoprint.log

n/a

Link to contents of terminal tab or serial.log

n/a

Link to contents of Javascript console in the browser

n/a

Screenshot(s) showing the problem:

n/a

I have read the FAQ.

@MoonshineSG
Copy link
Author

At the same time a related question. If I have 2 profiles with custom ID, why is there a "_default" named profile as well (I did not create that) ?

@MoonshineSG
Copy link
Author

there seams to be a problem with the "colour" as well. The profile colour does not get applied to the UI (top bar)

@ntoff
Copy link
Contributor

ntoff commented Oct 14, 2016

there seams to be a problem with the "colour" as well. The profile colour does not get applied to the UI (top bar)

It never has for me either, always wondered what that colour thing was meant to be for.

@MoonshineSG
Copy link
Author

I found a work around to all these problems. Instead of having multiple profiles and do an API switch (which doesn't work), I have a single default profile and using 2 API calls I change the properties of that profile (extruder count and nozzleDiameter) and with the settings API I change the colour and the printer name to show the count and the diameter.

A third, custom plugin call will reload the UI to reflect the changes.

Works perfectly.

@foosel
Copy link
Member

foosel commented Oct 14, 2016

It never has for me either, always wondered what that colour thing was meant to be for.

Best don't ask. An external requirement from my former employer for more or less internal use that (color coded printer profiles in another UI and me not arguing against it loud enough). In fact, I should probably just kill it again.

@foosel
Copy link
Member

foosel commented Oct 14, 2016

About the original problem, that has now been solved on maintenance and devel. While the new default value was set on the settings object, it wasn't saved to disk. Which means while OctoPrint was running, it persisted, but once restarted it fetched the old value from disk.

If I have 2 profiles with custom ID, why is there a "_default" named profile as well (I did not create that) ?

Because the _default one currently has to be there always due to how stuff is designed at the moment. I might change that in the future so that when creating your printer profile (which devel will now actually offer you a wizard for if you haven't customized it) it will also allow you to specify the id instead of having the first profile always be _default, but for now, it's simply like that due to an admittedly bad design decision.

@foosel foosel added bug Issue describes a bug done Done but not yet released labels Oct 14, 2016
@MoonshineSG
Copy link
Author

I can live with the current _default :D
Thanks for the other fix.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue describes a bug done Done but not yet released
Projects
None yet
Development

No branches or pull requests

3 participants