GithubHelp home page GithubHelp logo

nitaybz / homebridge-delay-switch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nfarina/homebridge-dummy

147.0 15.0 19.0 284 KB

Delay switches for Homebridge: https://github.com/nfarina/homebridge

License: MIT License

JavaScript 100.00%

homebridge-delay-switch's Introduction

logo

Homebridge-Delay-Switch

Downloads Version

verified-by-homebridge Homebridge Discord
certified-hoobs-plugin hoobs-support

With this plugin, you can create any number of fake switches that will start a timer when turned ON, when the delay time is reached the switch will automatically turn OFF and trigger a dedicated sensor (motion/contact/occupancy) for 3 seconds. This can be very useful for advanced automation with HomeKit scenes - when delayed actions are required.

Installations

This plugin is Homebridge verified and HOOBS certified and can be easily installed and configured through their UI.

If you don't use Homebridge UI or HOOBS, keep reading:

  • sudo npm install -g homebridge-delay-switch
  • Create an accessory in your config.json file
  • Restart homebridge

Example config.json

   "accessories": [
       {
         "accessory": "DelaySwitch",
         "name": "DelaySwitch",
         "startOnReboot": false,
         "delay": 5,
         "delayUnit": "ms",
         "sensorType": "motion",
         "flipSensorState": false
       }   
   ]

Parameter Description Required Default type
accessory always "DelaySwitch" - String
name Name for your accessory - String
startOnReboot When set to true, the switch will be turned ON and start the timer when Homebridge restarts false Boolean
delay Delay/Timer time. 0 - timer disabled 0 Integer
delayUnit Delay Time Unit: ms / s / m / h / d "ms" String
sensorType The sensor type that will trigger when the time has ended (null for no sensor) motion String
flipSensorState Flips the trigger sensor state (close/open, detected/not detected) false Boolean

Why do we need this Plugin?

The most common use of this plugin is to turn ON/OFF lights based on a motion/door sensor. This can be achieved by setting an automation to turn ON a light and the delay switch when motion is detected and turn OFF the light when the dedicated delay sensor is triggered (or delay switch is turned OFF).

Another great example, when using a smart wall switch (to turn ON) and RGB light bulb (to switch color) together on the same scene can cause no action on the bulb since the bulb might not even be ON when the command is sent from Homebridge. To fix this, we can set an automation to change the bulb color a few seconds after the wall switch ON command.

Also it can be use with any device that requires a certain delay time after other devices (TV + RPi-Kodi / PC + SSH / etc...)

How it Works

Basically, all you need to do is:

  1. Set the desired delay time in the config file. 0 - timer disabled.
  2. The plugin will create one switch and optional sensor (motion/contact/occupancy/leak).
  3. Use this switch in any scene or automation.
  4. Set an automation to trigger when this switch is turned OFF or the sensor is triggered, using the Home app or another app such as the Eve app.

Why Add a Trigger Sensor?

A sensor (motion/contact/occupancy/leak) is created for each accessory in order to be able to cancel the timer and the attached automations. How does it works? You can set the automation to be triggered from the attached "trigger" sensor instead of the switch OFF command and therefore you can turn OFF the switch and prevent the sensor from triggering or any attached automations from executing. If you have no use of the sensor you can remove it by setting "sensorType": null to your config.

Good to Know

  • When manually turning OFF the switch, the timer will stop and the sensor will NOT be triggered.

  • When the delay switch receives ON command while it's already ON, the timer will restart and the sensor trigger will be delayed.


Support homebridge-delay-switch

homebridge-delay-switch is a free plugin under the MIT license. it was developed as a contribution to the homebridge/hoobs community with lots of love and thoughts. Creating and maintaining Homebridge plugins consume a lot of time and effort and if you would like to share your appreciation, feel free to "Star" or donate.

PayPal
Patreon
Ko-Fi

homebridge-delay-switch's People

Contributors

mkz212 avatar nfarina avatar nitaybz avatar wouterjanson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homebridge-delay-switch's Issues

Delay Switch issue ?

Hi since approx 6pmEST 2021-02-19 seems that motion events are not going thru in Alexa (at least, my setup :-) ). Am not sure how to troubleshoot since the HB debug log is not giving me much. Am running out of ideas on how to troubleshoot why my motion triggers are not happening. Fyi i upgraded to the latest Homebridge UI in the weekend not sure if this involves anything. tia.

