[NF] Komplette Umbenennung
This commit is contained in:
parent
4889d3769b
commit
3ac9fb2e32
@ -1,9 +1,9 @@
|
|||||||
using Dashboard.Sensor;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Dashboard.Connector;
|
using IoTBot.Connector;
|
||||||
|
using IoTBot.Sensor;
|
||||||
|
|
||||||
namespace MqttToTelegram.Condition {
|
namespace IoTBot.Condition {
|
||||||
abstract class ACondition {
|
abstract class ACondition {
|
||||||
protected ASensor sensor;
|
protected ASensor sensor;
|
||||||
protected Dictionary<String, String> settings;
|
protected Dictionary<String, String> settings;
|
||||||
@ -24,7 +24,7 @@ namespace MqttToTelegram.Condition {
|
|||||||
protected abstract void Sensor_Update(Object sender, EventArgs e);
|
protected abstract void Sensor_Update(Object sender, EventArgs e);
|
||||||
|
|
||||||
public static ACondition GetInstance(Dictionary<String, String> settings, ADataBackend backend) {
|
public static ACondition GetInstance(Dictionary<String, String> settings, ADataBackend backend) {
|
||||||
String object_condition = "MqttToTelegram.Condition." + Char.ToUpper(settings["type"][0]) + settings["type"].Substring(1).ToLower();
|
String object_condition = "IoTBot.Condition." + Char.ToUpper(settings["type"][0]) + settings["type"].Substring(1).ToLower();
|
||||||
Type t = null;
|
Type t = null;
|
||||||
try {
|
try {
|
||||||
t = Type.GetType(object_condition, true);
|
t = Type.GetType(object_condition, true);
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Dashboard.Connector;
|
using IoTBot.Connector;
|
||||||
|
using IoTBot.Sensor;
|
||||||
|
|
||||||
namespace MqttToTelegram.Condition {
|
namespace IoTBot.Condition {
|
||||||
class Edge : ACondition {
|
class Edge : ACondition {
|
||||||
private Boolean histBool;
|
private Boolean histBool;
|
||||||
|
|
||||||
@ -11,10 +12,10 @@ namespace MqttToTelegram.Condition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override void Sensor_Update(Object sender, EventArgs e) {
|
protected override void Sensor_Update(Object sender, EventArgs e) {
|
||||||
if(this.sensor.Datatypes == Dashboard.Sensor.ASensor.Types.Bool) {
|
if(this.sensor.Datatypes == ASensor.Types.Bool) {
|
||||||
if(this.sensor.GetBool == Boolean.Parse(this.settings["sensor_value"]) && this.histBool != this.sensor.GetBool) {
|
if(this.sensor.GetBool == Boolean.Parse(this.settings["sensor_value"]) && this.histBool != this.sensor.GetBool) {
|
||||||
this.histBool = this.sensor.GetBool;
|
this.histBool = this.sensor.GetBool;
|
||||||
Telegram.Instance.Send("Jemand ist DA!");
|
IoTBot.Connector.Telegram.Instance.Send("Jemand ist DA!");
|
||||||
} else {
|
} else {
|
||||||
this.histBool = this.sensor.GetBool;
|
this.histBool = this.sensor.GetBool;
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
using BlubbFish.Utils;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Dashboard.Connector;
|
using BlubbFish.Utils;
|
||||||
using MqttToTelegram.Condition;
|
using IoTBot.Condition;
|
||||||
|
using IoTBot.Connector;
|
||||||
|
|
||||||
namespace MqttToTelegram {
|
namespace IoTBot {
|
||||||
class ConditionWorker {
|
class ConditionWorker {
|
||||||
private InIReader ini;
|
private InIReader ini;
|
||||||
private static ConditionWorker instance;
|
private static ConditionWorker instance;
|
||||||
private List<ACondition> conditions;
|
private List<ACondition> conditions;
|
||||||
private Telegram telegram;
|
private Connector.Telegram telegram;
|
||||||
|
|
||||||
public static ConditionWorker GetInstance(ADataBackend backend) {
|
public static ConditionWorker GetInstance(ADataBackend backend) {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
@ -18,7 +18,7 @@ namespace MqttToTelegram {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Run(Telegram telegram) {
|
internal void Run(Connector.Telegram telegram) {
|
||||||
this.telegram = telegram;
|
this.telegram = telegram;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
|
<None Include="condition.ini.example" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="settings.ini.example" />
|
<None Include="settings.ini.example" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
using System;
|
using System;
|
||||||
using BlubbFish.Utils;
|
using BlubbFish.Utils;
|
||||||
using Dashboard.Connector;
|
using IoTBot.Connector;
|
||||||
|
|
||||||
namespace MqttToTelegram {
|
namespace IoTBot {
|
||||||
class Program {
|
class Program {
|
||||||
static void Main(String[] args) {
|
static void Main(String[] args) {
|
||||||
ADataBackend mqtt = ADataBackend.GetInstance(InIReader.GetInstance("settings.ini").GetSection("mqtt"));
|
ADataBackend mqtt = ADataBackend.GetInstance(InIReader.GetInstance("settings.ini").GetSection("mqtt"));
|
||||||
ConditionWorker.GetInstance(mqtt).Run(Telegram.Instance);
|
ConditionWorker.GetInstance(mqtt).Run(Connector.Telegram.Instance);
|
||||||
mqtt.MessageIncomming += Mqtt_MessageIncomming;
|
mqtt.MessageIncomming += Mqtt_MessageIncomming;
|
||||||
mqtt.MessageSending += Mqtt_MessageSending;
|
mqtt.MessageSending += Mqtt_MessageSending;
|
||||||
Telegram.Instance.MessageIncomming += Telegram_MessageIncomming;
|
Connector.Telegram.Instance.MessageIncomming += Telegram_MessageIncomming;
|
||||||
Telegram.Instance.MessageSending += Telegram_MessageSending;
|
Connector.Telegram.Instance.MessageSending += Telegram_MessageSending;
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
System.Threading.Thread.Sleep(100);
|
System.Threading.Thread.Sleep(100);
|
||||||
|
4
IoT-Bot/condition.ini.example
Normal file
4
IoT-Bot/condition.ini.example
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[test]
|
||||||
|
type=Edge
|
||||||
|
sensor=Power
|
||||||
|
sensor_topic=/test/powersensor
|
Loading…
Reference in New Issue
Block a user