mirror of
https://github.com/excaliburpartners/OmniLinkBridge
synced 2024-12-22 18:52:24 +00:00
1.1.10 - Add MQTT zone bypass switch discovery
This commit is contained in:
parent
37aed0e891
commit
92012fc0b7
|
@ -275,6 +275,21 @@ namespace OmniLinkBridge.MQTT
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Switch ToConfigSwitch(this clsZone zone)
|
||||||
|
{
|
||||||
|
Switch ret = new Switch
|
||||||
|
{
|
||||||
|
unique_id = $"{Global.mqtt_prefix}zone{zone.Number}switch",
|
||||||
|
name = $"{Global.mqtt_discovery_name_prefix}{zone.Name} Bypass",
|
||||||
|
state_topic = zone.ToTopic(Topic.state),
|
||||||
|
command_topic = zone.ToTopic(Topic.command),
|
||||||
|
payload_off = "restore",
|
||||||
|
payload_on = "bypass",
|
||||||
|
value_template = "{% if value == 'bypassed' %} bypass {%- else -%} restore {%- endif %}"
|
||||||
|
};
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
public static BinarySensor ToConfig(this clsZone zone)
|
public static BinarySensor ToConfig(this clsZone zone)
|
||||||
{
|
{
|
||||||
BinarySensor ret = new BinarySensor
|
BinarySensor ret = new BinarySensor
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
namespace OmniLinkBridge.MQTT
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace OmniLinkBridge.MQTT
|
||||||
{
|
{
|
||||||
public class Switch : Device
|
public class Switch : Device
|
||||||
{
|
{
|
||||||
public string command_topic { get; set; }
|
public string command_topic { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string payload_off { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string payload_on { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string value_template { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,6 +277,7 @@ namespace OmniLinkBridge.Modules
|
||||||
{
|
{
|
||||||
PublishAsync($"{Global.mqtt_discovery_prefix}/binary_sensor/{Global.mqtt_prefix}/zone{i}/config", null);
|
PublishAsync($"{Global.mqtt_discovery_prefix}/binary_sensor/{Global.mqtt_prefix}/zone{i}/config", null);
|
||||||
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/zone{i}/config", null);
|
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/zone{i}/config", null);
|
||||||
|
PublishAsync($"{Global.mqtt_discovery_prefix}/switch/{Global.mqtt_prefix}/zone{i}/config", null);
|
||||||
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/zone{i}temp/config", null);
|
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/zone{i}temp/config", null);
|
||||||
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/zone{i}humidity/config", null);
|
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/zone{i}humidity/config", null);
|
||||||
continue;
|
continue;
|
||||||
|
@ -286,6 +287,8 @@ namespace OmniLinkBridge.Modules
|
||||||
JsonConvert.SerializeObject(zone.ToConfig()));
|
JsonConvert.SerializeObject(zone.ToConfig()));
|
||||||
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/zone{i}/config",
|
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/zone{i}/config",
|
||||||
JsonConvert.SerializeObject(zone.ToConfigSensor()));
|
JsonConvert.SerializeObject(zone.ToConfigSensor()));
|
||||||
|
PublishAsync($"{Global.mqtt_discovery_prefix}/switch/{Global.mqtt_prefix}/zone{i}/config",
|
||||||
|
JsonConvert.SerializeObject(zone.ToConfigSwitch()));
|
||||||
|
|
||||||
if (zone.IsTemperatureZone())
|
if (zone.IsTemperatureZone())
|
||||||
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/zone{i}temp/config",
|
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/zone{i}temp/config",
|
||||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.1.9.0")]
|
[assembly: AssemblyVersion("1.1.10.0")]
|
||||||
[assembly: AssemblyFileVersion("1.1.9.0")]
|
[assembly: AssemblyFileVersion("1.1.10.0")]
|
||||||
|
|
Loading…
Reference in a new issue