/// <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)
        {
            SwitchStateLightRequestOption set = new SwitchStateLightRequestOption()
            {
                IsOn = state ? 1 : 0
            };

            await MakeRequest($"/{(int)TradfriConstRoot.Groups}/{id}", Call.PUT, content : set);
        }
        /// <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)
        {
            SwitchStateLightRequestOption set = new SwitchStateLightRequestOption()
            {
                LightIntensity = value
            };

            await MakeRequest($"/{(int)TradfriConstRoot.Groups}/{id}", Call.PUT, content : set);
        }
예제 #3
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)
        {
            SwitchStateLightRequestOption set = new SwitchStateLightRequestOption()
            {
                LightIntensity = value
            };

            await HandleRequest($"/{(int)TradfriConstRoot.Groups}/{id}", Call.PUT, content : set, statusCode : System.Net.HttpStatusCode.NoContent);
        }
        /// <summary>
        /// Sets a mood for the group
        /// </summary>
        /// <param name="id">Id of the group</param>
        /// <param name="moodId">TradfriMood ID which needs to be activated for group</param>
        /// <returns></returns>
        public async Task SetMood(long id, long moodId)
        {
            SwitchStateLightRequestOption set = new SwitchStateLightRequestOption()
            {
                IsOn = 1,
                Mood = moodId
            };

            await MakeRequest($"/{(int)TradfriConstRoot.Groups}/{id}", Call.PUT, content : set);
        }
예제 #5
0
        /// <summary>
        /// Sets a mood for the group
        /// </summary>
        /// <param name="id">Id of the group</param>
        /// <param name="moodId">TradfriMood ID which needs to be activated for group</param>
        /// <returns></returns>
        public async Task SetMood(long id, long moodId)
        {
            SwitchStateLightRequestOption set = new SwitchStateLightRequestOption()
            {
                IsOn = 1,
                Mood = moodId
            };

            await HandleRequest($"/{(int)TradfriConstRoot.Groups}/{id}", Call.PUT, content : set, statusCode : System.Net.HttpStatusCode.NoContent);
        }
        /// <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 SwitchStateLightRequestOption()
            {
                Mood = mood.ID
            };

            await HandleRequest($"/{(int)TradfriConstRoot.Groups}/{id}", Call.PUT, content : set, statusCode : System.Net.HttpStatusCode.NoContent);
        }
        /// <summary>
        /// Sets a custom moodProperties for the group
        /// </summary>
        /// <param name="id">Id of the group</param>
        /// <param name="moodProperties">custom TradfriMoodProperties object which will be applied to all group bulbs</param>
        /// <returns></returns>
        public async Task SetMood(long id, TradfriMoodProperties moodProperties)
        {
            SwitchStateLightRequestOption set = new SwitchStateLightRequestOption()
            {
                IsOn = 1,
                Mood = 1 //hardcoded non-existing moodId
            };

            await MakeRequest($"/{(int)TradfriConstRoot.Groups}/{id}",
                              Call.PUT,
                              content : moodProperties);

            await MakeRequest($"/{(int)TradfriConstRoot.Groups}/{id}", Call.PUT, content : set);
        }