mirror of
https://github.com/excaliburpartners/OmniLinkBridge
synced 2025-01-01 23:08:24 +00:00
1.1.11 - Add MQTT thermostat humidify and dehumidify discovery
This commit is contained in:
parent
a8d965eb04
commit
2f652f7c8a
OmniLinkBridge
|
@ -433,6 +433,32 @@ namespace OmniLinkBridge.MQTT
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static Number ToConfigHumidify(this clsThermostat thermostat)
|
||||
{
|
||||
Number ret = new Number
|
||||
{
|
||||
unique_id = $"{Global.mqtt_prefix}thermostat{thermostat.Number}humidify",
|
||||
name = $"{Global.mqtt_discovery_name_prefix}{thermostat.Name} Humidify",
|
||||
icon = "mdi:water-percent",
|
||||
state_topic = thermostat.ToTopic(Topic.humidify_state),
|
||||
command_topic = thermostat.ToTopic(Topic.humidify_command),
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Number ToConfigDehumidify(this clsThermostat thermostat)
|
||||
{
|
||||
Number ret = new Number
|
||||
{
|
||||
unique_id = $"{Global.mqtt_prefix}thermostat{thermostat.Number}dehumidify",
|
||||
name = $"{Global.mqtt_discovery_name_prefix}{thermostat.Name} Dehumidify",
|
||||
icon = "mdi:water-percent",
|
||||
state_topic = thermostat.ToTopic(Topic.dehumidify_state),
|
||||
command_topic = thermostat.ToTopic(Topic.dehumidify_command),
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Sensor ToConfigHumidity(this clsThermostat thermostat)
|
||||
{
|
||||
Sensor ret = new Sensor
|
||||
|
|
12
OmniLinkBridge/MQTT/Number.cs
Normal file
12
OmniLinkBridge/MQTT/Number.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace OmniLinkBridge.MQTT
|
||||
{
|
||||
public class Number : Device
|
||||
{
|
||||
public string command_topic { get; set; }
|
||||
|
||||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string icon { get; set; }
|
||||
}
|
||||
}
|
|
@ -200,7 +200,7 @@ namespace OmniLinkBridge.Modules
|
|||
return new BinarySensor
|
||||
{
|
||||
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),
|
||||
device_class = BinarySensor.DeviceClass.problem
|
||||
};
|
||||
|
@ -345,6 +345,8 @@ namespace OmniLinkBridge.Modules
|
|||
{
|
||||
PublishAsync(thermostat.ToTopic(Topic.name), null);
|
||||
PublishAsync($"{Global.mqtt_discovery_prefix}/climate/{Global.mqtt_prefix}/thermostat{i}/config", null);
|
||||
PublishAsync($"{Global.mqtt_discovery_prefix}/number/{Global.mqtt_prefix}/thermostat{i}humidify/config", null);
|
||||
PublishAsync($"{Global.mqtt_discovery_prefix}/number/{Global.mqtt_prefix}/thermostat{i}dehumidify/config", null);
|
||||
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/thermostat{i}temp/config", null);
|
||||
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/thermostat{i}humidity/config", null);
|
||||
continue;
|
||||
|
@ -355,6 +357,10 @@ namespace OmniLinkBridge.Modules
|
|||
PublishAsync(thermostat.ToTopic(Topic.name), thermostat.Name);
|
||||
PublishAsync($"{Global.mqtt_discovery_prefix}/climate/{Global.mqtt_prefix}/thermostat{i}/config",
|
||||
JsonConvert.SerializeObject(thermostat.ToConfig(OmniLink.Controller.TempFormat)));
|
||||
PublishAsync($"{Global.mqtt_discovery_prefix}/number/{Global.mqtt_prefix}/thermostat{i}humidify/config",
|
||||
JsonConvert.SerializeObject(thermostat.ToConfigHumidify()));
|
||||
PublishAsync($"{Global.mqtt_discovery_prefix}/number/{Global.mqtt_prefix}/thermostat{i}dehumidify/config",
|
||||
JsonConvert.SerializeObject(thermostat.ToConfigDehumidify()));
|
||||
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/thermostat{i}temp/config",
|
||||
JsonConvert.SerializeObject(thermostat.ToConfigTemp(OmniLink.Controller.TempFormat)));
|
||||
PublishAsync($"{Global.mqtt_discovery_prefix}/sensor/{Global.mqtt_prefix}/thermostat{i}humidity/config",
|
||||
|
|
|
@ -93,6 +93,7 @@
|
|||
<Compile Include="MQTT\DeviceRegistry.cs" />
|
||||
<Compile Include="MQTT\MessageCommands.cs" />
|
||||
<Compile Include="MQTT\MessageProcessor.cs" />
|
||||
<Compile Include="MQTT\Number.cs" />
|
||||
<Compile Include="MQTT\OverrideZone.cs" />
|
||||
<Compile Include="MQTT\Switch.cs" />
|
||||
<Compile Include="MQTT\Light.cs" />
|
||||
|
|
|
@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Excalibur Partners, LLC")]
|
||||
[assembly: AssemblyProduct("OmniLinkBridge")]
|
||||
[assembly: AssemblyCopyright("Copyright © Excalibur Partners, LLC 2020")]
|
||||
[assembly: AssemblyCopyright("Copyright © Excalibur Partners, LLC 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.1.10.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.10.0")]
|
||||
[assembly: AssemblyVersion("1.1.11.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.11.0")]
|
||||
|
|
Loading…
Reference in a new issue