nitaybz / homebridge-delay-switch

Delay switches for Homebridge: https://github.com/nfarina/homebridge
MIT License
146 stars 20 forks source link

Allow selection of sensor type: Motion or Contact or Occupancy #43

Closed jsiegenthaler closed 2 years ago

jsiegenthaler commented 3 years ago

This plugin is very simple and powerful But sometimes I actually want the motion sensor to give a different sensor message to fit a use case of window or door open delay Could you make the sensor user-configurable to be of one of the following common sensor types:

The Contact Sensor will allow the user to use this for a Door Open or Window open notification, which would fit the use case of "door left open too long" very nicely. The Occupancy Sensor would allow the user to set up a timed delay with some automation before firing a Occupancy notification

These sensors all act very similarly so the code changes needed should be very minor

Thanks, Jochen

nitaybz commented 3 years ago

will do...

danricho commented 3 years ago

This would be awesome.

jsiegenthaler commented 3 years ago

Bump. Can I help? I'd like a Contact Sensor.... in many situations this is better than a Motion Sensor

danricho commented 3 years ago

Same here! I’m finding that motion sensors don’t push notification properly when away from home and the home app isn’t open!

jsiegenthaler commented 3 years ago

@danricho I have no problems with any notifications from the Home app. All work well. Check your Home app config....

danricho commented 3 years ago

I have tried many things. I just don’t find that I get the notifications reliably. I’m at the point that I’d prefer to use a contact sensor because they always seem to be pushed.

to reproduce:

  1. Set the delay to 5 mins in homebridge
  2. Check the notifications are on for this device
  3. Disable Wifi (cellular data)
  4. Turn on the switch
  5. Close the home app completely (this may not be necessary)
  6. Turn off the screen

If I have the delay set at 1 minute I still get the notification.

And just to be clear, I am confident it is not this plugin. I see the plug-in behaving correctly in the HomeBridge log. The issue is somehow in the HomeKit system somewhere.

jsiegenthaler commented 3 years ago

@danricho I get many HomeKit notifications throughout the day, at home and away, when connected via Wifi or 4G/5G cellular data, I am using an Apple TV 4K as a Home hub. I see when people arrive and leave, when they open/close the front door, and when movement is detected in the apartment. It is the hub that sends the data to Apple so that Apple can notify you. Maybe check your network and your hub's ability to get to the Internet...

danricho commented 3 years ago

Thanks for the advice. I’ll keep experimenting.

jsiegenthaler commented 2 years ago

Hi @nitaybz I'm adding the Contact Sensor and Occupancy Sensor for you. I'll add a Pull Request with them in the next few days.

jsiegenthaler commented 2 years ago

@nitaybz I have a Fork all ready and working. Would you like to give add me as a contributor to this project? Then I can add a branch and a pull request for you

nitaybz commented 2 years ago

You can do a pull request from your fork, when I'll merge you will automatically become a contributor

jsiegenthaler commented 2 years ago

ok, will do

jsiegenthaler commented 2 years ago

Added a PR with new sensors: https://github.com/nitaybz/homebridge-delay-switch/pull/50

jsiegenthaler commented 2 years ago

Hi @nitaybz Have you had a moment to review my changes in the PR to add Contact and Occupancy sensors?

nitaybz commented 2 years ago

Hey man, thanks for the reminder... I was busy and it went off my mind. I just reviewed it and commented on the PR

jsiegenthaler commented 2 years ago

I reworked the code and created a new PR: https://github.com/nitaybz/homebridge-delay-switch/pull/51

nitaybz commented 2 years ago

Please check version 3 of the plugin, it should include the desired functionality

jsiegenthaler commented 2 years ago

Thanks I saw a typo in config.json, Homebridge must have a lower-case b (correct is Homebridge): "title": "Turn ON when HomeBridge Restarts", "description": "When Enabled, the switch will be turned ON and start the timer when HomeBridge server restarts", I'll make a new issue and close this one