justjam2013 / homebridge-virtual-accessories

Homebridge plugin that provides the ability to create virtual HomeKit accessories.
https://www.npmjs.com/package/homebridge-virtual-accessories
Apache License 2.0
5 stars 0 forks source link

Define an accessory as both stateful and have a reset timer #18

Open justjam2013 opened 1 week ago

justjam2013 commented 1 week ago

Is your feature request related to a problem? Please describe: I want to create an accessory with a reset timer and be stateful. For example, I create a switch with a reset delay of 1 hour. If Homebridge is restarted, when it restarts, it checks to see if the switch would have reset during the restart. If the switch would have reset, then trigger the switch back to the reset value. If the switch would not have reset, then determine how much time was left on the delay and set a new delay to turn off the switch.

Describe the solution you'd like: When a stateful accessory is created with a reset timer, the start timestamp is saved. When Homebridge restarts, it checks the current timestamp to the reset timer timestamp and creates a new delay timer with the time remaining. This may not be accurate to the millisecond, but should be farily accurate to the second.