mongoose-os-apps / shelly-homekit

Apple HomeKit firmware for Shelly's
Other
1.82k stars 130 forks source link

Bouncing switch by using Shelly1 as Garage opener #1087

Open stivie882 opened 2 years ago

stivie882 commented 2 years ago

I am using the Shelly 1 as garage opener. It works really great except for one little thing. My switch that detect the closed state of the door bounces. I get always three messages when the door got closed.

  1. Garage door closed
  2. Garage door opened
  3. Garage door closed

It would be great if a small delay of about 1 sec could be implemented before new messages are sent as garage opener.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Comment or this will be closed in 7 days.

stivie882 commented 2 years ago

Would be Great if someone of the developers could care absolut. @andyblac @timoschilling @rojer

Stoischo commented 2 years ago

I have exactly the same problem with my two garage doors. It seems that the reed switches for open/close detection cause the issue, with a simple contact switch there is no issue. It would be great if the scanning rate of the switch input could be lowered somehow.

Koplinjp commented 1 year ago

I also have the same problem.

simonfield76 commented 1 year ago

I solved adding a magnetic sensor on the my gate.

therealmightyx commented 1 year ago

I also have that problem. It’s caused due to having only one reed contact on a Shelly 1. E.g. when your reed contact is attached to the open position and you open the garage door, then Shelly will push an open message but the reed contact remains open until the garage door is opened fully. So HomeKit pushes a close message to your phone as long as the garage door moves, then pushes again the open message when the door is opened and the reed contact closes. I think someone can solve this with a delay as long as the garage door moves (movement time is already set in the settings), when shelly operates in garage door mode.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Comment or this will be closed in 7 days.

timoschilling commented 1 year ago

Can some how have this issue please test what's happen if you increase or decrease the "Movement Time" setting.

Koplinjp commented 1 year ago

Can some how have this issue please test what's happen if you increase or decrease the "Movement Time" setting.

I did do that, decrease from 35 to 30 and 25, and also increased to 40,45 and 50. Same issue.

therealmightyx commented 1 year ago

I did a few tests with different movement times an also different pulse times, which had no effect.

rubensx commented 1 year ago

3AC637EF-0ACA-47B8-86D6-AEACB5C84594 I’ve a similar problem!

I try to decrease the movement time to 9 seconds (my garage door is really fast) but the time to response don’t save!

When the door is closed, the feedback works great without a problem, but when the sensor goes to open (is Normally Closed by the magnetic), the feedback shows open but with the “waiting” status for so long…

Someone can help?

bobf41 commented 1 year ago

Having this issue as well on an electric gate with Shelly 1 plus. The SW port is connected to a 24v ground connection L is ground and N is the +24V.

When Gate opens I get numerous messages. image

rubensx commented 1 year ago

3AC637EF-0ACA-47B8-86D6-AEACB5C84594 I’ve a similar problem!

I try to decrease the movement time to 9 seconds (my garage door is really fast) but the time to response don’t save!

When the door is closed, the feedback works great without a problem, but when the sensor goes to open (is Normally Closed by the magnetic), the feedback shows open but with the “waiting” status for so long…

Someone can help?

My solution is, put in 10 seconds, anything under 10 don't work... but my garage gate still are fastest than the counter

sdaudet commented 1 year ago

Hello, i look for help. How do you had a magetic sensor on shelly 1 in 220v ?

rubensx commented 1 year ago

IMG_4269

If you use 220v, put one fase through the sensor! All are ok

therealmightyx commented 1 year ago

…and be sure to buy a reed sensor (reed contact switch) with 220/230V!

sdaudet commented 1 year ago

Thanks it is working when i use 24v my sensor is limit to 220 thanks

bobf41 commented 1 year ago

Having this issue as well on an electric gate with Shelly 1 plus. The SW port is connected to a 24v ground connection L is ground and N is the +24V.

When Gate opens I get numerous messages. image

I noticed my switch input is actually a pulse. So that matches the number of signals. It would be nice if some kind of delay can be set. Like 2 seconds no signal is off.

mccahan commented 1 year ago

This is probably not the correct way to solve this (might not work correctly when the door reopens because there's something in the way after it's in range of the reed sensor? I haven't tested), but I have a pass at debouncing the open event here: https://github.com/mccahan/shelly-homekit/commit/3817f0bdaf4e948b1589b05b64f07048ffd1500b .

The logs looked like this, you can see the extra "Tgt State: closed -> open" and "Cur State: closed -> opening" toggles in the middle that trigger the extra notification:

Screenshot 2023-08-06 at 11 34 58@2x

I tried setting a higher debounce time for mgos_gpio_set_button_handler in shelly_input_pin.cpp but didn't have any luck there.

bobf41 commented 1 year ago

I had the same issue with a gate opener. While moving I got a "flashing" signal, when stopped and open it was a continues signal.

I have added a small timer from Amazon which holds a relay for a set amount of time, I did 0.9sec. Then when the gate is closed again within 0.9 sec Shelly knows it is closed.

Used this one in the end. Fafeicy Relay Module with Time Delay, 5 V, 12 V, 24 V, 0.01 s-9999 min, Delay-Off Cycle Timer, LCD Display, One-Button Emergency Stop Function (Stop Button) https://amzn.eu/d/bl5VBjf

RxJock commented 9 months ago

I had the same problem and this is how I resolved it…

My garage takes 8-9sec to move from open to close.

I set movement time to 10sec AND pulse time to 11000ms (11sec).

hyperbart commented 2 weeks ago

Hello, long time user of a raspberry pi with homebrdige to control my garage door and recently switched to the Shelly way. Freshly installed Shelly with the most recent firmware as of day before yesterday. It is able to close the gate, it becomes closed but right after that shows as opening and after a while the status updates to closed.

markirb commented 2 weeks ago

Hi,

I would add debouncing. Is 1 second enough?

https://github.com/mongoose-os-apps/shelly-homekit/tree/gdo_debounce

you can try this with this artifacts:

https://github.com/mongoose-os-apps/shelly-homekit/actions/runs/11630112950