private void controller_UpdateNodeParameter(object sender, UpdateNodeParameterEventArgs upargs) { string path = "UnknwonParameter"; object value = upargs.Value; // switch (upargs.ParameterName) { case EventParameter.MeterKwHour: path = GetIndexedParameterPath(ModuleParameters.MODPAR_METER_KW_HOUR, upargs.ParameterId); break; case EventParameter.MeterKvaHour: path = GetIndexedParameterPath(ModuleParameters.MODPAR_METER_KVA_HOUR, upargs.ParameterId); break; case EventParameter.MeterWatt: path = GetIndexedParameterPath(ModuleParameters.MODPAR_METER_WATTS, upargs.ParameterId); break; case EventParameter.MeterPulses: path = GetIndexedParameterPath(ModuleParameters.MODPAR_METER_PULSES, upargs.ParameterId); break; case EventParameter.MeterAcVolt: path = GetIndexedParameterPath(ModuleParameters.MODPAR_METER_AC_VOLT, upargs.ParameterId); break; case EventParameter.MeterAcCurrent: path = GetIndexedParameterPath(ModuleParameters.MODPAR_METER_AC_CURRENT, upargs.ParameterId); break; case EventParameter.MeterPower: path = GetIndexedParameterPath(ModuleParameters.MODPAR_SENSOR_POWER, upargs.ParameterId); break; case EventParameter.Battery: RaisePropertyChanged(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = upargs.NodeId.ToString(), SourceType = "ZWave Node", Path = "ZWaveNode.Battery", Value = value }); path = ModuleParameters.MODPAR_STATUS_BATTERY; break; case EventParameter.NodeInfo: path = "ZWaveNode.NodeInfo"; break; case EventParameter.Generic: path = ModuleParameters.MODPAR_SENSOR_GENERIC; break; case EventParameter.AlarmGeneric: path = ModuleParameters.MODPAR_SENSOR_ALARM_GENERIC; break; case EventParameter.AlarmDoorWindow: path = ModuleParameters.MODPAR_SENSOR_DOORWINDOW; break; case EventParameter.AlarmTampered: path = ModuleParameters.MODPAR_SENSOR_TAMPER; break; case EventParameter.SensorTemperature: path = ModuleParameters.MODPAR_SENSOR_TEMPERATURE; break; case EventParameter.SensorHumidity: path = ModuleParameters.MODPAR_SENSOR_HUMIDITY; break; case EventParameter.SensorLuminance: path = ModuleParameters.MODPAR_SENSOR_LUMINANCE; break; case EventParameter.SensorMotion: path = ModuleParameters.MODPAR_SENSOR_MOTIONDETECT; break; case EventParameter.AlarmSmoke: path = ModuleParameters.MODPAR_SENSOR_ALARM_SMOKE; break; case EventParameter.AlarmCarbonMonoxide: path = ModuleParameters.MODPAR_SENSOR_ALARM_CARBONMONOXIDE; break; case EventParameter.AlarmCarbonDioxide: path = ModuleParameters.MODPAR_SENSOR_ALARM_CARBONDIOXIDE; break; case EventParameter.AlarmHeat: path = ModuleParameters.MODPAR_SENSOR_ALARM_HEAT; break; case EventParameter.AlarmFlood: path = ModuleParameters.MODPAR_SENSOR_ALARM_FLOOD; break; case EventParameter.ManufacturerSpecific: ManufacturerSpecificInfo mf = (ManufacturerSpecificInfo)value; path = "ZWaveNode.ManufacturerSpecific"; value = mf.ManufacturerId + ":" + mf.TypeId + ":" + mf.ProductId; break; case EventParameter.Configuration: path = "ZWaveNode.Variables." + upargs.ParameterId; break; case EventParameter.Association: var associationResponse = (Association.AssociationResponse)value; RaisePropertyChanged(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = upargs.NodeId.ToString(), SourceType = "ZWave Node", Path = "ZWaveNode.Associations.Max", Value = associationResponse.Max }); RaisePropertyChanged(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = upargs.NodeId.ToString(), SourceType = "ZWave Node", Path = "ZWaveNode.Associations.Count", Value = associationResponse.Count }); path = "ZWaveNode.Associations." + associationResponse.GroupId; // TODO: implement generic group/node association instead of fixed one value = associationResponse.NodeList; break; case EventParameter.MultiinstanceSwitchBinaryCount: path = "ZWaveNode.MultiInstance.SwitchBinary.Count"; break; case EventParameter.MultiinstanceSwitchMultilevelCount: path = "ZWaveNode.MultiInstance.SwitchMultiLevel.Count"; break; case EventParameter.MultiinstanceSensorBinaryCount: path = "ZWaveNode.MultiInstance.SensorBinary.Count"; break; case EventParameter.MultiinstanceSensorMultilevelCount: path = "ZWaveNode.MultiInstance.SensorMultiLevel.Count"; break; case EventParameter.MultiinstanceSwitchBinary: path = "ZWaveNode.MultiInstance.SwitchBinary." + upargs.ParameterId; break; case EventParameter.MultiinstanceSwitchMultilevel: path = "ZWaveNode.MultiInstance.SwitchMultiLevel." + upargs.ParameterId; break; case EventParameter.MultiinstanceSensorBinary: path = "ZWaveNode.MultiInstance.SensorBinary." + upargs.ParameterId; break; case EventParameter.MultiinstanceSensorMultilevel: path = "ZWaveNode.MultiInstance.SensorMultiLevel." + upargs.ParameterId; break; case EventParameter.WakeUpInterval: path = "ZWaveNode.WakeUpInterval"; break; case EventParameter.WakeUpNotify: path = "ZWaveNode.WakeUpNotify"; break; case EventParameter.Level: // RaisePropertyChanged(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = upargs.NodeId.ToString(), SourceType = "ZWave Node", Path = "ZWaveNode.Basic", Value = value }); // double normalizedval = (Math.Round((double)value / 99D, 2)); if (normalizedval > 1.0) normalizedval = 1.0; // binary switches have [0/255], while multilevel switches [0-99] if (upargs.ParameterId == 0) { path = ModuleParameters.MODPAR_STATUS_LEVEL; } else { path = ModuleParameters.MODPAR_STATUS_LEVEL + "." + upargs.ParameterId; } value = normalizedval.ToString(CultureInfo.InvariantCulture); break; case EventParameter.ThermostatMode: path = "Thermostat.Mode"; value = ((Thermostat.Mode)value).ToString(); break; case EventParameter.ThermostatOperatingState: path = "Thermostat.OperatingState"; value = ((Thermostat.OperatingState)value).ToString(); break; case EventParameter.ThermostatFanMode: path = "Thermostat.FanMode"; value = ((Thermostat.FanMode)value).ToString(); break; case EventParameter.ThermostatFanState: path = "Thermostat.FanState"; value = ((Thermostat.FanState)value).ToString(); break; case EventParameter.ThermostatHeating: path = "Thermostat.Heating"; break; case EventParameter.ThermostatSetBack: path = "Thermostat.SetBack"; break; case EventParameter.ThermostatSetPoint: path = "Thermostat.SetPoint." + ((Thermostat.SetPointType)((dynamic)value).Type).ToString(); value = ((dynamic)value).Value; break; case EventParameter.UserCode: path = "EntryControl.UserCode"; value = ((ZWaveLib.Values.UserCodeValue)value).TagCodeToHexString(); break; default: Console.WriteLine( "UNHANDLED PARAMETER CHANGE FROM NODE {0} ====> Param Type: {1} Param Id:{2} Value:{3}", upargs.NodeId, upargs.ParameterName, upargs.ParameterId, value ); break; } //string type = upargs.ParameterType.ToString (); // RaisePropertyChanged(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = upargs.NodeId.ToString(), SourceType = "ZWave Node", Path = path, Value = value }); }
private void znode_UpdateNodeParameter(object sender, UpdateNodeParameterEventArgs upargs) { RaiseUpdateParameterEvent((ZWaveNode)sender, upargs.ParameterId, upargs.ParameterName, upargs.Value); }