Day of Week is being ignored in Rule Data

  • 54 Views
  • Last Post 01 July 2013
tnamey posted this 29 June 2013

I have set up a rule to email me if there is motion detected during the week when I'm away from home. InControl follows the time conditions properly but is ignoring the days I have selected under Rule Data. Basically I have M-F selected but it continues to send me email alerts on Saturday and Sunday.

Vs. 3.17

Thanks

Tom

Order By: Standard | Newest | Votes
Ryan-Scott posted this 01 July 2013

I have set up a rule to email me if there is motion detected during the week when I'm away from home. InControl follows the time conditions properly but is ignoring the days I have selected under Rule Data. Basically I have M-F selected but it continues to send me email alerts on Saturday and Sunday.

Vs. 3.17

Thanks

Tom


Hi Tom -

Is this rule one that you could re-make as a scene instead? We are actually phasing rules out in favor of scenes with triggers & conditions as they are easier to setup and use.

If you need me to, please give some details about what you need and I'll see what I can do about assisting in the creation of a scene/trigger/condition scenario.

tnamey posted this 01 July 2013

The rule I'll need to recreate is using the "Sendemailwhenactive" script. I have the motion sensors selected under NodeIds and Off-to-On set as True. I also have several days selected under Day of Week(that are being ignored). Conditions are set between two times of the day.

I've unsuccessfully played around with creating this as a scene but I'm guess I'm missing how to associate the script with the specific Nodes(motion sensors).

Thanks

Tom

Ryan-Scott posted this 01 July 2013

The rule I'll need to recreate is using the "Sendemailwhenactive" script. I have the motion sensors selected under NodeIds and Off-to-On set as True. I also have several days selected under Day of Week(that are being ignored). Conditions are set between two times of the day.

I've unsuccessfully played around with creating this as a scene but I'm guess I'm missing how to associate the script with the specific Nodes(motion sensors).

Thanks

Tom


If you haven't seen this explanation of scene triggers & conditions, it may help.

Here's a brief rundown of what you want:

1. Create a scene
2. Select the script you want to execute as as either post/pre script (shouldn't matter in this case) - try to use "EmailSceneStatusReport.cs" instead of the other one
3. Create a device trigger using your motion sensor; trigger when the value is 255 (that means "Motion detected" or if you are on a later beta version that supports it, simply choose the "Motion detected" option)
4. Repeat #3 for each motion sensor you want to trigger your scene
5. Create a "Day of Week Condition" to limit which days the triggers are valid for
6. Create a "Time Condition" to handle the "Between hours" you mentioned

Ryan-Scott posted this 01 July 2013

In case you don't have the EmailSceneStatusReport script, here it is:


using System;
using System.Collections.Generic;
using System.Text;
using MLS.ZWave.Service.Rules;
using MLS.ZWave.BusinessObjects;
using MLS.HA.DeviceController.Common;

///
///
/// ALWAYS MAKE COPIES OF SCRIPTS YOU INTEND TO CUSTOMIZE OR YOUR CHANGES
/// COULD BE LOST.
///

public class EmailSceneStatusReport : ScriptBase, ScriptInterface {
public void runScript() {
try {

/********************/
/
It's safe to change these const values to match your scenario /

// The amount to dim by each time
const byte dimAmount = 1;

// How long to wait between dims, in seconds
const int waitTimeSeconds = 2;

/
********************/

// The actual brains of this script start here, be careful making changes
// beyond this point.
StringBuilder sbReport = new StringBuilder();

// Date and name the report
sbReport.AppendFormat("{0} at {1}\r\n
", rule == null ? "" : rule.ruleName, DateTime.Now.ToShortTimeString());

// Get all the devices specified in the rule data node list
var devices = sceneDevices;
foreach (var sd in devices) {
if (sd.commandType == MLS.Common.SceneCommandType.Device && sd.deviceId != null) {
var device = getNode((Guid)sd.deviceId);
if (device != null) {
switch (device.deviceType) {
case DeviceType.MotionSensor:
sbReport.AppendFormat(" {0} sees {1}.
", device.name, device.level > 0 ? "motion" : "no motion");
break;
case DeviceType.BinarySensor:
sbReport.AppendFormat(" {0} is {1}.
", device.name, device.level > 0 ? "open" : "closed");
break;
default:
sbReport.AppendFormat(" {0} is at {1}.
", device.name, device.level);
break;
}
} else {
//sbReport.AppendFormat("Device not found
");
}
} else {
//sbReport.AppendFormat("Skipped command");
}
}

sendEmail(string.Format("Status Report"), string.Format("Status report:
{0}", sbReport.ToString()));

} catch (Exception ex) {
// Log the exception here
writeFileLog("EmailSceneStatusReport Error", ex);
}
}
}


tnamey posted this 01 July 2013

I just had to switch what script was being used and it works. Though it doesn't tell me which sensor was active like the "Sendemailwhenactive" did within the rule. Anyway to add that on a future update when you do drop the rules for scenes?

Thanks

Tom

Close