예제 #1
0
        /// <summary>
        /// Set Dimmer for Light Devices in Group
        /// </summary>
        /// <param name="id">Id of the group</param>
        /// <param name="value">Dimmer intensity (0-255)</param>
        /// <returns></returns>
        public async Task SetDimmer(long id, int value)
        {
            var set = new SwitchStateRequestOption()
            {
                LightIntensity = value
            };

            await HandleRequest($"/{(int)TradfriConstRoot.Groups}/{id}", Call.PUT, content : set, statusCode : System.Net.HttpStatusCode.NoContent);
        }
예제 #2
0
        /// <summary>
        /// Turns a group of lights on or off
        /// </summary>
        /// <param name="id">Id of the group</param>
        /// <param name="state">On (True) or Off(false)</param>
        /// <returns></returns>
        public async Task SetLight(long id, bool state)
        {
            var set = new SwitchStateRequestOption()
            {
                isOn = state ? 1 : 0
            };

            await HandleRequest($"/{(int)TradfriConstRoot.Groups}/{id}", Call.PUT, content : set);
        }
예제 #3
0
        /// <summary>
        /// Sets a mood for the group
        /// </summary>
        /// <param name="id">Id of the group</param>
        /// <param name="mood">TradfriMood object which needs to be set</param>
        /// <returns></returns>
        public async Task SetMood(long id, TradfriMood mood)
        {
            await HandleRequest($"/{(int)TradfriConstRoot.Groups}/{id}", Call.PUT, content : mood.MoodProperties[0], statusCode : System.Net.HttpStatusCode.NoContent);

            var set = new SwitchStateRequestOption()
            {
                Mood = mood.ID
            };

            await HandleRequest($"/{(int)TradfriConstRoot.Groups}/{id}", Call.PUT, content : set, statusCode : System.Net.HttpStatusCode.NoContent);
        }