[NF] Now creating correct Senml for Linksmart
This commit is contained in:
parent
91a05f882e
commit
a1009b5293
@ -9,12 +9,14 @@ namespace ZwayBot.Moduls {
|
|||||||
class Senml : AModul {
|
class Senml : AModul {
|
||||||
public override event ModulEvent Update;
|
public override event ModulEvent Update;
|
||||||
private ADataBackend mqtt;
|
private ADataBackend mqtt;
|
||||||
|
private string SenmlGuid;
|
||||||
|
|
||||||
public Senml(ZwayController zway, InIReader settings) : base(zway, settings) {
|
public Senml(ZwayController zway, InIReader settings) : base(zway, settings) {
|
||||||
if (this.config.ContainsKey("settings")) {
|
if (this.config.ContainsKey("settings")) {
|
||||||
this.mqtt = ADataBackend.GetInstance(this.config["settings"]);
|
this.mqtt = ADataBackend.GetInstance(this.config["settings"]);
|
||||||
this.mqtt.MessageIncomming += this.EventInput;
|
this.mqtt.MessageIncomming += this.EventInput;
|
||||||
this.zw.Update += this.EventOutput;
|
this.zw.Update += this.EventOutput;
|
||||||
|
this.SenmlGuid = Guid.NewGuid().ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +26,7 @@ namespace ZwayBot.Moduls {
|
|||||||
String data = "";
|
String data = "";
|
||||||
if (e.Parent.HasInterface(typeof(ISenml))) {
|
if (e.Parent.HasInterface(typeof(ISenml))) {
|
||||||
ISenml sensor = (ISenml)e.Parent;
|
ISenml sensor = (ISenml)e.Parent;
|
||||||
topic = "/senml/" + sensor.SenmlTopic();
|
topic = sensor.SenmlTopic() + this.SenmlGuid+ "/senml";
|
||||||
data = sensor.ToSenml();
|
data = sensor.ToSenml();
|
||||||
}
|
}
|
||||||
if (topic != "" && data != null && data != "") {
|
if (topic != "" && data != null && data != "") {
|
||||||
|
Loading…
Reference in New Issue
Block a user