Closed puterboy closed 8 months ago
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...
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.
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.
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..
This adds feature request #307 Note I had to add the following
config.yaml
settings to allow cusomized enabling.connect_on_connect_request
(modeled afterevent_on_startup_monitoring
)connect_on_connect
(per plug - modeled onevent_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.