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

[Feature Request]: Ability to turn off Plug based on other sensor data (e.g., enclosure temperature #314

Open
puterboy opened this issue Aug 7, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@puterboy
Copy link

puterboy commented Aug 7, 2022

Hi @jneilliii -- really love this plugin...
And now that I have gotten my enclosure sensor to display in your other Plotly plugin, I would like to use the enclosure sensor to trigger a TP-Link power off if the temperature exceeds a user-specified value, similar to what you can do with the existing sensors.

I see this as a potentially important safety measure in that if the chamber is overheating, I can kill power to the printer and accessories, even if the other sensors have not yet triggered.

How hard would this be to implement?

@puterboy puterboy added the enhancement New feature or request label Aug 7, 2022
@jneilliii
Copy link
Owner

It would probably make more sense to keep the logic of the sensor reading and off triggers for those as part of the single file plugin that you made for the PlotyTempGraph plugin. In this plugin's current state there are only a couple of ways to trigger the off command. That is via API call as documented in the wiki or one of the gcode trigger commands when that option is enabled. I have been considering to add both CLI and plugin helpers to make integrating a little easier for others.

@puterboy
Copy link
Author

I assume you mean adding logic to the PlotlyTempGraph plugins that trigger the TP-Switch to turn on/off. Question is how do I call the TP Link on/off switch from PlotlyTempGraph. I could hack something based on some other python code I have for accessing TP Link switches but that seems messy. But if I have to do so much hacking, why even use Octoprint, I could just write a shell script to test a sensor value and based on that trigger turn on/off TP Link plugs using totally external code.

A more important problem with PlotlyTempGraph is that it only monitors temps when the printer is on while one might want to cut power to the plug (or alternatively turn it on) based on a sensor value even when the Printer is off.

Wouldn't it be easier to just have a text box added to this plugin that is sent as a system (shell) command returning 0/1 -- where 1 means turn off (0 means do nothing). The command could be just about anything, allowing for triggers based on any external sensor event or even other conditions (e.g., time/date, status of another program, etc.). Seems dead simple, to exec the shell command every X seconds (configurable?) and then trigger switch based on return value.
(Alternatively the system command could return a temperature and then based on that temperature you could set a trigger to turn off the plug -- but this seems less general since not all events may be temperatures).

If you want to be fancy, you could:

  1. Have an option to reverse the logic so that 1 turns on the plug (still 0 does nothing) - or even logic where 1 turns on and 0 turns off
  2. Allow multiple sensor toggle command text-boxes

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

No branches or pull requests

2 participants