Timers does not complete

Hi
Love the plug-in and use it quite a lot. However recently I’ve noticed that the timer does not actually count down to zero every time, it seems to stop at a random time meaning the switch never turns off. I’ve taken a picture from within eve that shows it’s stuck at 37 seconds, this was from it triggering
4BBD85A5-933B-4592-B5CA-0AD9DFF6CB38

Plugin no longer working on iOS 15

Hello, ever since I’ve updated my iPhone 12 to iOS 15, the plugin no longer works. When I used to come back home and enter the geofence, my HomePod mini would announce a custom track I made specifically for when returning home. While the switch activates, the HomePod mini doesn’t play the custom track back. I have other automations based on custom tracks and they work fine. What should I so to fix this? Thanks so much for your support and hard work on the plugin.

Flip sensor state throws error

Any time I set flipSensorState=true I always get this error:

[homebridge-delay-switch] This plugin threw an error from the characteristic 'Motion Detected': Unhandled error thrown inside read handler for characteristic: sensorType is not defined. See https://homebridge.io/w/JtMGR for more info.

I'm running Homebridge v1.4.1 and homebridge-delay-switch v3.0.3

Stopping a delay once it's started?

Hi there, thanks for this plugin - it's very useful. I'm using it to turn off a light based on a delay. Effectively when a light is turned on, it triggers the delay switch which when shut off turns the light off again.

However, I'm seeing some curious behaviour. Normally, the delay switch is triggered and starts it's countdown. On a couple of occurrences I have manually turned the switch off, expecting the timer to also stop. In the example below, the light has actually been activated again within the original countdown, and i would expect this to reactivate the timer - restarting the original countdown. However, what I see is that the original timer has not stopped, and still switches off after the delay, and a second is created, also switching off again after the configured delay:

Feb  2 16:25:58 raspberrypi homebridge[21857]: [2/2/2017, 4:25:58 PM] [Porch_DelaySwitch1] Setting switch to 1
Feb  2 16:26:07 raspberrypi homebridge[21857]: [2/2/2017, 4:26:07 PM] [Porch_DelaySwitch1] Setting switch to 0
Feb  2 16:26:08 raspberrypi homebridge[21857]: [2/2/2017, 4:26:08 PM] [Porch_DelaySwitch1] Setting switch to 1
Feb  2 16:40:58 raspberrypi homebridge[21857]: [2/2/2017, 4:40:58 PM] [Porch_DelaySwitch1] Setting switch to false
Feb  2 16:41:08 raspberrypi homebridge[21857]: [2/2/2017, 4:41:08 PM] [Porch_DelaySwitch1] Setting switch to false

Is this expected behaviour? Is there anyway I can "interrupt" a timer once it's started?

Thanks in advance!

Including accessory type lock

It would be a nice add on, to use with electronic locks, where the impulse is necessary only for a few seconds.
Thanks!

Motion sensors unreliable

I've been using the plugin for around a year with just switches and I can say the switches work very reliably. I've noticed the motion sensors a week or two ago and decided to give them a go and I can say they do not work reliably. I can help debug but I have no idea of what's going on. I have quite a lot of them - basically I've got 3 rooms with 5 switches/sensors in each. These are with windows and 5/10/15/30/60 minutes ventilation programs and sometimes the closing is not being triggered.

Error V0.0.3

Homebridge crashes after update to V0.0.3 as soon as switches are loaded in the config.json

Deprecation Warning

3/23/2022, 12:44:58 PMDelay Switch BridgeERROR(node:29914) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./helpers/" in the "exports" field module resolution of the package at /usr/lib/hoobsd/node_modules/es-abstract/package.json.
3/23/2022, 12:44:58 PMDelay Switch BridgeERROR(node:29914) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./helpers/" in the "exports" field module resolution of the package at /usr/lib/hoobsd/node_modules/es-abstract/package.json.
3/23/2022, 12:44:58 PMDelay Switch BridgeERRORUpdate this package.json to use a subpath pattern like "./helpers/".
3/23/2022, 12:44:58 PMDelay Switch BridgeERRORUpdate this package.json to use a subpath pattern like "./helpers/
".
3/23/2022, 12:44:58 PMDelay Switch BridgeERROR(Use node --trace-deprecation ... to show where the warning was created)
3/23/2022, 12:44:58 PMDelay Switch BridgeERROR(Use node --trace-deprecation ... to show where the warning was created)

