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

Printer power plugin #1

Merged
merged 7 commits into from
Jul 27, 2020
Merged

Conversation

jordanruthe
Copy link
Contributor

Adding plugin to control printer power via shell scripts. This would allow moonraker to turn on/off the printer rather than manually doing it through the cli. Implementing this into moonraker rather than klipper since if a MCU is powered down, due to a power off, klipper will refuse to issues any commands such as M80/M81 which would allow the MCU to turn back on if controlled by hardware.

@lixxbox
Copy link

lixxbox commented Jul 27, 2020

Hi!
Could you later add an "auto power off" function? A timeout that turns off the relay when the klipper is idle and no interaction via moonraker takes place?

I am looking forward to the plugin and the possibility to use it via mainsail.

@Arksine
Copy link
Owner

Arksine commented Jul 27, 2020

Hi. I think the concept of managing "printer power" from Moonraker makes sense. I do have some high level comments.

I haven't yet had a chance to add the contributing guidelines to the repo, I'll get to that as soon as I am able. The tentative plan for Moonraker is to eventually merge it into the Klipper repositiory, after which this repo will be archived. Thus contributions to Moonraker will have the same guidelines as Klipper:

  • The start of the source code needs a copyright notice. We can move the configuration documentation to the bottom of installation.md until I have a better place for it.
  • Each commit needs to be signed off

As for the code itself, it looks good, however I can't merge the configurable shell scripts. The scripts that toggle GPIOs will need to be hardcoded. We can do that in the source itself by writing to a script to a temporary file, or we can add scripts to the "scripts" folder that toggle/query a supplied GPIO.

Thanks.

@jordanruthe
Copy link
Contributor Author

Thanks for the contribution guidelines.

I was trying to avoid tying it to RPi GPIO for people who may not run this setup on a RPi and keep the flexibility to do more than just toggle a pin (such as restart klipper, turn on/off a display), but just swapped it an have it working on my system.

As for the timeout feature, I'll look into that as that's also something I would like.

@Arksine
Copy link
Owner

Arksine commented Jul 27, 2020

Thanks. I understand the flexibility point of view. I'm okay with using RPi.GPIO for now, however in the future I can write a small plugin that toggles GPIOs using sysfs. That way GPIO functionality would not be tied to Raspberry Pi hardware.

If we need to add more customization aside from toggling GPIOs its possible to add support for Jinja2 templates. We would just need to define what kind of functionality we need to make available. I think that is something to hold off on unless it is needed though.

When you are ready for me to merge this let me know, I just need you to sign off on your last commit. It is up to you if you want me to do a squash merge or if you want to rebase yourself.

Sign-off-by Jordan Ruthe
@jordanruthe
Copy link
Contributor Author

Good point, I just modified it so RPi.GPIO isn't a dependency. I'm good with it if you are, go ahead and squash merge it.

@Arksine Arksine merged commit c589287 into Arksine:master Jul 27, 2020
@Arksine
Copy link
Owner

Arksine commented Jul 27, 2020

Thanks.

@lixxbox
Copy link

lixxbox commented Sep 1, 2020

would it be a lot of work to implement mqtt? so that you can turn sonoff/tasmota devices on and off, for example.
this would give us back some flexibility without allowing direct access to the system.

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