public void SetThermostatHeatSetpoint(CommandContract unit) { int temp = Helper.ConvertTemperature(unit.value); Event.WriteVerbose("WebService", "SetThermostatCoolSetpoint: " + unit.id + " to " + unit.value + "F (" + temp + ")"); WebService.HAC.SendCommand(enuUnitCommand.SetLowSetPt, BitConverter.GetBytes(temp)[0], unit.id); }
public List <NameContract> ListZonesContact() { Event.WriteVerbose("WebService", "ListZonesContact"); List <NameContract> names = new List <NameContract>(); for (ushort i = 1; i < WebService.HAC.Zones.Count; i++) { clsZone zone = WebService.HAC.Zones[i]; if ((zone.ZoneType == enuZoneType.EntryExit || zone.ZoneType == enuZoneType.X2EntryDelay || zone.ZoneType == enuZoneType.X4EntryDelay || zone.ZoneType == enuZoneType.Perimeter || zone.ZoneType == enuZoneType.Tamper || zone.ZoneType == enuZoneType.Auxiliary) && zone.DefaultProperties == false) { names.Add(new NameContract() { id = i, name = zone.Name }); } } return(names); }
static void processbutton(string msg) { dynamic m = JsonConvert.DeserializeObject(msg); ushort id = m.id; string cmdstr = m.cmd; Event.WriteVerbose("Mqtt Message", msg); MqttService.HAC2.SendCommand(enuUnitCommand.Button, 0, id); }
public static void AddSubscription(string callback) { lock (subscriptions_lock) { if (!subscriptions.Contains(callback)) { Event.WriteVerbose("WebNotification", "Adding subscription to " + callback); subscriptions.Add(callback); } } }
public AreaContract GetArea(ushort id) { Event.WriteVerbose("WebService", "GetArea: " + id); WebOperationContext ctx = WebOperationContext.Current; ctx.OutgoingResponse.Headers.Add("type", "area"); clsArea area = WebService.HAC.Areas[id]; return(Helper.ConvertArea(id, area)); }
public ThermostatContract GetThermostat(ushort id) { Event.WriteVerbose("WebService", "GetThermostat: " + id); WebOperationContext ctx = WebOperationContext.Current; ctx.OutgoingResponse.Headers.Add("type", "thermostat"); clsThermostat unit = WebService.HAC.Thermostats[id]; return(Helper.ConvertThermostat(id, unit)); }
public ZoneContract GetZone(ushort id) { Event.WriteVerbose("WebService", "GetZone: " + id); WebOperationContext ctx = WebOperationContext.Current; if (WebService.HAC.Zones[id].IsTemperatureZone()) { ctx.OutgoingResponse.Headers.Add("type", "temp"); } else { switch (WebService.HAC.Zones[id].ZoneType) { case enuZoneType.EntryExit: case enuZoneType.X2EntryDelay: case enuZoneType.X4EntryDelay: case enuZoneType.Perimeter: case enuZoneType.Tamper: case enuZoneType.Auxiliary: ctx.OutgoingResponse.Headers.Add("type", "contact"); break; case enuZoneType.AwayInt: case enuZoneType.NightInt: ctx.OutgoingResponse.Headers.Add("type", "motion"); break; case enuZoneType.Water: ctx.OutgoingResponse.Headers.Add("type", "water"); break; case enuZoneType.Fire: ctx.OutgoingResponse.Headers.Add("type", "smoke"); break; case enuZoneType.Gas: ctx.OutgoingResponse.Headers.Add("type", "co"); break; default: ctx.OutgoingResponse.Headers.Add("type", "unknown"); break; } } clsZone unit = WebService.HAC.Zones[id]; return(Helper.ConvertZone(id, unit)); }
static void processunit(string msg) { dynamic m = JsonConvert.DeserializeObject(msg); ushort id = m.id; string cmdstr = m.cmd; Event.WriteVerbose("Mqtt Message", msg); if (cmdstr.Equals("on")) { MqttService.HAC2.SendCommand(enuUnitCommand.On, 0, id); } else { MqttService.HAC2.SendCommand(enuUnitCommand.Off, 0, id); } }
public void SetUnit(CommandContract unit) { Event.WriteVerbose("WebService", "SetUnit: " + unit.id + " to " + unit.value + "%"); if (unit.value == 0) { WebService.HAC.SendCommand(enuUnitCommand.Off, 0, unit.id); } else if (unit.value == 100) { WebService.HAC.SendCommand(enuUnitCommand.On, 0, unit.id); } else { WebService.HAC.SendCommand(enuUnitCommand.Level, BitConverter.GetBytes(unit.value)[0], unit.id); } }
public List <NameContract> ListZonesWater() { Event.WriteVerbose("WebService", "ListZonesWater"); List <NameContract> names = new List <NameContract>(); for (ushort i = 1; i < WebService.HAC.Zones.Count; i++) { clsZone zone = WebService.HAC.Zones[i]; if (zone.ZoneType == enuZoneType.Water && zone.DefaultProperties == false) { names.Add(new NameContract() { id = i, name = zone.Name }); } } return(names); }
public List <NameContract> ListButtons() { Event.WriteVerbose("WebService", "ListButtons"); List <NameContract> names = new List <NameContract>(); for (ushort i = 1; i < WebService.HAC.Buttons.Count; i++) { clsButton unit = WebService.HAC.Buttons[i]; if (unit.DefaultProperties == false) { names.Add(new NameContract() { id = i, name = unit.Name }); } } return(names); }
public List <NameContract> ListAreas() { Event.WriteVerbose("WebService", "ListAreas"); List <NameContract> names = new List <NameContract>(); for (ushort i = 1; i < WebService.HAC.Areas.Count; i++) { clsArea area = WebService.HAC.Areas[i]; if (area.DefaultProperties == false) { names.Add(new NameContract() { id = i, name = area.Name }); } } return(names); }
public void PushButton(CommandContract unit) { Event.WriteVerbose("WebService", "PushButton: " + unit.id); WebService.HAC.SendCommand(enuUnitCommand.Button, 0, unit.id); }
public void SetThermostatHold(CommandContract unit) { Event.WriteVerbose("WebService", "SetThermostatHold: " + unit.id + " to " + unit.value); WebService.HAC.SendCommand(enuUnitCommand.Hold, BitConverter.GetBytes(unit.value)[0], unit.id); }
public void SetUnitKeypadPress(CommandContract unit) { Event.WriteVerbose("WebService", "SetUnitKeypadPress: " + unit.id + " to " + unit.value + " button"); WebService.HAC.SendCommand(enuUnitCommand.LutronHomeWorksKeypadButtonPress, BitConverter.GetBytes(unit.value)[0], unit.id); }
public void Subscribe(SubscribeContract contract) { Event.WriteVerbose("WebService", "Subscribe"); WebNotification.AddSubscription(contract.callback); }