From 5cd6048dd536339dad8f90f7318935e6a7802699 Mon Sep 17 00:00:00 2001 From: Ryan Wagoner Date: Thu, 16 Dec 2021 23:33:42 -0500 Subject: [PATCH] Fix system trouble naming and discovery payloads --- OmniLinkBridge/MQTT/BinarySensor.cs | 6 ++++++ OmniLinkBridge/Modules/MQTTModule.cs | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/OmniLinkBridge/MQTT/BinarySensor.cs b/OmniLinkBridge/MQTT/BinarySensor.cs index dc8521a..8dc1370 100644 --- a/OmniLinkBridge/MQTT/BinarySensor.cs +++ b/OmniLinkBridge/MQTT/BinarySensor.cs @@ -27,5 +27,11 @@ namespace OmniLinkBridge.MQTT [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string value_template { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string payload_off { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string payload_on { get; set; } } } diff --git a/OmniLinkBridge/Modules/MQTTModule.cs b/OmniLinkBridge/Modules/MQTTModule.cs index 43b405f..104fc9a 100644 --- a/OmniLinkBridge/Modules/MQTTModule.cs +++ b/OmniLinkBridge/Modules/MQTTModule.cs @@ -187,7 +187,7 @@ namespace OmniLinkBridge.Modules PublishAsync(SystemTroubleTopic("phone"), OmniLink.TroublePhone ? "trouble" : "secure"); PublishAsync(SystemTroubleTopic("ac"), OmniLink.TroubleAC ? "trouble" : "secure"); PublishAsync(SystemTroubleTopic("battery"), OmniLink.TroubleBattery ? "trouble" : "secure"); - PublishAsync(SystemTroubleTopic("dcn"), OmniLink.TroubleDCM ? "trouble" : "secure"); + PublishAsync(SystemTroubleTopic("dcm"), OmniLink.TroubleDCM ? "trouble" : "secure"); } public string SystemTroubleTopic(string type) @@ -202,7 +202,9 @@ namespace OmniLinkBridge.Modules unique_id = $"{Global.mqtt_prefix}system{type}", name = $"{Global.mqtt_discovery_name_prefix}System {name}", state_topic = SystemTroubleTopic(type), - device_class = BinarySensor.DeviceClass.problem + device_class = BinarySensor.DeviceClass.problem, + payload_off = "secure", + payload_on = "trouble" }; }