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 // if wakeup => Not drop wakeup message
try try
{ {
var deserialzed = JsonConvert.DeserializeObject<Dictionary<string, object>>(payload); var deserialized = JsonConvert.DeserializeObject<Dictionary<string, object>>(payload);
if (deserialzed != null) { if (deserialized != null) {
isWakeUpMessage = (string)deserialzed["action"] == "wakeup"; isWakeUpMessage = (string)deserialized["action"] == "wakeup";
} }
} catch (Exception ex) } catch (Exception ex)
{ {
} }
var configMessage = topic == "zigbee2mqtt/bridge/event";
// Less than one second between two messages from a same device // 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) if (_actionService != null)
{ {