mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 01:31:19 +00:00
MC Add active statsu to automation + send zigbee request no matter the state
This commit is contained in:
parent
7a6e2b1540
commit
9c5bc07531
@ -10,6 +10,7 @@ namespace MyCore.Interfaces.DTO
|
|||||||
{
|
{
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
public bool Active { get; set; }
|
||||||
public string UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
public DateTime CreatedDate { get; set; }
|
public DateTime CreatedDate { get; set; }
|
||||||
public DateTime UpdatedDate { get; set; }
|
public DateTime UpdatedDate { get; set; }
|
||||||
|
|||||||
@ -23,6 +23,10 @@ namespace MyCore.Interfaces.Models
|
|||||||
[BsonRequired]
|
[BsonRequired]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[BsonElement("Active")]
|
||||||
|
[BsonRequired]
|
||||||
|
public bool Active { get; set; }
|
||||||
|
|
||||||
[BsonElement("CreatedDate")]
|
[BsonElement("CreatedDate")]
|
||||||
public DateTime CreatedDate { get; set; }
|
public DateTime CreatedDate { get; set; }
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ namespace MyCore.Service.Services
|
|||||||
|
|
||||||
automation.UserId = userId;
|
automation.UserId = userId;
|
||||||
automation.Name = automationCreateOrUpdateDetailDTO.Name;
|
automation.Name = automationCreateOrUpdateDetailDTO.Name;
|
||||||
|
automation.Active = automationCreateOrUpdateDetailDTO.Active;
|
||||||
automation.CreatedDate = create ? DateTime.Now : automation.CreatedDate;
|
automation.CreatedDate = create ? DateTime.Now : automation.CreatedDate;
|
||||||
automation.UpdatedDate = DateTime.Now;
|
automation.UpdatedDate = DateTime.Now;
|
||||||
automation.Triggers = automationCreateOrUpdateDetailDTO.Triggers;
|
automation.Triggers = automationCreateOrUpdateDetailDTO.Triggers;
|
||||||
|
|||||||
@ -406,13 +406,14 @@ namespace MyCore.Services.Devices
|
|||||||
System.Console.WriteLine($"Check Action in light|switch ! {state.Name} {state.Value}");
|
System.Console.WriteLine($"Check Action in light|switch ! {state.Name} {state.Value}");
|
||||||
if (actionDeviceExposeForFeatures.features.Any(ade => ade.name == state.Name))
|
if (actionDeviceExposeForFeatures.features.Any(ade => ade.name == state.Name))
|
||||||
{
|
{
|
||||||
if (dic.Count > 0)
|
// Comment this for test (ensure the request will be sent)
|
||||||
|
/*if (dic.Count > 0)
|
||||||
{
|
{
|
||||||
if (dic["state"].ToString().ToLower() == state.Value.ToLower() && action.States.Count <= 1) // workaround if brightness not the same
|
if (dic["state"].ToString().ToLower() == state.Value.ToLower() && action.States.Count <= 1) // workaround if brightness not the same
|
||||||
{
|
{
|
||||||
throw new Exception($"Action device is already at the good state : {state.Name} {state.Value}");
|
throw new Exception($"Action device is already at the good state : {state.Name} {state.Value}");
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// TODO clean this
|
// TODO clean this
|
||||||
if (state.Name == "brightness")
|
if (state.Name == "brightness")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user