Hello,
I use EmailSceneStatusReport.cs but it didn't send the device status, only the first string (scene name and hour).
Someone can help me with this script ?
In Control version : 3.89
Thx.
Script :
[code]
using System;
using System.Collections.Generic;
using System.Text;
using MLS.ZWave.Service.Rules;
using MLS.ZWave.BusinessObjects;
using MLS.HA.DeviceController.Common;
using System.IO;
using MLS.HA.DeviceController.Common.Device;
///
///
/// 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 ? "
List
try {
// 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;
case DeviceType.IpCamera:
// Send a current snapshot of the camera
try {
// Request a poll of the camera to get the latest image
dm.pollDevice(device.deviceId);
var bytes = Convert.FromBase64String(((CameraDevice)device).b64Image);
var memStream = new MemoryStream(bytes);
imageAttachments.Add(memStream);
} catch { }
break;
default:
sbReport.AppendFormat(" {0} is at {1}.
", device.name, device.level);
Script EmailSceneStatusReport.cs
- 180 Views
- Last Post 18 April 2014
Tormleah
posted this
18 April 2014
ftsikogi
posted this
18 April 2014
Maybe you have already done it but have you added the devices that you want to get the status for, in the devices tab? Also make sure that you have the “no change” option checked.
Thanks
Tormleah
posted this
18 April 2014
Ok I did not know that i need to add the devices... it work better now
Thank's !