IoT-Bot/IoT-Bot/Condition/Edge.cs

25 lines
770 B
C#

using System;
using System.Collections.Generic;
using Dashboard.Connector;
namespace MqttToTelegram.Condition {
class Edge : ACondition {
private Boolean histBool;
public Edge(Dictionary<String, String> settings, ADataBackend backend) : base(settings, backend) {
}
protected override void Sensor_Update(Object sender, EventArgs e) {
if(this.sensor.Datatypes == Dashboard.Sensor.ASensor.Types.Bool) {
if(this.sensor.GetBool == Boolean.Parse(this.settings["sensor_value"]) && this.histBool != this.sensor.GetBool) {
this.histBool = this.sensor.GetBool;
Telegram.Instance.Send("Jemand ist DA!");
} else {
this.histBool = this.sensor.GetBool;
}
}
}
}
}