Kleine Fehler behoben
This commit is contained in:
parent
27f12d5bae
commit
ef55750312
@ -1,20 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using uPLibrary.Networking.M2Mqtt.Messages;
|
||||
using Dashboard.Connector;
|
||||
|
||||
namespace Dashboard.Sensor {
|
||||
class Luminanz : ASensor {
|
||||
public Luminanz(Dictionary<String, String> settings) : base(settings) {
|
||||
public Luminanz(Dictionary<String, String> settings, String name, ADataBackend backend) : base(settings, name, backend) {
|
||||
this.GetBool = true;
|
||||
this.GetFloat = 0.0f;
|
||||
this.GetInt = 0;
|
||||
this.Datatypes = Types.Int;
|
||||
}
|
||||
|
||||
protected override void UpdateValue(MqttMsgPublishEventArgs e) {
|
||||
this.GetInt = Int32.Parse(Encoding.UTF8.GetString(e.Message), new CultureInfo("en-US"));
|
||||
protected override Boolean UpdateValue(MqttEventArgs e) {
|
||||
this.GetInt = Int32.Parse(e.Message, new CultureInfo("en-US"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using uPLibrary.Networking.M2Mqtt.Messages;
|
||||
using Dashboard.Connector;
|
||||
|
||||
namespace Dashboard.Sensor {
|
||||
class Pir : ASensor {
|
||||
public Pir(Dictionary<String, String> settings) : base(settings) {
|
||||
public Pir(Dictionary<String, String> settings, String name, ADataBackend backend) : base(settings, name, backend) {
|
||||
this.Datatypes = Types.Bool;
|
||||
}
|
||||
|
||||
protected override void UpdateValue(MqttMsgPublishEventArgs e) {
|
||||
this.GetBool = (Encoding.UTF8.GetString(e.Message).ToLower() == "on") ? true : false;
|
||||
protected override Boolean UpdateValue(MqttEventArgs e) {
|
||||
this.GetBool = (e.Message.ToLower() == "on") ? true : false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,20 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using uPLibrary.Networking.M2Mqtt.Messages;
|
||||
using Dashboard.Connector;
|
||||
|
||||
namespace Dashboard.Sensor {
|
||||
class Temperatur : ASensor {
|
||||
public Temperatur(Dictionary<String, String> settings) : base(settings) {
|
||||
public Temperatur(Dictionary<String, String> settings, String name, ADataBackend backend) : base(settings, name, backend) {
|
||||
this.GetBool = true;
|
||||
this.GetFloat = 0.0f;
|
||||
this.GetInt = 0;
|
||||
this.Datatypes = Types.Float;
|
||||
}
|
||||
|
||||
protected override void UpdateValue(MqttMsgPublishEventArgs e) {
|
||||
this.GetFloat = Single.Parse(Encoding.UTF8.GetString(e.Message), new CultureInfo("en-US"));
|
||||
protected override Boolean UpdateValue(MqttEventArgs e) {
|
||||
this.GetFloat = Single.Parse(e.Message, new CultureInfo("en-US"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user