PatchworkBoy / homebridge-edomoticz

Domoticz Homebridge-Plugin
Other
118 stars 44 forks source link

Blind percent sending multiple MQTT messages from HomeKit to Domoticz #166

Closed Olivier6767 closed 4 years ago

Olivier6767 commented 5 years ago

Hello,

I have several SOMFY blinds that I control using Domoticz using an RFXCOM gateway. I created a DZVENTS script in Domoticz to be able to control these blinds using a percentage slider. For this I calculate the time the blind should move between the current and desired position, action the blind command UP or DOWN, and issue a STOP command with the afterSec() function. This works very well from within Domoticz.

I published the blinds to HomeKit so I can control home using the Apple Home App as well as using Siri. In the Home App, the position of the blinds is updated correctly as I control them from Domoticz.

However, when I control the blinds from the Home App or Siri, each time I move the position, this sends 2 or 3 MQTT messages back to Domoticz. For example if I move a blind in the Home App from current position 80% to new position 20%, I usually get the following MQTT messages:

domoticz/in {"command":"switchlight","idx":713,"level":21,"switchcmd":"Set Level"} domoticz/in {"command":"switchlight","idx":713,"level":20,"switchcmd":"Set Level"}

So the first message instructs Domoticz to move the blind to 21%. This triggers my script in Domoticz that will send a DOWN command followed by a STOP command afterSec(18). The second MQTT message will trigger the script again which in turn will send a DOWN command followed by a STOP command afterSec(1). This will immediately stop the blind, basically canceling the first command.

Is there a way for the Homebruidge-edomoticz plugin to avoid sending 2 MQTT messages when moving a blind slider in the Apple Home App? Maybe waiting 0,5 sec or 1 sec delay to ensure the slider in the Home App has full stabilized?

I'm open to any idea on resolving this issue.

Thanks, Olivier

PatchworkBoy commented 4 years ago

Fixed in https://github.com/PatchworkBoy/homebridge-edomoticz/commit/b28520f6da30e104d912a1ec5dc1b22339305db7 & updated on npmjs - v2.1.13