Premise [download] Module: Logging

Motorola Premise

123

Senior Member
File Name: Module: Logging
File Submitter: 123
File Submitted: 11 Mar 2009
File Category: Premise
Author: mslehv
Contact: PM 123
Version: 2.0

Original Author: mslehv
Release Date: 03-23-2004

Overview
Logging 2.0 is an updated version of the original version posted in December, 2003. This version adds a subroutine that enables scripts to create log entries from any point in the script. It also includes a default Premise Alarm handler and a one line e-mailer subroutine. Logger 2.0 will work with IrrigationPro so that the latter's entries are added to the Logger's daily event log.

Installation
Installation simply requires importing Logging 2.0.xdo and setting the values of several variables to match your own e-mail parameters. Full installation instructions are contained in the Logging 2.0 User's Manual.

The Manual contains instructions for adding event logging to additional Home Objects, Premise Classes, and User Scripts. It also describes how to run IrrigationPro using the Logger's logging engine.


Click here to download this file
 
I'm having trouble getting this installed. First problem I ran into was on Step 3 of the installation:

Code:
3. Move the two scripts in the Logging Scripts folder to your \Premise\Sys\Scripts folder.

This directory did not exist for me so I just created it and copied the files into it. I then tried to 'File->Import' the 'Logging 2.0.xdo' file. This gave me an error on line 71 which states:

Code:
Set objFileSysObj = CreateObject("Scripting.FileSystemObject")

Any ideas?
 
The Scripts folder is not part of Premise's default folder structure; the module's author adds it to help organize the module's related files.

The error you encountered has me stumped. What did the error message say about line 71? The line of code is not Premise-specific and is simply trying to create a Filesystem object. I cannot recreate the error on my PC.
 
Hmm, that only deepens the mystery. Line 71 is simply attempting to instantiate a FileSystem object ...the script wants to create a file on the PC (it's not even a Premise-specific operation). First guess would be some sort of PC security policy that prevents a Windows Service from creating files ... but that seems too extreme ... it must be something simpler.
 
I considered releasing my Logmaster module but it also contains code that uses Scripting.FileSystem ... so it you may encounter the very same problem on your PC.
 
This is no good. I tried restarting the server, restarting the machine, etc. Same results.

I'm trying to comment out line 71 but I can't seem to edit. I see the yellow arrow pointing at the offending code, but I can not type in the text window even though my cursor appears in the spot where I want to insert the comment symbol. Do I need to do something special to edit this Procedure?

Is there any chance that I'm missing some libraries or something? vb or the like?
 
...I'm trying to comment out line 71 but I can't seem to edit. I see the yellow arrow pointing at the offending code, but I can not type in the text window ...

What you're experiencing is the following: the VBScript interpreter has halted execution at an offending line of script code. The VBScript debugger kicks in and flags the line with a yellow arrow.

Press SHIFT+F5 to "Stop Debugging". Alternately, click the "Stop Debugging" icon in Builder's toolbar (it looks like a series of horizontal lines with an "X"; it is to the left of the icon with a "hand" image). After exiting Debugging Mode, you will be able to alter the script code.

I honestly don't know what is the cause of this problem. The offending line is basic VBScript code.

Extract the VBS file from the attached zip archive and run in on your PC (from your Desktop, not from within Premise). It will check for the presence of C:\CONFIG.SYS and display a message. It uses Scripting.FileSystemObject and should work on your PC. If it does work, then something may be constraining Premise's ability to execute filesystem-related code on your PC.
 

Attachments

Thanks again for your attention. The script did not work. Here's what it says:

Code:
Windows Script Host

Script: C:\my_path\script_test.vbs
Line: 5
Char: 1
Error: The specified module could not be found.
Code: 8007007E
Source: (null)
 
That's what I suspected ... no support for Windows Script Host (WSH).

WSH is installed by default on Windows XP. If you're using an older version of Windows you may need to install it. If you are using Win XP ... maybe someone else has a clue as to what's going on.
 
... everything is working great now!
Glad to hear it!

You can continue to use mslehv's Logging Module or try my LogMaster Module. LogMaster gives you:

  • Greater Control
    You can enable/disable logging on a per object basis.
  • Better storage format
    It logs events to an Access MDB file.
  • Simple installation
    Copy an MDB file to a folder.
  • Easily extended
    Video demonstrates how to extend logging to other Premise classes.
mslehv's Logging Module does a few things that LogMaster does not do:
  • Records when Premise Server starts.
  • Can send email when Premise starts.
If these features are important to you, you may as well stick with the Logging Module.
 
The above mentioned video on how to extend logging to other classes is not available.  I would like to log the status of the HVAC modes: heat/cool/auto, fan mode, heat and cool set points, etc.
 
Has anyone done this or can someone point me to a tutorial on how to do this.
 
Thanks,
lz
 
<p>I'll take a look - maybe we'll get lucky...</p>
<p>&nbsp;</p>
<p>I think the way to extend is to try this...</p>
<p>1) Copy one of the classes (e.g. WindowSensorExt) and rename it to e.g ThermostatExt</p>
<p>2) Select the class name and look to the window on the right - you should see three items 1) The Logmaster Object 2) the WindowSensor object 3) Change Property script</p>
<p>3) Replace the WindowSensor object with the Thermostat object. An easy way to do it is to copy the thermostat object from&nbsp; the minibrowser thermostat. At this point you should see the Logmaster logging box on your thermostat object in Home</p>
<p>4) Create the ChangeProperty script for whatever property you want to change. For the script, use one of the two examples from the other ChangeProperty scripts</p>
<p>5) You'll have to copy and rename the Logging Control scripts under Macros</p>
<p>&nbsp;</p>
<p>Let me know if that works. I am curious what the output looks like (I didn't look at how it is supposed to output other than verifying it was writing to the db</p>
 
Back
Top