/// <summary> /// /// </summary> /// <param name="action"></param> /// <param name="flows"></param> /// <returns></returns> public async Task <bool> SetSceneInColorFlow(YeelightAction action, List <ColorFlowType> flows) { return(await SendSettingsAndWaitResult("set_scene", new List <object> { "cf", GetColorFlowParameters(action, flows) })); }
private List <object> GetColorFlowParameters(YeelightAction action, List <ColorFlowType> flows) { string flowExpStr = string.Empty; foreach (ColorFlowType flowArray in flows) { flowExpStr += flowArray.Duration.ToString() + ","; flowExpStr += flowArray.Mode.ToString() + ","; flowExpStr += flowArray.Value.ToString() + ","; flowExpStr += flowArray.Brightness.ToString() + ","; } // Remove the last comma (,) flowExpStr.Remove(flowExpStr.Length - 1); return(new List <object> { flows.Count, (int)action, flowExpStr }); }
/// <summary> /// Set and run a active color flow /// </summary> /// <param name="count"></param> /// <param name="action"></param> /// <param name="flowExpression"></param> /// <returns></returns> public async Task <bool> StartColorFlow(YeelightAction action, List <ColorFlowType> flows) { return(await SendSettingsAndWaitResult("start_cf", GetColorFlowParameters(action, flows))); }