Feller-AG / wiser-api

MIT License
15 stars 1 forks source link

configure switch to simulate push button #7

Open neckcen opened 1 year ago

neckcen commented 1 year ago

Hello,

I am trying to configure a switch to behave like a push button. Using the current API, I believe the closest approximation would be setting delayed_off, however this does not help in my case (press time should vary). Did I miss anything or is this feature not (yet?) available?

My use case: a Feller pirios 360R eco which can be turned on either momentarily (<2s press) or for an extended duration (>2s press). I honestly do not care much about the momentary on, but turning it off requires a short press again which means delayed_off=2500 does not work.

woodworm commented 1 year ago

Since version 5.1.19 we support user scripts. The scripts can be executed by SmartButtons events. There are examples on the Script webpage. Maybe you can implement your requirement with this feature.

neckcen commented 1 year ago

The switch in question is not a smartbutton, so I was hopping to be able to directly change the input type. Something similar to:

PATCH  /api/devices/config/{config_id}/inputs/{input_channel}
{
  "type": "momentary_on"
}

I do however have a smart button nearby so I'll try with a script for now and see what can be done.

PhilippImhof commented 1 month ago

Since version 5.1.19 we support user scripts. The scripts can be executed by SmartButtons events. There are examples on the Script webpage. Maybe you can implement your requirement with this feature.

@woodworm The question is probably dumb, but what or where is "the Script webpage"? (I tried the "scripts" section of the µGateway interface, but I cannot find any documentation or examples there.)

woodworm commented 1 month ago

do you know this description? https://github.com/Feller-AG/wiser-tutorial/blob/main/doc/api_scripts.md

woodworm commented 1 month ago

Click on 1 and then on 2, and you should find even better examples.

image

woodworm commented 1 month ago

Oh yes... your question isn’t dumb... our documentation could be better. We are working on it... otherwise, just feel free to ask.

PhilippImhof commented 1 month ago

Very nice, thank you. I somehow missed the api_scripts.md, even though I was at that repo. And unfortunately, I only tested my_script.py which did not contain much. I will definitely have a look at those docs.

Can those script directly (without further authorization) execute actions on the Wiser gateway as well, i. e. can I press a smartbutton which in turn runs a script that does some checks and then executes one or more jobs?

woodworm commented 1 month ago

The current script framework was primarily designed to allow control of other systems using the button on the wall of the feller wiser system. However, additional use cases are certainly possible. I will add it to the roadmap to enable direct job triggering through the script framework.