Cannot load after latest update -Cannot read property 'hap' of undefined-

Hello,
I have just updated Delay Switch and I won't load any longer and it prevents Homebridge from loading.

The error I have is:

[DelayGate] Initializing DelaySwitch accessory... mag 12 13:59:57 rpinvr131 homebridge[2074]: [2020-5-12 13:59:57] TypeError: Cannot read property 'hap' of undefined mag 12 13:59:57 rpinvr131 homebridge[2074]: at new delaySwitch (/usr/lib/node_modules/homebridge-delay-switch/index.js:13:23) mag 12 13:59:57 rpinvr131 homebridge[2074]: at Server._loadAccessories (/usr/lib/node_modules/homebridge/lib/server.js:308:29) mag 12 13:59:57 rpinvr131 homebridge[2074]: at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:91:38) mag 12 13:59:57 rpinvr131 homebridge[2074]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:59:10) mag 12 13:59:57 rpinvr131 homebridge[2074]: at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22) mag 12 13:59:57 rpinvr131 homebridge[2074]: at Module._compile (internal/modules/cjs/loader.js:816:30) mag 12 13:59:57 rpinvr131 homebridge[2074]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10) mag 12 13:59:57 rpinvr131 homebridge[2074]: at Module.load (internal/modules/cjs/loader.js:685:32) mag 12 13:59:57 rpinvr131 homebridge[2074]: at Function.Module._load (internal/modules/cjs/loader.js:620:12) mag 12 13:59:57 rpinvr131 homebridge[2074]: at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)

What shall I do, please help!
Thanks,
Dan

Documentation Unclear

Hello

A great plugin but the documentation is unclear.
What unit of measure applies to the "delay" value? Is it milliseconds, seconds, minutes, hours, ticks... ??
Perhaps you could update the documentation to clearly state what the unit is.

Switch without a timer

Hi,

Firstly I was to say that I love this plugin. It's so simple and yet has been essential to making my timers work when more than one device triggers a light or accessory.

I'm looking for a state switch (ie: I want to save the last state of a device so accessory can return to that state after event has passed, in this case On = device is on and Off = device is off). I have it all figured out, but I'm struggling to find a switch plugin that isn't on a timer.

TLDR; I want to add a switch that doesn't expire with a timer.

Is there any way of going this with this plugin?

Allow selection of sensor type: Motion or Contact or Occupancy

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:

  • Motion Sensor (existing)
  • Contact Sensor (new)
  • Occupancy Sensor (new)

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

Problem on usage

I'm running homebridge 1.3.2 and IOS 14.
I have created and automation to light a bulb on with a delay.
The automation said to tun the bulb on when the sensor is active
When I turn the delay switch on, after the time I decided, the movement sensor trigged and a notification is sent to my iPhone but the bulb is not turned on?

what I'm doing wrong ?

How to use?

Hi There, thanks for the developing this plug in. I'm in a situation which i find this plug is may be useful but need a little help how to make use of this? I've manage to configured it and appear in home app (and eve also).

I'm trying to setup a scene where it will turn off 1 smart plug and 1 light, but i would like a delay in between. but when test the scene, both still turn off at the same time without any delay... any idea how i could get it work?

Thanks in advance.

Logging inconsistent

Great plugin and I love it and use it a lot, thanks for your time in developing the plugin.

I have noticed that some of the logging is a bit inconsistent.

"Starting the Timer." and "Stopping the Timer." both end with a . (full stop)
All other entries end without a full stop.
In fact, almost every Homebridge log entry from all plugins has no full stop.

The log entries would visually look better without the full stop (and you save some logging space and reduce your code size... )
Perhaps you could remove the full stop from the "Starting the Timer." and "Stopping the Timer." log entries?

Extract from my logs today:

