node-red-contrib-vacation-timer 2.2.8

A node-red node that simulates a house being occupied, by turning something on and off in a natural way.

npm install node-red-contrib-vacation-timer

Vacation Timer for node-red

Changes in v2.2.8

Sending subsequent positive payloads would keep reseting the schedule, which caused at least 2 major issues:

  • Sending too many payloads too quickly would often cause some of the previous schedules to be skipped from being canceled, thus there were multiple on/off commands being sent at different times.

  • Inadvertently sending a payload through and having the chosen schedule canceled and regenerated was causing some frustration with certain users, as this was not only an unintended oversight on our part, but is definately not what most would assume to be the expected result of the node.

To bring things inline with what we should have done in the first place, we have changed the node to only generate a schedule on a positive payload if the node is currently suspended, or otherwise inactive. If you wish to manually generate a different schedule than the currently active schedule, you must send a negative payload first, and then you can send a postive payload again. This does not affect the automatic rescheduling of the node when the current schedule completes.

INTRODUCTION

With more and more people getting into Home Automation, node-red is becoming a more integral part of automation systems. But there is one question people tend to overlook in the automation of their home! What do you do when you go on vacation? Obviously you can have an alarm system that alerts you AFTER someone has broken into your house, but what can you do to help prevent the break-in from occurring in the first place?

Well... Simple... don't let them think you ever left!

This is a node that simulates someone being home in order to turn a device on and off at a semi-random, yet seemingly normal schedule. For instance, if you usually go to the Family Room and watch TV after work between 6 and 6:30 in the evening, and you go to bed anywhere from 11:30pm to Midnight, well, then you can automate the Family Room light to come on randomly between 6 and 6:30pm, and stay on for either a random length of time, such as 5 1/2 to 6 hours, or a specific time with a delay before going off, while shortly there after the bedroom light goes on, as well as the master bathroom light a few moments later, all mimicking a person making there way to bed after an evening in front of the TV.

Now, using the same ratios, the Vacation Timer can generate a different on/off schedule each day, so although the specs are the same, it will be a random time within those specs, so it will always appear as if human interaction is taking place. Now again, imagine having several nodes setup for a handful of lights in different rooms in your home, all with different, semi-random schedules. That is the Vacation Timer. It is simple, yet effective.

CONFIGURATION OPTIONS

Initially Suspended:

When this is checked, the schedule will only be activated when the node receives a msg with a positive payload of start, on, 1 or true. If you uncheck this box, the schedule will be activated immediately upon Deploying. You can manually enable Suspend Mode at any time by sending a msg with a negative payload of stop, off, 0 or false. This option is checked by default, as the recommended way of activating and deactivating the schedule is to send the node a msg, such as when you active or deactive your own custom "Vacation Mode" in your home automation system.

Reschedule After Completion:

When checked, a new randomized schedule will automatically be generated for the next active day, otherwise it will be Suspended once the current schedule completes. It then must be re-activated with an incoming msg containing a positive payload of start, on, 1 or true.

Latitude and Longitude:

Your latitude and longitude for use with Dusk, Dawn, Sunrise or Sunset from the Time On and Time Off dropdowns.

Days of the Week:

Here you can select which days of the week the schedule will be run.

Issue Off Command on non-scheduled days

If the scheduled Time On is before Midnight on a scheduled day, the device will always turn on, however, if the following day is a non-scheduled day, and the Time Off of the same schedule is after Midnight, thus falling on the non-scheduled day, the device will NOT be turned off unless this option is checked. The assumption is that if you do not want the normal schedule to take place on a specific day, you may also not want the Off command to be activated on that day either. If this option is not checked, you will have to either setup an additional Vacation Timer node or some other node-red timer to take care of shutting off those devices that were not turned off.

Time On:

This is the earliest time you want the device to be turned on.

Max Delay:

This is the maximum number of random minutes you want tagged onto your chosen Time On. If you choose 7:30 AM as your Time On with a Max Delay of 30 minutes, your device will turn on between 7:30 AM and 8:00 AM.

Length of Time OR Specific Time to turn Off Device:

Depending on which tab you choose, you can have the device turn off after a Length of Time (minimum/maximum), or you can have the device turn off at a Specific Time with a Delay.

Use Length of Time:

  • Minimum Time On:
    The minimum hours and minutes you want the device to be on.

  • Maximum Time On:
    The maximum hours and minutes you want the device to be on.

  • Disable Maximum Time On:
    If this is checked, the Maximum Time On will be ignored and the device will be turned off after the exact hours and minutes selected in Minimum Time On.

Use Specific Time:

  • Time Off:
    This is the earliest time you want the device to be turned off.

  • Max Delay:
    This is the maximum number of random minutes you want tagged onto your chosen Time Off. If you choose 8:15 PM as your Time Off with a Max Delay of 30 minutes, your device will turn off between 8:15 PM and 8:45 PM.

Payload and Topic:

Set the Payload and Topic values for both the On and Off commands.


CHANGES

