diff --git a/.vs/MyCore/v15/Server/sqlite3/storage.ide b/.vs/MyCore/v15/Server/sqlite3/storage.ide index 798d40a..ca14c19 100644 Binary files a/.vs/MyCore/v15/Server/sqlite3/storage.ide and b/.vs/MyCore/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/MyCore/v15/Server/sqlite3/storage.ide-wal b/.vs/MyCore/v15/Server/sqlite3/storage.ide-wal index 23a2bd2..049a2ce 100644 Binary files a/.vs/MyCore/v15/Server/sqlite3/storage.ide-wal and b/.vs/MyCore/v15/Server/sqlite3/storage.ide-wal differ diff --git a/MyCore/Models/Automation.cs b/MyCore/Models/Automation.cs new file mode 100644 index 0000000..bace742 --- /dev/null +++ b/MyCore/Models/Automation.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MyCore.Models +{ + public class Automation + { + public string Id { get; set; } + public string Name { get; set; } + public List Declencheurs { get; set; } + public List Conditions { get; set; } + public List Actions { get; set; } + } + + public class Declencheur + { + public enum Type + { + MQTT, + WEB, + TIME + } + } + + public class Condition + { + public enum Type + { + STATE, + HOUR + } + } + + public class Action + { + public enum Type + { + DELAY, + DEVICE + } + } +} diff --git a/MyCore/Services/MQTTService.cs b/MyCore/Services/MQTTService.cs index c007da9..b8f208a 100644 --- a/MyCore/Services/MQTTService.cs +++ b/MyCore/Services/MQTTService.cs @@ -104,6 +104,21 @@ namespace MyCore.Services var topic = e.ApplicationMessage.Topic; var payload = Encoding.UTF8.GetString(e.ApplicationMessage.Payload); + // TODO + + // Here take only zigbee2mqtt * + + // Check if we have the guid in database + + // If so retrieve the device in database and his Type + + // Retrieve the object + + // Check in the list of automations if we have something to do with the message + + // Load everydevice in cache.. ? Performance ? + + switch (topic) { case "zigbee2mqtt/0x00158d00029a7b65":