public static HueLight Map(Light light) { State state = light.State; HueLightState lightState = new HueLightState( state.On, state.Brightness, state.Hue, state.Saturation, state.ColorCoordinates, state.ColorTemperature, (HueAlert?)state.Alert, (HueEffect?)state.Effect, state.ColorMode, state.IsReachable, state.TransitionTime, state.Mode ); return(new HueLight( light.Id, lightState, light.Type, light.Name, light.ModelId, light.ProductId, light.SwConfigId, light.UniqueId, light.LuminaireUniqueId, light.ManufacturerName, light.SoftwareVersion )); }
public string JsonDiff(HueLightState update) { var result = "{"; if (bri != update.bri) { result += "\"bri\": " + update.bri + ", "; } if (on != update.on) { result += "\"on\": " + update.on.ToString().ToLowerInvariant() + ", "; } //if (hue != update.hue) result += "\"hue\": " + update.hue + ", "; //if (sat != update.sat) result += "\"sat\": " + update.sat + ", "; //if (alert != update.alert) result += "\"alert\": " + update.alert + ", "; //instance.xy = new decimal[] { d["xy"][0], d["xy"][1] }; //instance.alert = d["alert"]; //instance.effect = d["effect"]; //instance.colormode = d["colormode"]; //instance.reachable = d["reachable"]; result = result.TrimEnd(',', ' '); result += "}"; if (result == "{}") { return(""); } return(result); }
public static HueLight Parse(dynamic d) { var instance = new HueLight(); instance.state = HueLightState.Parse(d["state"]); instance.type = d["type"]; instance.name = d["name"]; instance.modelid = d["modelid"]; instance.swversion = long.Parse(d["swversion"]); return(instance); }
public HueLight(string id, HueLightState state, string type, string name, string modelId, string productId, string swConfigId, string uniqueId, string luminaireUniqueId, string manufacturerName, string softwareVersion) { Id = id; State = state; Type = type; Name = name; ModelId = modelId; ProductId = productId; SwConfigId = swConfigId; UniqueId = uniqueId; LuminaireUniqueId = luminaireUniqueId; ManufacturerName = manufacturerName; SoftwareVersion = softwareVersion; }
public static HueLightState Parse(dynamic d) { var instance = new HueLightState(); instance.on = d["on"]; instance.bri = d["bri"]; instance.hue = d["hue"]; instance.sat = d["sat"]; instance.xy = new decimal[] { d["xy"][0], d["xy"][1] }; instance.alert = d["alert"]; instance.effect = d["effect"]; instance.colormode = d["colormode"]; instance.reachable = d["reachable"]; return instance; }
public static HueLightState Parse(dynamic d) { var instance = new HueLightState(); instance.on = d["on"]; instance.bri = d["bri"]; instance.hue = d["hue"]; instance.sat = d["sat"]; instance.xy = new decimal[] { d["xy"][0], d["xy"][1] }; instance.alert = d["alert"]; instance.effect = d["effect"]; instance.colormode = d["colormode"]; instance.reachable = d["reachable"]; return(instance); }
public string JsonDiff(HueLightState update) { var result = "{"; if (bri != update.bri) result += "\"bri\": " + update.bri + ", "; if (on != update.on) result += "\"on\": " + update.on.ToString().ToLowerInvariant() + ", "; //if (hue != update.hue) result += "\"hue\": " + update.hue + ", "; //if (sat != update.sat) result += "\"sat\": " + update.sat + ", "; //if (alert != update.alert) result += "\"alert\": " + update.alert + ", "; //instance.xy = new decimal[] { d["xy"][0], d["xy"][1] }; //instance.alert = d["alert"]; //instance.effect = d["effect"]; //instance.colormode = d["colormode"]; //instance.reachable = d["reachable"]; result = result.TrimEnd(',', ' '); result += "}"; if (result == "{}") return ""; return result; }
internal static string JsonCommand(HueLightState hueLightState1, HueLightState hueLightState2) { return hueLightState1.JsonDiff(hueLightState2); }
internal static string JsonCommand(HueLightState hueLightState1, HueLightState hueLightState2) { return(hueLightState1.JsonDiff(hueLightState2)); }