Salamafet / ophom

Octoprint Philips Hue Outlet Manager
7 stars 1 forks source link

Toggle Hue switch from mobile app - OctoPod? #44

Closed jiriteach closed 2 years ago

jiriteach commented 3 years ago

Hi - Any thoughts on how this can be done or support required for this? Loving this plugin. Simple and useful.

I am looking into how I can toggle my Hue switch from OctoPod. From a simple approach - OctoPod supports custom controls - https://plugins.octoprint.org/plugins/customControl/ which can run a command/script etc. or I can add one to Octoprints conf which will appear under the system commands.

Any way of executing a toggle via a script?

Great work on this.

Thanks

Salamafet commented 2 years ago

Hi,

You can send command thought API to control ophom.

I think you can configure customControl to use curl for sending a request. For example: curl http://localhost/api/plugin/ophom?action=toggle

If curl command is not found, you can specify the path /usr/bin/curl

Keep me in touch

jiriteach commented 2 years ago

Awesome - Thanks. Didnt realise this could be toggled via an API.

Couldnt use custom controls since it does not seem to work if the printer is off so ended up adding an action to the config.yaml and this appears in Octopod as well.

Thanks

jiriteach commented 2 years ago

Spoke too soon - I am getting issues where Octoprint is crashing or failing -

2021-07-15 10:39:12,167 - octoprint.server.api.system - WARNING - Command for custom:printeron failed: 500 Internal Server Error: Command for custom:printeron failed with return code -15:

I've tried this from custom commands or via the config.yaml calling curl directly and via a .sh script - it doesnt like running this.

Salamafet commented 2 years ago

Bad news :(

Didnt realise this could be toggled via an API.

Ophom is a giant API with a little bit of web. The web interface control Ophom via the API. I've not documented this. I'm bad.

I've tried to create a Toggle function trough "Custom Control Editor" but nothing happens. After searching, I've found something interesting according Custom Control : https://github.com/Salandora/octoprint-customControl/issues/17. The plugin can't run system command.

Maybe you can try with this plugin for creating custom gcode : https://plugins.octoprint.org/plugins/gcodesystemcommands/ Or this one : https://plugins.octoprint.org/plugins/systemcommandeditor/

jiriteach commented 2 years ago

Thanks for the pointer and no worries about not documenting things. Ophom is great and works well. I'll try the other plugin.

Thanks