Example #1
0
        private void PublishZoneState(clsZone zone)
        {
            MqttClient.PublishAsync(zone.ToTopic(Topic.state), zone.ToState(), MqttQualityOfServiceLevel.AtMostOnce, true);
            MqttClient.PublishAsync(zone.ToTopic(Topic.basic_state), zone.ToBasicState(), MqttQualityOfServiceLevel.AtMostOnce, true);

            if (zone.IsTemperatureZone())
            {
                MqttClient.PublishAsync(zone.ToTopic(Topic.current_temperature), zone.TempText(), MqttQualityOfServiceLevel.AtMostOnce, true);
            }
            else if (zone.IsHumidityZone())
            {
                MqttClient.PublishAsync(zone.ToTopic(Topic.current_humidity), zone.TempText(), MqttQualityOfServiceLevel.AtMostOnce, true);
            }
        }
Example #2
0
        private void PublishZoneState(clsZone zone)
        {
            PublishAsync(zone.ToTopic(Topic.state), zone.ToState());
            PublishAsync(zone.ToTopic(Topic.basic_state), zone.ToBasicState());

            if (zone.IsTemperatureZone())
            {
                PublishAsync(zone.ToTopic(Topic.current_temperature), zone.TempText());
            }
            else if (zone.IsHumidityZone())
            {
                PublishAsync(zone.ToTopic(Topic.current_humidity), zone.TempText());
            }
        }
Example #3
0
        public static ZoneContract ToContract(this clsZone zone)
        {
            ZoneContract ret = new ZoneContract();

            ret.id       = (ushort)zone.Number;
            ret.zonetype = zone.ZoneType;
            ret.name     = zone.Name;
            ret.status   = zone.StatusText();

            if (zone.IsTemperatureZone())
            {
                ret.temp = zone.TempText();
            }
            else if (zone.IsHumidityZone())
            {
                ret.temp = zone.TempText();
            }

            return(ret);
        }
Example #4
0
        public static ZoneContract ToContract(this clsZone zone)
        {
            ZoneContract ret = new ZoneContract();

            ret.id       = (ushort)zone.Number;
            ret.zonetype = zone.ZoneType;
            ret.name     = zone.Name;
            ret.status   = zone.StatusText();
            ret.temp     = zone.TempText();

            return(ret);
        }
Example #5
0
        public static ZoneContract ConvertZone(ushort id, clsZone zone)
        {
            ZoneContract ret = new ZoneContract();

            ret.id       = id;
            ret.zonetype = zone.ZoneType;
            ret.name     = zone.Name;
            ret.status   = zone.StatusText();
            ret.temp     = zone.TempText();

            return(ret);
        }
Example #6
0
        private void Omnilink_OnConnect(object sender, EventArgs e)
        {
            if (Global.verbose_area)
            {
                for (ushort i = 1; i <= omnilink.Controller.Areas.Count; i++)
                {
                    clsArea area = omnilink.Controller.Areas[i];

                    if (i > 1 && area.DefaultProperties == true)
                    {
                        continue;
                    }

                    string status = area.ModeText();

                    if (area.ExitTimer > 0)
                    {
                        status = "ARMING " + status;
                    }

                    if (area.EntryTimer > 0)
                    {
                        status = "TRIPPED " + status;
                    }

                    log.Verbose("Initial AreaStatus {id} {name}, Status: {status}, Alarms: {alarms}", i, area.Name, status, area.AreaAlarms);
                }
            }

            if (Global.verbose_zone)
            {
                for (ushort i = 1; i <= omnilink.Controller.Zones.Count; i++)
                {
                    clsZone zone = omnilink.Controller.Zones[i];

                    if (zone.DefaultProperties == true)
                    {
                        continue;
                    }

                    if (zone.IsTemperatureZone())
                    {
                        log.Verbose("Initial ZoneStatus {id} {name}, Temp: {temp}", i, zone.Name, zone.TempText());
                    }
                    else
                    {
                        log.Verbose("Initial ZoneStatus {id} {name}, Status: {status}", i, zone.Name, zone.StatusText());
                    }
                }
            }
        }