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

Connect on external power on #229

Open
wants to merge 4 commits into
base: devel
Choose a base branch
from

Conversation

oerkel47
Copy link

Thank you for your interest into contributing to OctoPrint-PSUControl, it's highly appreciated!

Before submitting please make sure you have ticked all points on this checklist:

  • Your PR targets the devel branch.
  • Your PR was opened from a custom branch on your repository (no PRs from your version of master or devel please)
  • Your PR only contains relevant changes: no unrelated files, no dead code, ideally only one commit - rebase your PR if necessary!
  • Your changes follow the existing coding style.
  • You have tested your changes (please state how!)

Feel free to delete all this help text, then describe your PR further. You may use the template provided below to do that. The more details the better!


What does this PR do and why is it necessary?

Adds option to connect the printer when the relay/switch is controlled from outside of psu control.

How was it tested? How can it be tested by the reviewer?

Turn on relay externally and see if it connects.

Any background context you want to provide?

What are the relevant tickets if any?

discussion in discord

Screenshots (if appropriate)

Further notes

@Dunstkreis
Copy link

copied this into my setup. Nice and useful feature cos when I power my printer on any other way than through PSU control it was not connected. So I wasnt able to start a print right away (like from PrusaSlicer).
But I think this could need a "disconnect on external power off" function too?

@oerkel47
Copy link
Author

But I think this could need a "disconnect on external power off" function too?

I don't think this is possible, because PSU Control has no way of knowing that you will turn off the relay if you do it externally. So it can not disconnect properly before turning off.

@Dunstkreis
Copy link

Yeah I know. But that was not my intention. After powering off two things happen here. Either after about 35ish seconds I get an error message saying something about communication loss. Or if I turn the power on within this time I get the info about a printer reset.

Both is kinda correct but I just though, well its PSU is off, we dont need to wait for the error message to know its disconnected. We could just trigger the disconnect right away.

Within the timeout and regarding the "printer reset" message, aka Octoprint kinda recovering the connection, this wont be necessary if we reconnect after external PSU switching on. We will end up with a running connection to the printer.

So we would not need to keep trying if the printer comes back online (while PSU off) and we could just depend on this feature to reconnect after power is back on.

Yeah, we would loose the info box about the printer reconnect. So we could just go with something in between, lets wait 10 secs or any given time out (like half of timeout for reconnecting and the error message) and then lets just trigger the Octoprint disconnect.

Obviously this should only work and only be active if "connect on external power on" is active.

@oerkel47
Copy link
Author

I see. My printer behaves differently apparently. Octoprint will instantly go to "Offline after error" when I shut it off externally and it didn't bother me.

You could try adding the disconnect to the code and see if does the trick. Also, I just saw your post and PR. Check out the different branch in my fork of PSU Control. It implements some more changes, also related to the turn on and start printing things, and should be a fix for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants