ProjectsOld/MqttToTelegram/MqttToTelegram/Sensor/Temperatur.cs
2017-09-26 21:44:41 +02:00

20 lines
580 B
C#

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using uPLibrary.Networking.M2Mqtt.Messages;
namespace Dashboard.Sensor {
class Temperatur : ASensor {
public Temperatur(Dictionary<String, String> settings) : base(settings) {
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"));
}
}
}