Fix system trouble naming and discovery payloads

This commit is contained in:
Ryan Wagoner 2021-12-16 23:33:42 -05:00
parent b5298a1e74
commit 5cd6048dd5
2 changed files with 10 additions and 2 deletions

View file

@ -27,5 +27,11 @@ namespace OmniLinkBridge.MQTT
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string value_template { get; set; } 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; }
} }
} }

View file

@ -187,7 +187,7 @@ namespace OmniLinkBridge.Modules
PublishAsync(SystemTroubleTopic("phone"), OmniLink.TroublePhone ? "trouble" : "secure"); PublishAsync(SystemTroubleTopic("phone"), OmniLink.TroublePhone ? "trouble" : "secure");
PublishAsync(SystemTroubleTopic("ac"), OmniLink.TroubleAC ? "trouble" : "secure"); PublishAsync(SystemTroubleTopic("ac"), OmniLink.TroubleAC ? "trouble" : "secure");
PublishAsync(SystemTroubleTopic("battery"), OmniLink.TroubleBattery ? "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) public string SystemTroubleTopic(string type)
@ -202,7 +202,9 @@ namespace OmniLinkBridge.Modules
unique_id = $"{Global.mqtt_prefix}system{type}", unique_id = $"{Global.mqtt_prefix}system{type}",
name = $"{Global.mqtt_discovery_name_prefix}System {name}", name = $"{Global.mqtt_discovery_name_prefix}System {name}",
state_topic = SystemTroubleTopic(type), state_topic = SystemTroubleTopic(type),
device_class = BinarySensor.DeviceClass.problem device_class = BinarySensor.DeviceClass.problem,
payload_off = "secure",
payload_on = "trouble"
}; };
} }