eshapiro42 / OctoPrint-Wyze

Control Wyze devices through OctoPrint
GNU General Public License v3.0
10 stars 1 forks source link

Connection to PSU Control plugin? #12

Open tbnorris opened 1 year ago

tbnorris commented 1 year ago

I understand the completely in how the Wyze SDK was deconstructed. I was wondering though, if an interface layer could be worked on that would allow the more "main stream" generic solution of PSU Control could be made. I am guessing that there would be some configuration that would need to be created for PSU Control to use it under the "plug-in" configuration option.

There is a list of plug-ins that interface with PSU Control to help support the growing number of special interfaces under the one "single button" solution. I know other support applications like OctoApp already have interactions with PSU Control and there would just need to be a configuration page for "what does on mean" and "what does off mean". Other Apps and interfaces have seemed to standardize on the PSU Control interface as well.

It might just be that another could of event handlers needs to be added to OctoPrint-Wyze to pick up on the PSU Control events.

List of sub plug-ins that are already supporting control by PSU Control: https://plugins.octoprint.org/by_tag/#tag-psucontrol-subplugin

eshapiro42 commented 1 year ago

What's your desired behavior here? Do you want the ability to toggle Wyze devices when a PSU Control event is received? It looks like the OctoPrint-PSUControl plugin adds an event for PSU state changes (https://github.com/kantlivelong/OctoPrint-PSUControl/blob/c0490c8c30388a649cc6e87525241dfe3b5923ca/octoprint_psucontrol/__init__.py#L843) so I guess this would be doable.

tbnorris commented 1 year ago

Desired behavior would be when I load the OctoApp or OctoRemote on my phone and "Turn PSU On" or click the Lightning bolt on OctoPrint image. Then that would toggle the turning on and off of the printer. Not spending much time looking at either code, it might just be adding the two new events and some how adding the plug-in to the list of options on PSU Control's setting page. image I am assuming that the sub plug-in must register itself with PSU Control to show up in that list and have the event fired.

eshapiro42 commented 1 year ago

What I'm struggling to understand is how this request relates to Wyze devices? OctoPrint-Wyze was built for a very specific purpose and what you're describing seems to be a much broader generalization which it was never intended to fulfill.

tbnorris commented 1 year ago

I don't understand what makes a wyze plug so different from a TPLink Plug, Wemo Plug, Tasmota Plug, Tapo Plug, FRITZ!Direct Plug, or want other smart plug that has a plugin that can be triggered from PSU Control. Screenshot_20230315-095232

PSU Control is a generic triggered to toggle, start and/or stop the power source from the main OctoPrint UI and most third party tools using: a Smart plug, pin on a raspberry pi, gcode command, and most likely other ways as well. A Wyze plug is no different than any of the other