MC add wakeup message handle + ok if config event

This commit is contained in:
Thomas Fransolet 2021-03-26 17:58:05 +01:00
parent d69799eb7e
commit 7a6e2b1540

View File

@ -78,18 +78,20 @@ namespace Mqtt.Client.AspNetCore.Services
// if wakeup => Not drop wakeup message
try
{
var deserialzed = JsonConvert.DeserializeObject<Dictionary<string, object>>(payload);
var deserialized = JsonConvert.DeserializeObject<Dictionary<string, object>>(payload);
if (deserialzed != null) {
isWakeUpMessage = (string)deserialzed["action"] == "wakeup";
if (deserialized != null) {
isWakeUpMessage = (string)deserialized["action"] == "wakeup";
}
} catch (Exception ex)
{
}
var configMessage = topic == "zigbee2mqtt/bridge/event";
// Less than one second between two messages from a same device
if (!(lastTopic == topic && test <= 500))
if (!(lastTopic == topic && test <= 500) || configMessage)
{
if (_actionService != null)
{