ztalbot2000 / homebridge-cmd4

CMD4 Plugin for Homebridge - Supports ~All Accessory Types & now all Characteristics too
Apache License 2.0
145 stars 14 forks source link

[Support] Terminate running process on update #105

Closed hunhejj closed 3 years ago

hunhejj commented 3 years ago

I am trying to integrate an RF controlled window cover. Basically I send the RF signal, then wait for x seconds in the script and finally I set the state to closed assuming that the cover actually closed by then.

However what happens if I send another command during this interval? Ideally the original process would be stopped gracefully, i.e. that it could still persist its state, e.g for how long it has been run, then the next command is performed.

Is that possible with CMD4?

ztalbot2000 commented 3 years ago

Hi,

Homebridge does not work that way. It is a node.js tool so the second request would be sent during the first requests running time. In other words you cannot guarantee that the second process would not overlap the first. State information is usually less than 5 seconds as defined by Homebridge or it generates a message that the process took to long.

Ttyl, John

On Sun, Apr 11, 2021 at 1:31 PM hunhejj @.***> wrote:

Assigned #105 https://github.com/ztalbot2000/homebridge-cmd4/issues/105 to @ztalbot2000 https://github.com/ztalbot2000.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/105#event-4578791772, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCXZIWJRI6ZDZKIS2XYDTIHMHJANCNFSM42X4I23A .

ztalbot2000 commented 3 years ago

You could however write your script to keep track of what is happening and then act accordingly.