[NF] Create Senml Messages for Linksmart
This commit is contained in:
@@ -6,6 +6,7 @@ using BlubbFish.IoT.Zway.Devices.CommandClasses.CommandClassSubs;
|
||||
using BlubbFish.IoT.Zway.Events;
|
||||
using BlubbFish.IoT.Zway.Interfaces;
|
||||
using BlubbFish.IoT.Zway.lib;
|
||||
using BlubbFish.Utils.IoT.Interfaces.Language;
|
||||
using LitJson;
|
||||
|
||||
namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
@@ -15,6 +16,7 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
public class Scenecontrollerconf : ACommandClass {
|
||||
public override event UpdatedValue Update;
|
||||
|
||||
#region Constructor
|
||||
public Scenecontrollerconf(JsonData json, Tuple<Int32, Int32, Classes> id, HttpConnection http, Boolean polling) : base(json, id, http, polling) {
|
||||
this.HasSub = true;
|
||||
this.InitComplex(json);
|
||||
@@ -23,21 +25,6 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
}
|
||||
}
|
||||
|
||||
private void DeviceUpdate(Object sender, DeviceUpdateEvent e) {
|
||||
this.Update?.Invoke(this, e);
|
||||
}
|
||||
|
||||
internal override void SetUpdate(JsonData json, Match match) {
|
||||
if (match.Groups[4].Value.StartsWith(".data.")) {
|
||||
Int32 subid = Int32.Parse(match.Groups[5].Value);
|
||||
if (this.Sub.ContainsKey(subid)) {
|
||||
this.Sub[subid].SetUpdate(json, match);
|
||||
}
|
||||
} else {
|
||||
Helper.WriteError("Kenne in " + this.Name + " [" + this.Id + "] " + match.Groups[4].Value + " nicht!");
|
||||
}
|
||||
}
|
||||
|
||||
private void InitComplex(JsonData json) {
|
||||
if (json.Keys.Contains("data")) {
|
||||
JsonData data = json["data"];
|
||||
@@ -53,8 +40,30 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
|
||||
}
|
||||
}
|
||||
|
||||
private void DeviceUpdate(Object sender, DeviceUpdateEvent e) {
|
||||
this.Update?.Invoke(this, e);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ACommandClass
|
||||
internal override void SetUpdate(JsonData json, Match match) {
|
||||
if (match.Groups[4].Value.StartsWith(".data.")) {
|
||||
Int32 subid = Int32.Parse(match.Groups[5].Value);
|
||||
if (this.Sub.ContainsKey(subid)) {
|
||||
this.Sub[subid].SetUpdate(json, match);
|
||||
}
|
||||
} else {
|
||||
Helper.WriteError("Kenne in " + this.Name + " [" + this.Id + "] " + match.Groups[4].Value + " nicht!");
|
||||
}
|
||||
}
|
||||
|
||||
internal override void Poll() => this.PollPerSub();
|
||||
|
||||
public override Dictionary<String, Object> ToDictionary() => this.ToDictionarySub();
|
||||
#endregion
|
||||
|
||||
#region ISenml
|
||||
protected override List<Senml> ToSenmlList() => this.ToSenmlListSub();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user