internal void OnDeserializedMethod(StreamingContext context) { if(Body != null) { if(Body is GenericScheduleCommand) { var genericCommand = Body as GenericScheduleCommand; var invariantAddress = Address.ToLowerInvariant(); //Check if it is a scene command if (genericCommand.IsSceneCommand()) { Body = genericCommand.AsSceneCommand(); } //If it is going to a lights or groups URL, it's probably a LightCommand else if (invariantAddress.Contains("/lights") || invariantAddress.Contains("/groups")) { Body = genericCommand.AsLightCommand(); } //If it is going to a sensor url, it's probably a SensorCommand else if (invariantAddress.Contains("/sensors")) { Body = genericCommand.AsSensorCommand(); } } } }
internal void OnDeserializedMethod(StreamingContext context) { if (Body != null) { if (Body is GenericScheduleCommand) { var genericCommand = Body as GenericScheduleCommand; var invariantAddress = Address.ToLowerInvariant(); //Check if it is a scene command if (genericCommand.IsSceneCommand()) { Body = genericCommand.AsSceneCommand(); } //If it is going to a lights or groups URL, it's probably a LightCommand else if (invariantAddress.Contains("/lights") || invariantAddress.Contains("/groups")) { Body = genericCommand.AsLightCommand(); } //If it is going to a sensor url, it's probably a SensorCommand else if (invariantAddress.Contains("/sensors")) { Body = genericCommand.AsSensorCommand(); } } } }
/// <summary> /// Send command to a group /// </summary> /// <param name="command"></param> /// <param name="group"></param> /// <returns></returns> public Task<HueResults> SendGroupCommandAsync(ICommandBody command, string group = "0") { if (command == null) throw new ArgumentNullException("command"); string jsonCommand = JsonConvert.SerializeObject(command, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); return SendGroupCommandAsync(jsonCommand, group); }
/// <summary> /// Send command to a group /// </summary> /// <param name="command"></param> /// <param name="group"></param> /// <returns></returns> public Task <HueResults> SendGroupCommandAsync(ICommandBody command, string group = "0") { if (command == null) { throw new ArgumentNullException(nameof(command)); } string jsonCommand = JsonConvert.SerializeObject(command, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); return(SendGroupCommandAsync(jsonCommand, group)); }
public Task <HueResults> SendGroupCommandAsync(ICommandBody command, string group = "0") { throw new NotImplementedException(); }