diff --git a/OmniLinkBridge/MQTT/MappingExtensions.cs b/OmniLinkBridge/MQTT/MappingExtensions.cs index 942508d..7691ccf 100644 --- a/OmniLinkBridge/MQTT/MappingExtensions.cs +++ b/OmniLinkBridge/MQTT/MappingExtensions.cs @@ -433,6 +433,32 @@ public static Sensor ToConfigTemp(this clsThermostat thermostat, enuTempFormat f 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 diff --git a/OmniLinkBridge/MQTT/Number.cs b/OmniLinkBridge/MQTT/Number.cs new file mode 100644 index 0000000..7f98065 --- /dev/null +++ b/OmniLinkBridge/MQTT/Number.cs @@ -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; } + } +} diff --git a/OmniLinkBridge/Modules/MQTTModule.cs b/OmniLinkBridge/Modules/MQTTModule.cs index bb36444..c180346 100644 --- a/OmniLinkBridge/Modules/MQTTModule.cs +++ b/OmniLinkBridge/Modules/MQTTModule.cs @@ -200,7 +200,7 @@ public BinarySensor SystemTroubleConfig(string type, string name) 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 @@ private void PublishThermostats() { 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 @@ private void PublishThermostats() 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", diff --git a/OmniLinkBridge/OmniLinkBridge.csproj b/OmniLinkBridge/OmniLinkBridge.csproj index 51b3f46..b2796be 100644 --- a/OmniLinkBridge/OmniLinkBridge.csproj +++ b/OmniLinkBridge/OmniLinkBridge.csproj @@ -93,6 +93,7 @@ + diff --git a/OmniLinkBridge/Properties/AssemblyInfo.cs b/OmniLinkBridge/Properties/AssemblyInfo.cs index 1fd737e..4a81ecb 100644 --- a/OmniLinkBridge/Properties/AssemblyInfo.cs +++ b/OmniLinkBridge/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [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 @@ // 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")]