[BF] v1.3.5.3 Change Level to numeric and create State for Bollean values, because telegraf only parse numeric
This commit is contained in:
parent
55e88f7b45
commit
32b4daf3fb
@ -47,7 +47,7 @@ namespace ZwayBot.Moduls {
|
||||
if (instance.CommandClasses.ContainsKey(ACommandClass.Classes.SwitchBinary)) {
|
||||
String topic = "/flex4grid/v1/households/" + this.household + "/device/state";
|
||||
String text = JsonMapper.ToJson(new Dictionary<String, String>() {
|
||||
{ "status", ((Switchbinary)instance.CommandClasses[ACommandClass.Classes.SwitchBinary]).Level?"active":"idle" },
|
||||
{ "status", ((Switchbinary)instance.CommandClasses[ACommandClass.Classes.SwitchBinary]).State?"active":"idle" },
|
||||
{ "timestamp", DateTime.Now.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffff'Z'") },
|
||||
{ "type", ((Switchbinary)instance.CommandClasses[ACommandClass.Classes.SwitchBinary]).Name },
|
||||
{ "id", instance.DeviceId.ToString() }
|
||||
@ -93,7 +93,7 @@ namespace ZwayBot.Moduls {
|
||||
Int32 deviceid = Int32.Parse(device);
|
||||
if (this.zw.Devices.ContainsKey(deviceid) && this.zw.Devices[deviceid].Instances.ContainsKey(0) &&
|
||||
this.zw.Devices[deviceid].Instances[0].CommandClasses.ContainsKey(ACommandClass.Classes.SwitchBinary)) {
|
||||
((Switchbinary)this.zw.Devices[deviceid].Instances[0].CommandClasses[ACommandClass.Classes.SwitchBinary]).Level = message["command"].ToString() == "ON";
|
||||
((Switchbinary)this.zw.Devices[deviceid].Instances[0].CommandClasses[ACommandClass.Classes.SwitchBinary]).State = message["command"].ToString() == "ON";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -108,7 +108,7 @@ namespace ZwayBot.Moduls {
|
||||
if (this.zw.Devices.ContainsKey(deviceid) && this.zw.Devices[deviceid].Instances.ContainsKey(0)) {
|
||||
if (this.zw.Devices[deviceid].Instances[0].CommandClasses.ContainsKey(ACommandClass.Classes.SwitchBinary)) {
|
||||
Switchbinary sw = ((Switchbinary)this.zw.Devices[deviceid].Instances[0].CommandClasses[ACommandClass.Classes.SwitchBinary]);
|
||||
response.Add(sw.DeviceId.ToString(), sw.Level ? "active" : "idle");
|
||||
response.Add(sw.DeviceId.ToString(), sw.State ? "active" : "idle");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user