2.2.8
Sending subsequent positive payloads would keep reseting the schedule, which caused at least 2 major issues:

  • Sending too many payloads too quickly would often cause some of the previous schedules to be skipped from being canceled, thus there were multiple on/off commands being sent at different times.

  • Inadvertently sending a payload through and having the chosen schedule canceled and regenerated was causing some frustration with certain users, as this was not only an unintended oversight on our part, but is definately not what most would assume to be the expected result of the node.

To bring things inline with what we should have done in the first place, we have changed the node to only generate a schedule on a positive payload if the node is currently suspended, or otherwise inactive. If you wish to manually generate a different schedule than the currently active schedule, you must send a negative payload first, and then you can send a postive payload again. This does not affect the automatic rescheduling of the node when the current schedule completes.

2.2.7
Minor bug fix that did not affect the majority of users. When a new node was dragged onto the editor and activated without the Initially Suspended option unselected, it did not output the On command immediately if the On Time had already passed, but did work correctly with any positive payload. This should now be fixed.

2.2.6
Fixed the broken Disable Maximum Time On feature.

2.2.5
Cleaned up the msg object.

2.2.4
Additional bug fixing for the same payload issue. Didn't realize how closely node-red holds onto the assigned _msgid for an outgoing msg. This fix should ensure a newly generated _msgid for each payload.

2.2.3
Quick bug fix. Extra msg data was being passed through along with the payload that could have caused the payload to become corrupted.

2.2.2
Previously, when the node was activated and the Start Time was after the Activated Time, it would schedule out for the next day, however, this is not the expected behavior for a Vaction Timer. For example, if you activate the timers at 3:00 PM when you leave for vacation, all devices that would have been on before 3:00 PM should be turned on immediately, otherwise your house could end up being dark for the full day, and perhaps the evening, of your departure and only the following day would those particular devices begin their schedule.

Now, all devices that have a Start Time that is after the Activated Time will be turned on immediately upon activation, unless the Stop Time has also already passed.

2.2.1
Fixed a bug that was causing the node to reschedule the same start and stop times each day without generating new random values.

2.2.0
Now you can choose between a Length of Time for the device to run OR have the device shutoff at a Specific Time with a Delay. If you choose a Specific Time that falls before the hours/minutes of the Time On, the Off command will be scheduled for the following day.

2.1.2
Quick bug fix for an issue that broke the Minimum and Maximum time dropdowns from working correctly in v2.1.1

2.1.1
Fixed issues with the Minimum and Maximum hours/minutes dropdown selectors that would allow you to set a Maximum time that was before the Minimum time.

2.1.0
You can now set the Payload and Topic values for the schedules On and Off commands.
The Payload can use the String, Number and Boolean type inputs.

2.0.0
COMPLETE REWRITE: There were a LOT of errors and problems with the previous versions of Vacation Timer, to the point it was practically unusable, therefore, this version was completely rewritten from scratch with a new scheduling algorithm. It should not break any of your existing nodes and should run correctly now. Instead of rescheduling every night at midnight, each node will reschedule for the following active day at the end of each current schedule. This removes the need for an additional internal timer that was being fired at midnight, and more accurately handles schedules that span across midnight, as well as ensuring inactive days are honored correctly. The node status will also clearly show the next schedule date and times, and you can now disable the Maximum Time On fields if you wish to have the device turned off after a set number of hours and minutes.

1.4.0
Breaking Change: Added the ability to disable rescheduling at Midnight. Any Vacation Timer nodes you already have set-up will need to have this feature enabled in the settings panel if you want them to continue working in their current manner.

1.3.3
Reworked the fix from 1.3.2 to be more consistent with expected results.

1.3.2
Ensure the pairing of Start and Stop schedules. Some rare situations could end up with an On schedule without an associated Off schedule.
Bringing versioning to a more standard, incremental format.

0.0.10 (1.3.1)
Further fix for the multiple msg sending bug.

0.0.9 (1.3.0)
Significant Bug Fix: all msg payloads (on/off) were being sent every second, for a full minute, for a total of 60 msgs.
New Feature: Added a choice of whether or not to issue an Off command for a schedule that spans Midnight onto a non-scheduled day.

0.0.8 (1.2.2)
Changed the Visual On/Off times displayed in the node status from 24hr clock to 12hr clock

0.0.7 (1.2.1)
Removed the need for the cron-parser dependency.

0.0.6 (1.2.0)
Significant Bug Fix: a major bug with the scheduling could have allowed the hours and minutes to be misinterpreted.
New Feature: Added days of the week, so you can set the schedule to only run on certain days.

0.0.5 (1.1.2)
Fixed alignment in configuration panel

0.0.4 (1.1.1)
Fixed typos in the README.md

0.0.3 (1.1.0)
For consistency, when the node is Suspended, a positive payload of start, on, 1 or true is required to active the schedule.
Also, we changed the negative payloads to Suspend the node to include stop, off, 0 or false.

0.0.2 (1.0.1)
Quick fix for incorrect times listed in the Time On dropdown.

0.0.1 (1.0.0)
Initial Release

Node Info

Version: 2.2.8
Updated 8 years ago
License: Apache-2.0
Rating: 5.0 1

Actions

Rate:

Downloads

41 in the last week

Nodes

  • vacation-timer

Keywords

  • cron
  • vacation
  • schedule
  • occupancy
  • timer
  • node-red
  • node

Maintainers