public virtual bool HandleMultiInstanceReport(byte[] message) { //UNHANDLED: 01 14 00 04 08 04 0E 32 02 21 74 00 00 1E BB 00 00 00 00 00 00 2D // ^^ bool processed = false; // byte command_class = message[7]; // if (command_class == (byte)CommandClass.COMMAND_CLASS_METER) { if (message.Length > 14 && message[4] == 0x00) { // CLASS METER // double watts_read = ((double)int.Parse(message[12].ToString("X2") + message[13].ToString("X2") + message[14].ToString("X2"), System.Globalization.NumberStyles.HexNumber)) / 1000D; _nodehost._raiseUpdateParameterEvent(_nodehost, 0, ParameterType.PARAMETER_WATTS, watts_read); // Logger.Log(LogLevel.REPORT, " * Received METER report from node " + _nodehost.NodeId); // + " (" + _nodehost.Description + ")"); Logger.Log(LogLevel.REPORT, " * " + _nodehost.NodeId + "> kW " + Math.Round(watts_read, 3) /*+ " Counter kW " + Math.Round(meter_count, 10)*/); // processed = true; } else if (message.Length > 14 && message[4] == 0x08) { //TODO: complete here... processed = true; } } return(processed); }
// // 01 0D 00 04 00 1C 07 9C 02 00 05 FF 00 00 89 // | | | | | | | | | | | | | | | // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 // // 01 0F 00 04 00 18 09 71 05 07 00 00 FF 07 02 00 // 01 0F 00 04 00 18 09 71 05 07 FF 00 FF 07 02 00 // public virtual bool HandleBasicReport(byte[] message) { bool handled = false; // byte cmd_length = message[6]; byte cmd_class = message[7]; byte cmd_type = message[8]; // if (cmd_class == (byte)CommandClass.COMMAND_CLASS_BASIC && (cmd_type == 0x03 || cmd_type == 0x01)) { _nodehost._raiseUpdateParameterEvent(_nodehost, 0, ParameterType.PARAMETER_BASIC, (double)message [9]); handled = true; } else if (cmd_class == (byte)CommandClass.COMMAND_CLASS_SCENE_ACTIVATION && cmd_type == 0x01) { _nodehost._raiseUpdateParameterEvent(_nodehost, 0, ParameterType.PARAMETER_GENERIC, (double)message[9]); handled = true; } else if (cmd_class == (byte)CommandClass.COMMAND_CLASS_SENSOR_BINARY && cmd_type == 0x03) { _nodehost._raiseUpdateParameterEvent(_nodehost, 0, ParameterType.PARAMETER_GENERIC, message[9]); handled = true; } else if (cmd_class == (byte)CommandClass.COMMAND_CLASS_SENSOR_MULTILEVEL && cmd_type == 0x05) { SensorValue sensorval = Sensor.ParseSensorValue(message); if (sensorval.Parameter == ZWaveSensorParameter.UNKNOWN) { byte key = message[9]; _nodehost._raiseUpdateParameterEvent(_nodehost, 0, ParameterType.PARAMETER_GENERIC, sensorval.Value); Console.WriteLine("\nUNHANDLED SENSOR PARAMETER TYPE => " + key + "\n"); } else { _nodehost._raiseUpdateParameterEvent(_nodehost, 0, sensorval.EventType, sensorval.Value); handled = true; } } else if ((cmd_class == (byte)CommandClass.COMMAND_CLASS_SENSOR_ALARM && cmd_type == 0x02) || (cmd_class == (byte)CommandClass.COMMAND_CLASS_ALARM && cmd_type == 0x05)) { SensorAlarmValue sensoralarmval = Sensor.ParseSensorAlarmValue(message); _nodehost._raiseUpdateParameterEvent(_nodehost, 0, sensoralarmval.EventType, sensoralarmval.Value); handled = true; } return(handled); }
public void SetNodeHost(ZWaveNode node) { _nodehost = node; _nodehost._raiseUpdateParameterEvent(_nodehost, 0, ParameterType.PARAMETER_WATTS, 0); }