AlexanderBabel / homebridge-broadlink-rm

[This fork supports TV accessories] Broadlink RM Mini and Pro plugin for homebridge: https://github.com/nfarina/homebridge
Apache License 2.0
46 stars 11 forks source link

allowResend don't work on Window-covering and air conditioners #95

Open Drun555 opened 4 years ago

Drun555 commented 4 years ago

That's it. There was this issue in original broadlonk-rm package, but it was fixed in 2018.

Now it's not working again.

kiwi-cam commented 4 years ago

Could you confirm what version you're running? Unfortunately most development here has stopped so I've moved to updating this fork.

I've tested allowResend by repeating the steps in the original issue and it worked as expected:

If I turn the aircon off using Siri, then turn it on again with its first party remote, the iOS Home app still thinks that it is off (and this was the last command sent).

If I then I ask Siri to turn the aircon off, Siri responds like it understood and issued the command, but the command doesn't get sent to the aircon unit.

With "allowResend": true my AC did turn off again as expected when turned off a second time via Siri.

Drun555 commented 3 years ago

@kiwi-cam Hello again! I did a little research and realized that allowResend doesn't work properly with curtains because of the code in "windowCovering.js", line 57: if (state.targetPosition === previousValue) return;

Many curtains do not have feedback, and scenario like below is very common: 1) You open your curtains at 100% with a Homebridge 2) Close them with the remote control 3) Now you cannot open your curtains with the phrase "open the curtains"

Technically speaking, allowResend was maded to prevent things like this

So I commented out this line and added these:

      if (state.targetPosition == 100) state.opening = true;
      if (state.targetPosition == 0) state.opening = false;

And now everything is working pretty well. I suppose this is how the script should work if allowResend is set.

Btw, thanks again for your hard work, you're awesome!

kiwi-cam commented 3 years ago

I recently fixed this issue for air conditioners in this fork: https://github.com/kiwi-cam/homebridge-broadlink-rm#readme. I'll take a look at window coverings too this week.