Beispiel #1
0
        public IEnumerable <WifiDetailed> ScanForWifisDetailed()
        {
            var response = HttpGet("networks");
            var r        = MyStromUtil.UnwrapDefunctJson <WifiDetailedScanResultWrapperJson>(response);

            return(r.Root);
        }
        /// <summary>
        ///     Sets the color to a given value.
        /// </summary>
        /// <param name="color">
        ///     If this field contains 3 semi-colon delimited integers, the mode is set to 'hsv'. Then this field contains the
        ///     integer values (hue 0-359;saturation 0-100;value 0-100).
        ///     If this field contains a string of 4 bytes hex-digits the mode is set to 'rgb'. Then this field contains the
        ///     hex-value of the WRGB color (white;red;green;blue). Example: white: 'color=FF000000', green: 'color=0000ff00'
        ///     If this field contains 2 semi-colon delimited integers, the mode is set to 'mono'. Then it contains the value for
        ///     the color temperature (from 1 to 18) and the brightness (from 0 to 100). Example: 'color=10;80'.
        ///     Failing to honor the int-limits or other inputs result in a bad request status code.
        /// </param>
        /// <param name="ramp">The time the bulb will take to change to that color (it will perform a fade).</param>
        /// <param name="action">The action you want the bulb to do when it receives this message.</param>
        /// <param name="notifyUrl">An URL that will be posted to from now on on every state-change until you set it to '' again.</param>
        /// <returns></returns>
        public ToggleResultJson SetColor(string color, int ramp = 0, BulbAction action = null, string notifyUrl = "")
        {
            var a = "";

            if (action != null)
            {
                a = $"&{action}";
            }
            var response = HttpPostUrlEncoded($"api/v1/device/{MacAddress}",
                                              $"color={color}{a}&ramp={ramp}&notifyurl={notifyUrl}");

            return(MyStromUtil.UnwrapDefunctJson <ToggleResultWrapperJson>(response).Root[0]);
        }
        public DeviceInformationResultJson GetDeviceInformation()
        {
            var response = HttpGet("api/v1/device");

            return(MyStromUtil.UnwrapDefunctJson <DeviceInformationResultWrapperJson>(response).Root[0]);
        }
        public ToggleResultJson SendOff()
        {
            var response = HttpPostUrlEncoded($"api/v1/device/{MacAddress}", "action=off");

            return(MyStromUtil.UnwrapDefunctJson <ToggleResultWrapperJson>(response).Root[0]);
        }