- Request zone status update on area status change

This commit is contained in:
Ryan Wagoner 2018-10-23 21:19:28 -04:00
parent fdaa26830e
commit e44d628886
2 changed files with 26 additions and 1 deletions

View file

@ -394,6 +394,31 @@ namespace OmniLinkBridge.Modules
private void Omnilink_OnAreaStatus(object sender, AreaStatusEventArgs e)
{
PublishAreaState(e.Area);
// Since the controller doesn't fire zone status change on area status change
// request update so armed, tripped, and secure statuses are correct
for (ushort i = 1; i < OmniLink.Controller.Zones.Count; i++)
{
clsZone zone = OmniLink.Controller.Zones[i];
if (zone.DefaultProperties == false && zone.Area == e.Area.Number)
OmniLink.Controller.Connection.Send(new clsOL2MsgRequestExtendedStatus(OmniLink.Controller.Connection, enuObjectType.Zone, i, i), HandleRequestZoneStatus);
}
}
private void HandleRequestZoneStatus(clsOmniLinkMessageQueueItem M, byte[] B, bool Timeout)
{
if (Timeout)
return;
clsOL2MsgExtendedStatus MSG = new clsOL2MsgExtendedStatus(OmniLink.Controller.Connection, B);
for (byte i = 0; i < MSG.ZoneStatusCount(); i++)
{
clsZone zone = OmniLink.Controller.Zones[MSG.ObjectNumber(i)];
zone.CopyExtendedStatus(MSG, i);
MqttClient.PublishAsync(zone.ToTopic(Topic.state), zone.ToState(), MqttQualityOfServiceLevel.AtMostOnce, true);
}
}
private void Omnilink_OnZoneStatus(object sender, ZoneStatusEventArgs e)

View file

@ -391,7 +391,7 @@ namespace OmniLinkBridge.Modules
case enuObjectType.Zone:
Controller.Zones.CopyProperties(MSG);
if (Controller.Zones[MSG.ObjectNumber].IsTemperatureZone())
if (Controller.Zones[MSG.ObjectNumber].IsTemperatureZone() || Controller.Zones[MSG.ObjectNumber].IsHumidityZone())
Controller.Connection.Send(new clsOL2MsgRequestExtendedStatus(Controller.Connection, enuObjectType.Auxillary, MSG.ObjectNumber, MSG.ObjectNumber), HandleRequestAuxillaryStatus);
break;