From ff02e1fd4402ac307ef2b82e275f1ca505347066 Mon Sep 17 00:00:00 2001 From: Ryan Wagoner Date: Sun, 27 Oct 2019 21:42:46 -0400 Subject: [PATCH] - Fix MQTT id validation and add notice for publishing to area 0 --- OmniLinkBridge/Modules/MQTTModule.cs | 18 +++++++++++++----- OmniLinkBridge/Properties/AssemblyInfo.cs | 6 +++--- OmniLinkBridgeTest/Properties/AssemblyInfo.cs | 2 +- README.md | 8 +++++++- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/OmniLinkBridge/Modules/MQTTModule.cs b/OmniLinkBridge/Modules/MQTTModule.cs index 8cfc59a..c248c5f 100644 --- a/OmniLinkBridge/Modules/MQTTModule.cs +++ b/OmniLinkBridge/Modules/MQTTModule.cs @@ -95,23 +95,31 @@ namespace OmniLinkBridge.Modules log.Debug($"Received: Type: {match.Groups[1].Value}, Id: {match.Groups[2].Value}, Command: {match.Groups[3].Value}, Value: {payload}"); - if (match.Groups[1].Value == "area" && ushort.TryParse(match.Groups[2].Value, out ushort areaId) && areaId < OmniLink.Controller.Areas.Count) + if (match.Groups[1].Value == "area" && ushort.TryParse(match.Groups[2].Value, out ushort areaId) && + areaId <= OmniLink.Controller.Areas.Count) { + if(areaId == 0) + log.Debug("SetArea: 0 implies all areas will be changed"); + ProcessAreaReceived(OmniLink.Controller.Areas[areaId], match.Groups[3].Value, payload); } - if (match.Groups[1].Value == "zone" && ushort.TryParse(match.Groups[2].Value, out ushort zoneId) && zoneId < OmniLink.Controller.Zones.Count) + if (match.Groups[1].Value == "zone" && ushort.TryParse(match.Groups[2].Value, out ushort zoneId) && + zoneId > 0 && zoneId <= OmniLink.Controller.Zones.Count) { ProcessZoneReceived(OmniLink.Controller.Zones[zoneId], match.Groups[3].Value, payload); } - else if (match.Groups[1].Value == "unit" && ushort.TryParse(match.Groups[2].Value, out ushort unitId) && unitId < OmniLink.Controller.Units.Count) + else if (match.Groups[1].Value == "unit" && ushort.TryParse(match.Groups[2].Value, out ushort unitId) && + unitId > 0 && unitId <= OmniLink.Controller.Units.Count) { ProcessUnitReceived(OmniLink.Controller.Units[unitId], match.Groups[3].Value, payload); } - else if (match.Groups[1].Value == "thermostat" && ushort.TryParse(match.Groups[2].Value, out ushort thermostatId) && thermostatId < OmniLink.Controller.Thermostats.Count) + else if (match.Groups[1].Value == "thermostat" && ushort.TryParse(match.Groups[2].Value, out ushort thermostatId) && + thermostatId > 0 && thermostatId <= OmniLink.Controller.Thermostats.Count) { ProcessThermostatReceived(OmniLink.Controller.Thermostats[thermostatId], match.Groups[3].Value, payload); } - else if (match.Groups[1].Value == "button" && ushort.TryParse(match.Groups[2].Value, out ushort buttonId) && buttonId < OmniLink.Controller.Buttons.Count) + else if (match.Groups[1].Value == "button" && ushort.TryParse(match.Groups[2].Value, out ushort buttonId) && + buttonId > 0 && buttonId <= OmniLink.Controller.Buttons.Count) { ProcessButtonReceived(OmniLink.Controller.Buttons[buttonId], match.Groups[3].Value, payload); } diff --git a/OmniLinkBridge/Properties/AssemblyInfo.cs b/OmniLinkBridge/Properties/AssemblyInfo.cs index a2cc211..7eda995 100644 --- a/OmniLinkBridge/Properties/AssemblyInfo.cs +++ b/OmniLinkBridge/Properties/AssemblyInfo.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 2018")] +[assembly: AssemblyCopyright("Copyright © Excalibur Partners, LLC 2019")] [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.3.0")] -[assembly: AssemblyFileVersion("1.1.3.0")] +[assembly: AssemblyVersion("1.1.4.0")] +[assembly: AssemblyFileVersion("1.1.4.0")] diff --git a/OmniLinkBridgeTest/Properties/AssemblyInfo.cs b/OmniLinkBridgeTest/Properties/AssemblyInfo.cs index 15ac401..f731ab7 100644 --- a/OmniLinkBridgeTest/Properties/AssemblyInfo.cs +++ b/OmniLinkBridgeTest/Properties/AssemblyInfo.cs @@ -7,7 +7,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Excalibur Partners, LLC")] [assembly: AssemblyProduct("OmniLinkBridgeTest")] -[assembly: AssemblyCopyright("Copyright © Excalibur Partners, LLC 2018")] +[assembly: AssemblyCopyright("Copyright © Excalibur Partners, LLC 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/README.md b/README.md index 7f16228..2658dca 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Provides MQTT bridge, web service API, time sync, and logging for [HAI/Leviton OmniPro II controllers](https://www.leviton.com/en/products/brands/omni-security-automation). Provides integration with [Samsung SmarthThings via web service API](https://github.com/excaliburpartners/SmartThings-OmniPro) and [Home Assistant via MQTT](https://www.home-assistant.io/components/mqtt/). ## Download -You can use docker to build an image from git or download the [binary here](http://www.excalibur-partners.com/downloads/OmniLinkBridge_1_1_3.zip). +You can use docker to build an image from git or download the [binary here](http://www.excalibur-partners.com/downloads/OmniLinkBridge_1_1_4.zip). ## Requirements - [Docker](https://www.docker.com/) @@ -182,6 +182,12 @@ string ON ``` ## Change Log +Version 1.1.4 - 2019-10-27 +- Utilize controller temperature format +- Ignore invalid temperature for thermostats +- Fix MQTT id validation and add notice for areas +- Fix compatibility with Home Assistant 0.95.4 MQTT extra keys + Version 1.1.3 - 2019-02-10 - Publish config when reconnecting to MQTT - Update readme documentation