[8/18/2020, 10:55:09] [Kitchen Delay Timer 10min] Starting the Timer.
[8/18/2020, 10:55:09] [Kitchen Delay Timer 10min] Starting the Timer.
[8/18/2020, 10:56:09] [Kitchen Delay Timer 10min] Starting the Timer.
[8/18/2020, 10:56:27] [Hall Delay Timer 2min] Time is Up!
[8/18/2020, 10:56:27] [Hall Delay Timer 2min] Triggering Motion Sensor
[8/18/2020, 10:56:27] [Hall Delay Timer 2min] Stopping the Timer.
[8/18/2020, 10:56:42] [Kitchen Delay Timer 10min] Starting the Timer.
[8/18/2020, 10:56:54] [Reduit Delay Timer 15min] Starting the Timer.
[8/18/2020, 10:57:14] [Hall Delay Timer 2min] Starting the Timer.
[8/18/2020, 10:57:14] [Hall Delay Timer 2min] Starting the Timer.
[8/18/2020, 10:58:29] [Hue] Light: set homekit on from 1 to 0
[8/18/2020, 10:58:29] [Reduit Delay Timer 15min] Stopping the Timer.
[8/18/2020, 10:59:14] [Hall Delay Timer 2min] Time is Up!
[8/18/2020, 10:59:14] [Hall Delay Timer 2min] Triggering Motion Sensor
[8/18/2020, 10:59:14] [Hall Delay Timer 2min] Stopping the Timer.

Typo in config.json for v3.0.1

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",

New Fonction :

Bonjour, j'apprécie énormément votre plugin qui gérés actuellement tous mes détecteurs des pièces, car Apple géré très mal les minuteries, surtout les couloirs avec beaucoup de passage. Et ce plugin les gère à merveilleux donc bravo et un grand merci. Cela étant j'ai une requête sur la possibilité de pouvoir verrouiller une minuterie quand on le souhaite.
Explication : Par moment ma femme accroche le linge dans un couloir et celui-ci ne fait que s'éteindre malgré sa présence et le fait de bouger. J'ai essayé à plusieurs reprises de créer des règles qui relancerai la minuterie en boucle après avoir appuyé sur un interrupteur mais malheureusement cela ne fonctionne pas.

Résolution : Le top serai de rajouter une fonction à votre plugin qui activerai ou désactiverai la minuterie grâce à un interrupteur. Un peu comme si on pouvait mettre la minuterie en AUTO ou bien en marche forcé, ou ON et OFF.

J'espère que mon explication est assez clair et que cela pourrait vous donner l'envie de créer cette fonction afin de pouvoir inhibé la minuterie ou pas.

Hello, I really appreciate your plugin which currently manages all my room detectors, because Apple has very poorly managed the timers, especially the corridors with a lot of traffic. And this plugin manages them at wonderful so well done and a big thank you. However, I have a query on the possibility of being able to lock a timer when desired.
Explanation: At times my wife hangs the laundry in a hallway and it just goes out despite its presence and the fact of moving. I have tried several times to create rules that will restart the loop timer after pressing a switch but unfortunately it does not work.

Resolution: The best will be to add a function to your plugin which will activate or deactivate the timer using a switch. A bit as if we could put the timer in AUTO or forced operation, or ON and OFF.

Hope my explanation is pretty clear and it might make you want to create this function so that you can inhibit the timer or not.

TypeError: Cannot read property 'bind' of undefined - after updating v0.0.5 to v2.0.0

Jun 06 11:54:34 raspberrypi homebridge[7729]: [2018-6-6 11:54:34] [DelaySwitch 5 Min] Initializing DelaySwitch accessory...
Jun 06 11:54:34 raspberrypi homebridge[7729]: /usr/local/lib/node_modules/homebridge-delay-switch/index.js:36
Jun 06 11:54:34 raspberrypi homebridge[7729]: .on('get', this.getOn.bind(this))
Jun 06 11:54:34 raspberrypi homebridge[7729]: ^
Jun 06 11:54:34 raspberrypi homebridge[7729]: TypeError: Cannot read property 'bind' of undefined
Jun 06 11:54:34 raspberrypi homebridge[7729]: at delaySwitch.getServices (/usr/local/lib/node_modules/homebridge-delay-switch/index.js:36:31)
Jun 06 11:54:34 raspberrypi homebridge[7729]: at Server._createAccessory (/usr/local/lib/node_modules/homebridge/lib/server.js:408:36)
Jun 06 11:54:34 raspberrypi homebridge[7729]: at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:296:26)
Jun 06 11:54:34 raspberrypi homebridge[7729]: at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:86:38)
Jun 06 11:54:34 raspberrypi homebridge[7729]: at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)
Jun 06 11:54:34 raspberrypi homebridge[7729]: at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
Jun 06 11:54:34 raspberrypi homebridge[7729]: at Module._compile (internal/modules/cjs/loader.js:654:30)
Jun 06 11:54:34 raspberrypi homebridge[7729]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
Jun 06 11:54:34 raspberrypi homebridge[7729]: at Module.load (internal/modules/cjs/loader.js:566:32)
Jun 06 11:54:34 raspberrypi homebridge[7729]: at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
Jun 06 11:54:34 raspberrypi homebridge[7729]: at Function.Module._load (internal/modules/cjs/loader.js:498:3)
Jun 06 11:54:34 raspberrypi homebridge[7729]: at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
Jun 06 11:54:34 raspberrypi homebridge[7729]: at startup (internal/bootstrap/node.js:201:19)
Jun 06 11:54:34 raspberrypi homebridge[7729]: at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)
Jun 06 11:54:34 raspberrypi systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE

How to use delay?

Hi There, thanks for the developing this plug in. I've manage to configured it and appear in home app.

Сan't figure out how to link it to a light bulb or switch hdmi to TV? I have to merge this into config.json or can I still do it through the app?

Use with Hue motion sensor

How would I setup using a Phillip hue sensor light level? I have it setup to turn on lights if light is less than 5 lux which works. Problem is it won’t reset timer because lights are on, meaning the room is above 5 Lux.

Sensor and Switch not responding to automations

I am currently running Homebridge 1.2.3 and I am having issues With iOS14 and HomeKit. Before updating I didnt have any issues with this plugin but since updating the hue motion sensor I have driving the delay switch is detecting motion but isn't engaging the switch in homebridge. Likewise at the end of the timer sometimes the motion sensor in the plugin triggers in homebridge but doesn't toggle the actual lights back off.

Unsure what the cause is and I think some change in iOS14 has broken how some plugins communicate. Unsure if any of your other users are having the same problem.

Question - Feature Request: Option to hide motion sensors from home app

Hi,

I have been using this plugin and seems very stable since your last update. I am using it to add multiple timers in the form of switches.

Home app has the option to trigger automation actions when a switch change state. Hence, in my case I don't need the motion sensors.

Do you thing you can make a parameter (true/false) on json config file which will control wether motion sensor is shown in home app or not?

Thanks!

Can't remove delay switch from favorites

Thanks for the very useful plugin.
A small issue is that I can't set the Favorites toggle off when the switch is configured from within the hoobs ui.
it adds a small section to the config that creates some bug.
"plugin_map": { "plugin_name": "homebridge-delay-switch", "index": 0 },
If I remove that section, the problem is resolved.

I have a single switch set:
{ "accessory": "DelaySwitch", "plugin_map": { "plugin_name": "homebridge-delay-switch", "index": 0 }, "delay": 5000, "disableSensor": false, "startOnReboot": false, "name": "5 Seconds" }

Can you help me?

Hello, I don´t get it work... I wish: movement sensor detects->switch on lights-> switch delay (several seconds)-> switch off lights... . I tried several ways but.... nothing... Can you help me with a clearer example?

Thanks in advance!!!

Typos in the Documentation

Reading this page I see a number of typos:
https://www.npmjs.com/package/homebridge-delay-switch

Text "This can be achieved by setting an automation to turn ON a lightand the delay switch"
Incorrect: lightand
Correct: light and

Text "when the dedicated delay motion sensor is triggers (or delay switch is turned OFF)."
Incorrect: triggers
Correct: triggered

Text "Why Adding Motion Sensor?"
Incorrect: Adding
Correct: Add a

Text "How it works? you can set "
Incorrect: How it works? you can set
Correct: How does it works? You can set

Request: Update Manufacturer And Model with meaningful information

Currently, Manufacturer and Model show the following in the HomeKit app:
Manufacturer = "Delay Manufacturer"
Model = "Delay Model"

It would look smarter if you had:
Manufacturer = "Delay Switch"
Model = "Delay Nms", where N = the programmed delay time in milliseconds, e.g.: "Delay 5000ms"

This would look smarter and allow the user in Homebridge to see what delay was programmed for each switch he uses

Faucet icon

Hi,
I love this plug-in, thanks for creating and sharing it!
Would it be possible to create a delay switch with a different group icon? I would like to have a Tile with the faucet icon.
Use case: I have a water faucet that I would turn on for 10 seconds at a time (filling a water bowl for my dog). I already have it working with Eve Aqua, but I hate the fact that I cannot choose the faucet icon for the Eve Aqua.
If I get a dummy faucet "switch", this could trigger the Eve Aqua start/stop. 🙌
Thank you in advance.
image

