- Fix MQTT id validation and add notice for publishing to area 0

This commit is contained in:
Ryan Wagoner 2019-10-27 21:42:46 -04:00
parent 151384c5b6
commit ff02e1fd44
4 changed files with 24 additions and 10 deletions

View file

@ -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}"); 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); 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); 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); 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); 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); ProcessButtonReceived(OmniLink.Controller.Buttons[buttonId], match.Groups[3].Value, payload);
} }

View file

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Excalibur Partners, LLC")] [assembly: AssemblyCompany("Excalibur Partners, LLC")]
[assembly: AssemblyProduct("OmniLinkBridge")] [assembly: AssemblyProduct("OmniLinkBridge")]
[assembly: AssemblyCopyright("Copyright © Excalibur Partners, LLC 2018")] [assembly: AssemblyCopyright("Copyright © Excalibur Partners, LLC 2019")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [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 // 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.3.0")] [assembly: AssemblyVersion("1.1.4.0")]
[assembly: AssemblyFileVersion("1.1.3.0")] [assembly: AssemblyFileVersion("1.1.4.0")]

View file

@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Excalibur Partners, LLC")] [assembly: AssemblyCompany("Excalibur Partners, LLC")]
[assembly: AssemblyProduct("OmniLinkBridgeTest")] [assembly: AssemblyProduct("OmniLinkBridgeTest")]
[assembly: AssemblyCopyright("Copyright © Excalibur Partners, LLC 2018")] [assembly: AssemblyCopyright("Copyright © Excalibur Partners, LLC 2019")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]

View file

@ -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/). 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 ## 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 ## Requirements
- [Docker](https://www.docker.com/) - [Docker](https://www.docker.com/)
@ -182,6 +182,12 @@ string ON
``` ```
## Change Log ## 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 Version 1.1.3 - 2019-02-10
- Publish config when reconnecting to MQTT - Publish config when reconnecting to MQTT
- Update readme documentation - Update readme documentation