mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 09:41:19 +00:00
Model Automation (WIP) + Mqtt service logic explanation
This commit is contained in:
parent
3d4f265e89
commit
0139257a28
Binary file not shown.
Binary file not shown.
44
MyCore/Models/Automation.cs
Normal file
44
MyCore/Models/Automation.cs
Normal file
@ -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<Declencheur> Declencheurs { get; set; }
|
||||
public List<Condition> Conditions { get; set; }
|
||||
public List<Action> 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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":
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user