Motion Sensor Timer Going off After Switch Turned off

Using homebridge delay switch V2.2.6: When my automation turns off the dummy switch the timer continues to run and causes the motion sensor to detect motion. Logs indicate that the timer is stopped.

Using homebridge V1.2.0

Delay length not consistent for longer delays?

I have a delay switch set to 60000 milliseconds (10 minutes).

The first time the delay switch is triggered it will turn on for the full 10 minutes, but for every time after that the delay will be what seems to be a random shorter time of 1 - 10 seconds.

Settings Broken in Config UI

I’m no longer able to edit the Settings of the plugin. All of the existing accessories are expanded, and there is no option to add an accessory block. I believe this started with the latest Update, but I’m not 100% positive. However, I’ve noticed the same behavior on two instances: one running the official Raspberry Pi HomeBridge image, and one in a Docker container. Let me know if you need any additional info.

F0F49923-1A0C-4D67-AECE-2910D81FD43D

Add Ability To Remove From Home Status

Hey, I love this plugin - it fills a massive hole in the default HomeKit functionality so thank you very much. One small thing would be to add the functionality of removing the switch from the Home Status. This way, it doesn’t show up on the Home app main page when triggered, it just stays hidden. I also use homebridge-dummy for similar switches and it can be turned off in the Home Status, so I hope it’s not too difficult to implement.

Thanks!

Log Entries have wrong Accessory Name

Hi

I have observed this issue over a period of time thinking something was wrong. Today I got conclusive evidence.

This morning, I was the first one up and walked into the hall at 07:27:05. This triggered the hall motion sensor, which activated the hall lights, and the [Hall Delay Timer 2min] (from your plugin). It also activated the bathroom lights, and the [Bathroom Delay Timer 10min] (from your plugin).

What I see is the wrong accessory name on the log entries.

Issue 1: Instead of 1 x entry for [Hall Delay Timer 2min] and 1 x entry for [Bathroom Delay Timer 10min], the log shows 2 x entries for [Hall Delay Timer 2min]. That is strange, because the timer should start only once.

Issue 2: Instead of 2 x start entries for the [Bathroom Delay Timer 10min] and [Bathroom Delay Timer 30min], the log shows 1 start for [Bathroom Delay Timer 30min] (ok) and 1 stop for [Bathroom Delay Timer 10min] (wierd!). How can it possibly log a stop entry when the timer never started?

I am wondering if the plugin is getting the names of the accessories mixed up?

Here are the log entries

[8/29/2020, 07:22:21] [Weather] Winterthur Weather: set Wind Speed from 9.4 km/h to 7.6 km/h
[8/29/2020, 07:27:05] [Hall Delay Timer 2min] Starting the Timer.
[8/29/2020, 07:27:05] [Hall Delay Timer 2min] Starting the Timer.
[8/29/2020, 07:27:10] [Bathroom Delay Timer 10min] Stopping the Timer.
[8/29/2020, 07:27:10] [Bathroom Delay Timer 30min] Starting the Timer.
[8/29/2020, 07:29:05] [Hall Delay Timer 2min] Time is Up!
[8/29/2020, 07:29:05] [Hall Delay Timer 2min] Triggering Motion Sensor
[8/29/2020, 07:29:05] [Hall Delay Timer 2min] Stopping the Timer.
[8/29/2020, 07:30:52] [Hue] heartbeat 36505, drift 1213

Proposed Update to Reset Timer if Switch Turned on While Already On

A very good use case for this timer would be to turn lights on in a hallway when motion is detected, and keep them on for (say) 5 minutes after the last motion is seen.

However, as written, the switch will stay on for delayTime milliseconds after it is first switched on. Switching it on again, while it is already on, does not reset the timer.

I propose adding this line of code just after line 30 of index.js

clearTimeout(this.Timer);    // clear any previous timer

so the new code in that area would read:

