staromeste / homebridge-http-advanced-accessory

Supports all devices on HomeBridge Platform / Bridges devices to http
Apache License 2.0
65 stars 22 forks source link

Call two endpoints for setOn #47

Open bradstcroix opened 1 year ago

bradstcroix commented 1 year ago

Hi Staromeste,

I'm trying to setup a pool swim jet as a 'fan' or 'fanv2' using your plugin.

Problem is, the machine requires a POST request to be sent to initialise it, which puts it into a 'paused' state. A second endpoint is then required to 'unpause' the machine, which turns it on. It can then be turned on/off by pausing/unpausing which will work fine using setOn after it's initialised.

I can query the machine by calling a GET Status endpoint that will return if it's "idle" (requires the additional init call), "paused" or "unpaused"

So I'm wondering if it would be possible to somehow set a conditional in the SetOn action that can check if it's "idle", which if true, will call the init endpoint and then the usual "pause"/"unpause" endpoint?

Many thanks!