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

Add auto connect option when Octoprint 'Connects' #356

Merged
merged 13 commits into from
Feb 9, 2024

Conversation

puterboy
Copy link

@puterboy puterboy commented Feb 9, 2024

This adds feature request #307
Note I had to add the following config.yaml settings to allow cusomized enabling.
connect_on_connect_request (modeled after event_on_startup_monitoring)
connect_on_connect (per plug - modeled on event_on_startup)

Note I had to test that tplinksmartplug itself had finished startup or else it would try to connect at Octoprint startup (if Octoprint had autostartup enabled). This would then conflict with tplinksmartplug's own separate feature to connect automatically on Octoprint startup.

So as it works now, the feature only works after the initial Octoprint startup.
Note this also overlaps with the feature that automatically turns on when a file is uploaded for printing in that generates a connect hook call but I don't see any harm there -- though presumably one could test to avoid this.

jneilliii and others added 13 commits March 18, 2023 10:32
Bumps [actions/stale](https://github.com/actions/stale) from 7 to 8.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](actions/stale@v7...v8)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [actions/stale](https://github.com/actions/stale) from 8 to 9.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](actions/stale@v8...v9)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
…ions/actions/stale-9

Bump actions/stale from 8 to 9
@puterboy
Copy link
Author

puterboy commented Feb 9, 2024

The duplication also occurs with AutoConnect where manually turning on the 'Plug' triggers a Connection which then automatically triggers a request to turn on the Plug
But again there is no harm in trying to turn on a plug that is already on.
One could check whether a plug is already on before attempting to turn it on but again no harm in turning on an on plug.

Let me know what you prefer and I can adjsut code as neeeded...

@jneilliii jneilliii changed the base branch from master to rc February 9, 2024 18:48
@jneilliii jneilliii merged commit acbfed1 into jneilliii:rc Feb 9, 2024
@puterboy
Copy link
Author

puterboy commented Feb 9, 2024

One quick note... I didn't modify the GUI to add these variables as I didn't want to mess with your layout -- especially since it is already chock-full...
So until/unless you want to add to the GUI these variables will need to be set manually in config.xml.

@jneilliii
Copy link
Owner

Thanks for the heads up. There will also need to be some tweaks to other bits when adding to the UI that require additional tweaks using the settings migration, because none of the configured plugs would have that new property and would cause errors when loading. That's usually handled through the settings_migration.

@puterboy
Copy link
Author

Thanks for the heads up. There will also need to be some tweaks to other bits when adding to the UI that require additional tweaks using the settings migration, because none of the configured plugs would have that new property and would cause errors when loading. That's usually handled through the settings_migration.

Yeah - I saw that but I didn't want to presume when/how you wanted to add a new migration version.

BTW, I really am finding this new option very helpful because while I often start new prints by uploading and connecting automatically via Prusa slicer, I also often want to pre-connect either to preheat the bed & tool or to reprint a previously uploaded print.
I often want to this when I am away from my computer browser using on of the various octoprint mobile apps that don't include access to the TPLinkSmartPlug plugin.
Now I can (indirectly) turn on the printer by pressing the 'connect' button on the mobile app.
As such, it really is USEFUL..

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.

2 participants