if (on) {
   clearTimeout(this.Timer);    // clear any previous timer
   this.Timer = setTimeout(function() {

I have tested this and found it to work.

This could be an update to the current plugin. However, if it is seen as too significant a change to the existing behaviour, a new plugin based on the current one could be provided.

Happy to get feedback on this.

Stopped working - Wont initialise switch

Hi,
I hope you can help. I've been using this plugin for over a year to set a timer every 15 mins so that I can turn my pond fountain off if the wind is too high. Yesterday however I tried to install the IFFT plugin to get round the current issue with the authentication method changing for Blink cameras. However I now get the following error as soon as any switch is initialised

[5/8/2020, 10:47:00 AM] TypeError: Cannot read property 'hap' of undefined
at new delaySwitch (/opt/nodejs/lib/node_modules/homebridge-delay-switch/index.js:13:23)
at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:308:29)
at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:91:38)
at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:59:10)
at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
at Module._compile (internal/modules/cjs/loader.js:734:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
at Module.load (internal/modules/cjs/loader.js:626:32)
at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
at Function.Module._load (internal/modules/cjs/loader.js:558:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:797:12)
at executeUserCode (internal/bootstrap/node.js:526:15)
at startMainThreadExecution (internal/bootstrap/node.js:439:3)

The JSOn is simple (default) and has worked until yesterday.

{
"accessory": "DelaySwitch",
"name": "DelaySwitch",
"disableSensor": false,
"delay": 1000
}

I'm on homebridge-delay-switch v2.1.2

how do you set this up ?

Hi,

I've searched the web, the issues and I think I did everything correct but can't get it to work.

What I tried :
created a delay switch for 1 min.
Created an automation that says to turn on the light when the delay switches OFF.

triggered delay switch manually

Nothing happens.

I did this in the native home app.

Anyone an idea what I am doing wrong ?

Thanks a lot !

Request: Sensor triggering multiple times

Hey!

Thank you for the plugin. I'm using your plugin to warn when somebody left my garage door opened.
So, here's my suggestion: A option that the switch don't turn off automatically and the motion sensor triggers every x seconds while the switch is on.
Is it possible?

Thank you!

Can switch be used for this scenario?

I have a Xiaomi Door & Window Sensor, and Honeywell Evotherm radiator knobs. I'm a bit unclear if (and how) this switch can be used to help me with the following behavior:

"When door sensor is OPEN for longer than 3 minutes, disable heating."

A rule without the 'longer than' is easy, but I don't want Honeywell to keep receiving on/off commands every time I open the sliding door to quickly grab something outside -- only when the door is open for a longer period.

Is this possible with homebridge-delay-switch, and if yes, what's the easiest way?

Hide delay switch in Homekit

First of all, thank you very much for this excellent plugin. I use it for so many automations in my smart home. It is great!

I have one question: is it possible to hide a delay switch from homekit? I still want to be able to us it in my automations and scenes, but only want to hide it from my rooms (I don't want my other homekit users to toggle a switch by mistake). Thanks.

[FEATURE] Eve App 4.2 Issue with homebridge-delay-switches

@nitaybz
The lates Eve for HomeKit App v4.2 is causing issues with several Homebridge Plugins.
They changed something so that the serial number of a device is linked somehow in the background. This was not in the previous Eve versions.
Problems causing now like described here.
homebridge/homebridge#2503

So all devices/switches created by homebridge-delay-switch can't be sorted anymore, can't get an individual icon by each switch, and can't starred individually for favorite screen.

RPReplay_Final1587217613 2020-04-18 15_50_01

Do you see a solution to fix this "Eve" Issue, by changing something in your plugin?
Maybe adding something like a "unique_serial": "xxxx" for each sensor, manually in the config.json or automatically by the plugin.

@nicoduj already found a solution for his plugin.
nicoduj/homebridge-harmony#249

And @pponce also already crated a fix to get "unique_serial": to work around the Eve App issue.
pponce/homebridge-script2#25

Thanks in advance for your work and the time you are investing.

prevent combined switch/sensor accessory?

After upgrading to ios 14 Home now presents the switch/sensor as a combined accessory with no way to separate them. This means it is no longer possible to simply tap on the accessory in Home to flip the switch, you must first open the combined accessory and then flip the switch. If you configure the delay switch without a sensor then simply tapping on the switch in Home toggles on/off, so it is obvious that the combined accessory is the issue.

Is it possible to register the switch and sensor in a way that prevents homekit from combining them in Home?

Problem after trying to add 4th delay accessory

When I tried to add the 4th delay accessory, the whole homebridge started act abnormally. More specifically, I started to see some homebridge (not all) accessories moved in different rooms and "in not responding" status.

Everything came back to normal when I removed the 4th delay accessory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.