kennethjiang / OctoPrint-Anywhere

MIT License
64 stars 18 forks source link

[Feature Request]: Event on clientOpenedAnywhere & clientClosedAnywhere #71

Open Codetron opened 5 years ago

Codetron commented 5 years ago

Ciao @kennethjiang, great plugin, you did a really good job. Looking through all the plugin files, I could not find any yaml events related to the connection or disconnection of a client. I was wondering if it was possible to implement this feature. I use events to automate the lighting of leds when a client connects to the Octoprint server. I bring the code below: in config.yaml I entered this and it works great

events:   enabled: True   subscriptions:   - event: ClientOpened #client connected to octoprint    command: M42 P4 S255 # turn the light on    type: gcode    - event: ClientClosed #client disconnected from octoprint    command: M42 P4 S0 # turn off the light    type: gcode    I made this small automation referring to the examples on this official page: http://docs.octoprint.org/en/master/configuration/config_yaml.html#events

I would like to do the same thing when a client or guest has logged in or disconnected from the web page of the anywhere plugin.

Example:

Do you think it is possible? I thank you in advance.

kennethjiang commented 5 years ago

Hi @Codetron This is a good suggestion.

There is currently no custom events or actions defined in OctoPrint Anywhere. It'll take a while to implement if I decide to do so.

Will keep you posted.