dxdc / homebridge-blinds

:sunrise: Homebridge Plugin to control my blinds over HTTP
https://www.npmjs.com/package/homebridge-blinds
ISC License
54 stars 26 forks source link

Is possible ignore last position? #15

Closed joki1985 closed 4 years ago

joki1985 commented 6 years ago

Hello Thank for your plugin, but i have problem. I use two way (switch on the wall) for control my blinds. When blind is up and i use switch blind is go down, but homebridge dont know in whitch position is blind. Then i send blind to up via siri, homebridge answer: already on position. but blind is down via switch on the wall Please i need this future: when i say siri: “go down” plugin first set it up position to up and after send blind to down. It is posible?? Thank for your answer

robintemme commented 6 years ago

Hey @joki1985, thanks for your issue and sorry for the delay. I'm really sorry, but I don't think I currently have the time to implement this, please feel free to do a PR though.

peros550 commented 6 years ago

+1 to this. This nice plugin has helped me automate my rolling shutters. What I did was to create an arduino based circuit that would take commands and relay them to a hard-wired second remote of my rolling shutters. Unfortunately, If I have already manually controlled my shutters, for example have closed them through the wall switch, the homekit still believes they are open and it does not raise the "open" command.
If I knew how to work on your code, I would happily try to contribute. :(

peros550 commented 6 years ago

After some further investigation, I believe by removing the following code:

if (this.currentTargetPosition == this.lastPosition) { if (this.interval != null) clearInterval(this.interval); if (this.timeout != null) clearTimeout(this.timeout); this.log("Already here"); callback(null); return; }

The plugin omits the previous state. Sorry , I am not familiar with how github works and I didn't know how to do a PR. If anybody could test and report back?

peros550 commented 6 years ago

@zwerch any help would greatly be appreciated. Thanks & regards

Cloudore commented 6 years ago

If I have already manually controlled my shutters, for example have closed them through the wall switch, the homekit still believes they are open and it does not raise the "open" command.

@peros550 If your shades are remotely controlled, I would assume you're talking about an RF controller. How would it get current state information from the shades? RF is only one way.

I have RF shades working through broadlink rm homebridge plug in. If I manipulate their state through the normal rf controller, the HomeKit state is out of sync.

peros550 commented 6 years ago

@Cloudore thanks for taking the time to answer. What you are saying is correct. My shades are controlled by both RF and wall switches and it's very easy for Homekit to loose track of current state. That's why I am investigating whether is possible to issue commands independently of current state.

Having said that, I would ask which part is responsible to judge (based on the shade's current state) whether a command should be passed to the device or not? Is it the Homekit itself or this plugin?

If the answer in my previous question is the plugin, then I would like to know if any changes in the code could bypass the "state checking" and issue directly the requested command.

Otherwise, if it's Homekit who is doing the state checking, I would propose a workaround to this issue. Taking into account that there are other sources which control the state of shades, I would propose that Homebridge-blinds plugin permanently report a current state of 50%. In that case, any command (open or close ) would go through without issues.

Cloudore commented 6 years ago

@peros550 No worries

I'm pretty sure the plug in itself can bypass state checking and resend the code anyway regardless of state, as the broadlink RM plug in did here:

https://github.com/lprhodes/homebridge-broadlink-rm/issues/156

I migrated to this plug in and it works wonderfully in my case (was using GPIO RF transmitter/receiver before), you can do that or wait/sumbit a PR for this plug to handle the resend.

peros550 commented 6 years ago

In my case, I have built a board to control the RF remote. Here is a pic. img_7457

It's a wemos which gets HTTP requests, and controls 4 relays. Those are wired directly on the RF transmitter, simulating button presses.

Thus, I need to stick with this plugin which seems to work when current state matches with the real one.

I also tried to change some parts of the plugin's code, without having the knowledge of javascript, and regretfully without success.

peros550 commented 6 years ago

Hello, I am not sure if I have followed the correct git procedure. I forked this project and did my proposed changes on the code. Here is the link: https://github.com/peros550/homebridge-blinds

The last position is now ignored and the command is always sent.

dxdc commented 4 years ago

This should be closed now in the latest release. The logic is now as follows:

Please let me know if I'm missing something and we can re-open this issue.

peros550 commented 4 years ago

Yes it now works as intended :) Thank you