Skip to content

Commit

Permalink
fix to Multiinstance SwitchBinary and Count report
Browse files Browse the repository at this point in the history
  • Loading branch information
genemars committed Feb 15, 2015
1 parent d138daf commit 7b23d20
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions MigFiles/SupportLibraries/ZWaveLib/Handlers/MultiInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ public static ZWaveEvent GetEvent(ZWaveNode node, byte[] message)

byte cmdClass = message[7];
byte cmdType = message[8];
byte instanceCmdClass = message[10];
byte instanceCmdClass = message[9];

switch (cmdType)
{
case (byte)Command.MultiInstanceReport:
case (byte)Command.MultiInstaceV2Encapsulated:

byte[] instanceMessage;
byte instanceNumber = message[9];

// if it's a COMMAND_MULTIINSTANCEV2_ENCAP we shift key and val +1 byte
if (cmdType == (byte)Command.MultiInstaceV2Encapsulated)
Expand All @@ -52,6 +53,7 @@ public static ZWaveEvent GetEvent(ZWaveNode node, byte[] message)
}
else
{
instanceCmdClass = message[10];
instanceMessage = new byte[message.Length - 3];
System.Array.Copy(message, 3, instanceMessage, 0, message.Length - 3);
}
Expand All @@ -74,28 +76,28 @@ public static ZWaveEvent GetEvent(ZWaveNode node, byte[] message)
nodeEvent = SwitchBinary.GetEvent(node, instanceMessage);
if (nodeEvent != null)
{
node.RaiseUpdateParameterEvent(nodeEvent.Instance, ParameterEvent.MultiinstanceSwitchBinary, nodeEvent.Value);
node.RaiseUpdateParameterEvent(instanceNumber, ParameterEvent.MultiinstanceSwitchBinary, nodeEvent.Value);
}
break;
case (byte)CommandClass.SwitchMultilevel:
nodeEvent = SwitchMultilevel.GetEvent(node, instanceMessage);
if (nodeEvent != null)
{
node.RaiseUpdateParameterEvent(nodeEvent.Instance, ParameterEvent.MultiinstanceSwitchMultilevel, nodeEvent.Value);
node.RaiseUpdateParameterEvent(instanceNumber, ParameterEvent.MultiinstanceSwitchMultilevel, nodeEvent.Value);
}
break;
case (byte)CommandClass.SensorBinary:
nodeEvent = SensorBinary.GetEvent(node, instanceMessage);
if (nodeEvent != null)
{
node.RaiseUpdateParameterEvent(nodeEvent.Instance, ParameterEvent.MultiinstanceSensorBinary, nodeEvent.Value);
node.RaiseUpdateParameterEvent(instanceNumber, ParameterEvent.MultiinstanceSensorBinary, nodeEvent.Value);
}
break;
case (byte)CommandClass.SensorMultilevel:
nodeEvent = SensorMultilevel.GetEvent(node, instanceMessage);
if (nodeEvent != null)
{
node.RaiseUpdateParameterEvent(nodeEvent.Instance, ParameterEvent.MultiinstanceSensorMultilevel, nodeEvent.Value);
node.RaiseUpdateParameterEvent(instanceNumber, ParameterEvent.MultiinstanceSensorMultilevel, nodeEvent.Value);
}
break;
case (byte)CommandClass.Meter:
Expand Down Expand Up @@ -138,7 +140,7 @@ public static void GetCount(ZWaveNode node, byte commandClass)
{
node.SendRequest(new byte[] {
(byte)CommandClass.MultiInstance,
(byte)Command.MultiInstanceCountGet, // 0x04 = GET, 0x05 = REPORT
(byte)Command.MultiInstanceCountGet,
commandClass
});
}
Expand Down Expand Up @@ -195,7 +197,6 @@ public static void SwitchMultiLevelSet(ZWaveNode node, byte instance, int value)

public static void SensorBinaryGet(ZWaveNode node, byte instance)
{
// 0x01, 0x0C, 0x00, 0x13, node, 0x05, 0x60, 0x06, 0x01, 0x31, 0x04, 0x05, 0x03, 0x00
node.SendRequest(new byte[] {
(byte)CommandClass.MultiInstance,
0x06, // ??
Expand All @@ -207,7 +208,6 @@ public static void SensorBinaryGet(ZWaveNode node, byte instance)

public static void SensorMultiLevelGet(ZWaveNode node, byte instance)
{
// 0x01, 0x0C, 0x00, 0x13, node, 0x05, 0x60, 0x06, 0x01, 0x31, 0x04, 0x05, 0x03, 0x00
node.SendRequest(new byte[] {
(byte)CommandClass.MultiInstance,
0x06, // ??
Expand Down

0 comments on commit 7b23d20

Please sign in to comment.