[NF] Tiny fix for mqtt
This commit is contained in:
parent
d7f27fad4f
commit
db935e019c
@ -12,7 +12,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
/// </summary>
|
||||
public class Battery : ACommandClass {
|
||||
|
||||
public Single Level { get; private set; }
|
||||
public Double Level { get; private set; }
|
||||
|
||||
public override event UpdatedValue Update;
|
||||
|
||||
@ -24,12 +24,12 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
Boolean success = false;
|
||||
if (match.Groups[4].Value == ".data") {
|
||||
if (json.Keys.Contains("last") && json["last"].Keys.Contains("value")) {
|
||||
this.Level = Single.Parse(json["last"]["value"].ToString());
|
||||
this.Level = Double.Parse(json["last"]["value"].ToString());
|
||||
success = true;
|
||||
}
|
||||
} else if (match.Groups[4].Value == ".data.last") {
|
||||
if (json.Keys.Contains("value")) {
|
||||
this.Level = Single.Parse(json["value"].ToString());
|
||||
this.Level = Double.Parse(json["value"].ToString());
|
||||
success = true;
|
||||
}
|
||||
} else if (match.Groups[4].Value.StartsWith(".data.history.")) {
|
||||
@ -44,7 +44,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
|
||||
private void InitComplex(JsonData json) {
|
||||
if (json.Keys.Contains("data") && json["data"].Keys.Contains("last") && json["data"]["last"].Keys.Contains("value")) {
|
||||
this.Level = Single.Parse(json["data"]["last"]["value"].ToString());
|
||||
this.Level = Double.Parse(json["data"]["last"]["value"].ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level.ToString() },
|
||||
{ "level", this.Level },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "scene", this.Scene.ToString() },
|
||||
{ "key", this.Key.ToString() },
|
||||
{ "scene", this.Scene },
|
||||
{ "key", this.Key },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level.ToString() },
|
||||
{ "size", this.Size.ToString() },
|
||||
{ "level", this.Level },
|
||||
{ "size", this.Size },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
public override event UpdatedValue Update;
|
||||
|
||||
public String Type { get; private set; }
|
||||
public Single Level { get; private set; }
|
||||
public Double Level { get; private set; }
|
||||
public String Scale { get; private set; }
|
||||
public Metersub(JsonData json, Tuple<Int32, Int32, Classes, Int32> id, HttpConnection http, Boolean polling) : base(json, id, http, polling) {
|
||||
this.HasReset = true;
|
||||
@ -27,7 +27,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
json.Keys.Contains("scaleString") &&
|
||||
json["scaleString"].Keys.Contains("value")) {
|
||||
this.Type = json["sensorTypeString"]["value"].ToString();
|
||||
this.Level = Single.Parse(json["val"]["value"].ToString());
|
||||
this.Level = Double.Parse(json["val"]["value"].ToString());
|
||||
this.Scale = json["scaleString"]["value"].ToString();
|
||||
}
|
||||
}
|
||||
@ -37,10 +37,10 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
json.Keys.Contains("sensorTypeString") && json["sensorTypeString"].Keys.Contains("value") &&
|
||||
json.Keys.Contains("scaleString") && json["scaleString"].Keys.Contains("value") &&
|
||||
this.CheckSetUpdateTime(json)) {
|
||||
this.Level = Single.Parse(json["val"]["value"].ToString());
|
||||
this.Level = Double.Parse(json["val"]["value"].ToString());
|
||||
this.Type = json["sensorTypeString"]["value"].ToString();
|
||||
this.Scale = json["scaleString"]["value"].ToString();
|
||||
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<String, String, Single>(this.Type, this.Scale, this.Level), this.LastUpdate, this));
|
||||
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<String, String, Double>(this.Type, this.Scale, this.Level), this.LastUpdate, this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level.ToString() },
|
||||
{ "level", this.Level },
|
||||
{ "type", this.Type },
|
||||
{ "scale", this.Scale },
|
||||
};
|
||||
|
@ -11,7 +11,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
public override event UpdatedValue Update;
|
||||
|
||||
public String Type { get; private set; }
|
||||
public Single Level { get; private set; }
|
||||
public Double Level { get; private set; }
|
||||
public String Scale { get; private set; }
|
||||
|
||||
public Sensormultilevelsub(JsonData json, Tuple<Int32, Int32, Classes, Int32> id, HttpConnection http, Boolean polling) : base(json, id, http, polling) {
|
||||
@ -27,7 +27,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
json.Keys.Contains("scaleString") &&
|
||||
json["scaleString"].Keys.Contains("value")) {
|
||||
this.Type = json["sensorTypeString"]["value"].ToString();
|
||||
this.Level = Single.Parse(json["val"]["value"].ToString());
|
||||
this.Level = Double.Parse(json["val"]["value"].ToString());
|
||||
this.Scale = json["scaleString"]["value"].ToString();
|
||||
}
|
||||
}
|
||||
@ -37,10 +37,10 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
json.Keys.Contains("sensorTypeString") && json["sensorTypeString"].Keys.Contains("value") &&
|
||||
json.Keys.Contains("scaleString") && json["scaleString"].Keys.Contains("value") &&
|
||||
this.CheckSetUpdateTime(json)) {
|
||||
this.Level = Single.Parse(json["val"]["value"].ToString());
|
||||
this.Level = Double.Parse(json["val"]["value"].ToString());
|
||||
this.Type = json["sensorTypeString"]["value"].ToString();
|
||||
this.Scale = json["scaleString"]["value"].ToString();
|
||||
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<String, String, Single>(this.Type, this.Scale, this.Level), this.LastUpdate, this));
|
||||
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<String, String, Double>(this.Type, this.Scale, this.Level), this.LastUpdate, this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level.ToString() },
|
||||
{ "level", this.Level },
|
||||
{ "type", this.Type },
|
||||
{ "scale", this.Scale },
|
||||
};
|
||||
|
@ -10,20 +10,20 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
class Thermostatsetpointsub : ACommandClass {
|
||||
public override event UpdatedValue Update;
|
||||
|
||||
private Single _level;
|
||||
public Single Level {
|
||||
private Double _level;
|
||||
public Double Level {
|
||||
get {
|
||||
return this._level;
|
||||
}
|
||||
set {
|
||||
if (!this.HasMinMax || (this.HasMinMax && value >= this.TempMin && value <= this.TempMax)) {
|
||||
this.SetTuple(this.SensorId, (Single)Math.Round(value * 2, MidpointRounding.AwayFromZero) / 2);
|
||||
this.SetTuple(this.SensorId, (Double)Math.Round(value * 2, MidpointRounding.AwayFromZero) / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
public String Scale { get; private set; }
|
||||
public Single TempMax { get; private set; }
|
||||
public Single TempMin { get; private set; }
|
||||
public Double TempMax { get; private set; }
|
||||
public Double TempMin { get; private set; }
|
||||
public Boolean HasMinMax { get; private set; }
|
||||
public String Type { get; private set; }
|
||||
|
||||
@ -37,13 +37,13 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
json.Keys.Contains("val") && json["val"].Keys.Contains("value") &&
|
||||
json.Keys.Contains("deviceScaleString") && json["deviceScaleString"].Keys.Contains("value")) {
|
||||
this.Type = json["modeName"]["value"].ToString();
|
||||
this._level = Single.Parse(json["val"]["value"].ToString());
|
||||
this._level = Double.Parse(json["val"]["value"].ToString());
|
||||
this.Scale = json["deviceScaleString"]["value"].ToString();
|
||||
}
|
||||
if (json.Keys.Contains("min") && json["min"].Keys.Contains("value") &&
|
||||
json.Keys.Contains("max") && json["max"].Keys.Contains("value")) {
|
||||
this.TempMin = Single.Parse(json["min"]["value"].ToString());
|
||||
this.TempMax = Single.Parse(json["max"]["value"].ToString());
|
||||
this.TempMin = Double.Parse(json["min"]["value"].ToString());
|
||||
this.TempMax = Double.Parse(json["max"]["value"].ToString());
|
||||
this.HasMinMax = true;
|
||||
} else {
|
||||
this.HasMinMax = false;
|
||||
@ -55,22 +55,22 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
if (json.Keys.Contains("val") && json["val"].Keys.Contains("value") &&
|
||||
json.Keys.Contains("deviceScaleString") && json["deviceScaleString"].Keys.Contains("value") &&
|
||||
json.Keys.Contains("modeName") && json["modeName"].Keys.Contains("value")) {
|
||||
this._level = Single.Parse(json["val"]["value"].ToString());
|
||||
this._level = Double.Parse(json["val"]["value"].ToString());
|
||||
this.Scale = json["deviceScaleString"]["value"].ToString();
|
||||
this.Type = json["modeName"]["value"].ToString();
|
||||
ret = true;
|
||||
}
|
||||
if (json.Keys.Contains("min") && json["val"].Keys.Contains("value") &&
|
||||
json.Keys.Contains("max") && json["max"].Keys.Contains("value")) {
|
||||
this.TempMin = Single.Parse(json["min"]["value"].ToString());
|
||||
this.TempMax = Single.Parse(json["max"]["value"].ToString());
|
||||
this.TempMin = Double.Parse(json["min"]["value"].ToString());
|
||||
this.TempMax = Double.Parse(json["max"]["value"].ToString());
|
||||
this.HasMinMax = true;
|
||||
ret = true;
|
||||
} else {
|
||||
this.HasMinMax = false;
|
||||
}
|
||||
if (ret && this.CheckSetUpdateTime(json)) {
|
||||
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<String, String, Single, Single, Single, Boolean>(this.Type, this.Scale, this.Level, this.TempMin, this.TempMax, this.HasMinMax), this.LastUpdate, this));
|
||||
this.Update?.Invoke(this, new DeviceUpdateEvent(new Tuple<String, String, Double, Double, Double, Boolean>(this.Type, this.Scale, this.Level, this.TempMin, this.TempMax, this.HasMinMax), this.LastUpdate, this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,12 +82,12 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level.ToString() },
|
||||
{ "level", this.Level },
|
||||
{ "type", this.Type },
|
||||
{ "scale", this.Scale },
|
||||
{ "tempmax", this.TempMax.ToString() },
|
||||
{ "tempmin", this.TempMin.ToString() },
|
||||
{ "hasminmax", this.HasMinMax.ToString() },
|
||||
{ "tempmax", this.TempMax },
|
||||
{ "tempmin", this.TempMin },
|
||||
{ "hasminmax", this.HasMinMax },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level.ToString() },
|
||||
{ "level", this.Level },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level.ToString() }
|
||||
{ "level", this.Level }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "level", this.Level.ToString() }
|
||||
{ "level", this.Level }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
modes.Add(item.Key.ToString(), item.Value);
|
||||
}
|
||||
Dictionary<String, Object> json = new Dictionary<String, Object> {
|
||||
{ "level", this.Level.ToString() },
|
||||
{ "level", this.Level },
|
||||
{ "modes", modes }
|
||||
};
|
||||
return json;
|
||||
|
@ -124,9 +124,11 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() {
|
||||
return new Dictionary<String, Object> {
|
||||
{ "wakeupmin", this.WakeupMin.ToString() },
|
||||
{ "wakeupmax", this.WakeupMax.ToString() },
|
||||
{ "wakeupdefault", this.WakeupDefault.ToString() },
|
||||
{"interval", this.Interval },
|
||||
{"againstnode", this.AgainstNode },
|
||||
{ "wakeupmin", this.WakeupMin },
|
||||
{ "wakeupmax", this.WakeupMax },
|
||||
{ "wakeupdefault", this.WakeupDefault },
|
||||
{ "lastwakeup", this.LastWakeup.ToString() },
|
||||
{ "lastsleep", this.LastSleep.ToString() }
|
||||
};
|
||||
|
@ -10,8 +10,8 @@ namespace BlubbFish.IoT.Zway.Events {
|
||||
public DeviceUpdateEvent() {
|
||||
}
|
||||
|
||||
public DeviceUpdateEvent(Single value, DateTime time, Object parent) {
|
||||
this.GetSingle = value;
|
||||
public DeviceUpdateEvent(Double value, DateTime time, Object parent) {
|
||||
this.GetDouble = value;
|
||||
this.UpdateTime = time;
|
||||
this.Parent = parent;
|
||||
}
|
||||
@ -28,13 +28,13 @@ namespace BlubbFish.IoT.Zway.Events {
|
||||
this.Parent = parent;
|
||||
}
|
||||
|
||||
public DeviceUpdateEvent(Tuple<String, String, Single> value, DateTime time, Object parent) {
|
||||
this.GetStringStringSingleTuple = value;
|
||||
public DeviceUpdateEvent(Tuple<String, String, Double> value, DateTime time, Object parent) {
|
||||
this.GetStringStringDoubleTuple = value;
|
||||
this.UpdateTime = time;
|
||||
this.Parent = parent;
|
||||
}
|
||||
public DeviceUpdateEvent(Tuple<String, String, Single, Single, Single, Boolean> value, DateTime time, Object parent) {
|
||||
this.GetStringStringSingleSingleSingleSingleBooleanTuple = value;
|
||||
public DeviceUpdateEvent(Tuple<String, String, Double, Double, Double, Boolean> value, DateTime time, Object parent) {
|
||||
this.GetStringStringDoubleDoubleDoubleDoubleBooleanTuple = value;
|
||||
this.UpdateTime = time;
|
||||
this.Parent = parent;
|
||||
}
|
||||
@ -51,10 +51,10 @@ namespace BlubbFish.IoT.Zway.Events {
|
||||
this.Parent = parent;
|
||||
}
|
||||
|
||||
public Single GetSingle { get; }
|
||||
public Double GetDouble { get; }
|
||||
public DateTime GetDate { get; }
|
||||
public Tuple<String, String, Single> GetStringStringSingleTuple { get; }
|
||||
public Tuple<String, String, Single, Single, Single, Boolean> GetStringStringSingleSingleSingleSingleBooleanTuple { get; }
|
||||
public Tuple<String, String, Double> GetStringStringDoubleTuple { get; }
|
||||
public Tuple<String, String, Double, Double, Double, Boolean> GetStringStringDoubleDoubleDoubleDoubleBooleanTuple { get; }
|
||||
public Tuple<Int64, Int32> GetLongIntegerTuple { get; }
|
||||
public DateTime UpdateTime { get; }
|
||||
public Object Parent { get; private set; }
|
||||
|
@ -172,11 +172,11 @@ namespace BlubbFish.IoT.Zway.Interfaces {
|
||||
this.http.GetVoid("ZWave.zway/Run/devices[" + this.DeviceId + "].instances[" + this.Instance + "].commandClasses[" + ((Int32)this.Commandclass).ToString() + "].Set(" + value + ")");
|
||||
}
|
||||
|
||||
protected void SetTuple(Single value1, Single value2) {
|
||||
protected void SetTuple(Double value1, Double value2) {
|
||||
this.http.GetVoid("ZWave.zway/Run/devices[" + this.DeviceId + "].instances[" + this.Instance + "].commandClasses[" + ((Int32)this.Commandclass).ToString() + "].Set(" + value1 + "," + value2 + ")");
|
||||
}
|
||||
|
||||
protected void SetTuple(Int32 v1, Int32 v2) => this.SetTuple(v1, (Single)v2);
|
||||
protected void SetTuple(Int32 v1, Int32 v2) => this.SetTuple(v1, (Double)v2);
|
||||
|
||||
protected Boolean CheckSetUpdateTime(JsonData json) {
|
||||
if (json.Keys.Contains("updateTime") && (json["updateTime"].IsInt || json["updateTime"].IsLong)) {
|
||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
// indem Sie "*" wie unten gezeigt eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.3.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.0.0")]
|
||||
[assembly: AssemblyVersion("1.3.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.1.0")]
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user