HomeGenie Forum
Automation Program Plugins and Wizard Scripting => Help => Topic started by: funworld on February 13, 2015, 04:56:04 PM
-
I use this Code for a pressDuration.
But after updating i get an Error
When.ModuleParameterChanged( (module, parameter) =>
{
if (module.Is("Entry switch") && parameter.Is("Status.Level"))
{
var endTime = parameter.UpdateTime; // this is the timestamp of button release
var startTime = parameter.LastUpdateTime; // this is the timestamp of button press
var pressDuration = endTime - startTime;
if (pressDuration.TotalSeconds > 2)
ERROR
HomeGenie.Data.ModuleParameter' does not contain a definition for `LastUpdateTime' and no extension method `LastUpdateTime' of type `HomeGenie.Data.ModuleParameter' could be found. Are you missing an assembly reference?
THX for Help
-
In latest hg releases this has changed to:
parameter.Statistics.Last.Timestamp
more details about the Statistics field can be obtained from the source code:
https://github.com/genielabs/HomeGenie/blob/master/HomeGenie/Data/ValueStatistics.cs#L108
you can probably use:
var stats = parameter.Statistics;
var pressDuration = stats.LastOn.Timestamp - stats.LastOff.Timestamp;
g.
-
I canged to
var endTime = parameter.UpdateTime; // this is the timestamp of button release
var startTime = parameter.Statistics.Last.Timestamp; // this is the timestamp of button press
var pressDuration = endTime - startTime;
Your code make a different effect,
THX for helping