示例#1
0
 /// <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)
     }));
 }
示例#2
0
        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
            });
        }
示例#3
0
 /// <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)));
 }