I think I need help understanding some code in ModuleParameter.cs.
public string Value
{
get
{
return parameterValue;
}
set
{
//TODO: find a better solution for "Meter.Watts" case
//if (_value != value || Name == Properties.METER_WATTS || Name.StartsWith("ZWaveNode."))
{
if ((!string.IsNullOrEmpty(parameterValue) && parameterValue != value)) // || Name == Properties.METER_WATTS || Name.StartsWith("ZWaveNode."))
{
LastValue = parameterValue;
LastUpdateTime = UpdateTime.ToUniversalTime();
}
UpdateTime = DateTime.UtcNow;
parameterValue = value;
//
// can we add this value for statistics?
double v;
if (value != "" && StatisticsLogger.IsValidField(this.Name) && double.TryParse(value.Replace(",", "."), System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out v))
{
Statistics.AddValue(v, this.UpdateTime);
}
}
}
}
Line 74 looks like it will only allow Value to be updated if the new value is different than the last value. However, this is a problem for me. I need to watch for a single or double tap of a switch. In order to do this, I need to know what the current and last values of the switch are. I have code that looks for a double tap (ON + ON or Off + OFF) in order to act. The way it's currently coded, it looks like I cannot detect a double tap of the switch.
I could change the code to eliminate this, but I'm not sure if that would break something else. Could you help understand why HG won't let a double sending of the current value? The only thing I can think of is that this is in an effort to keep RF commands from being stored as a LastValue since they are most likely repeated when sent.