Set dimmer value of a light.
        transition_time: Integer representing tenth of a second (default None)
977968
def set_dimmer(self, dimmer, *, index=0, transition_time=None):
        
        self._value_validate(dimmer, RANGE_BRIGHTNESS, "Dimmer")

        values = {
            ATTR_LIGHT_DIMMER: dimmer
        }

        if transition_time is not None:
            values[ATTR_TRANSITION_TIME] = transition_time

        return self.set_values(values, index=index)
944542
def transition(self, duration, brightness=None, temperature=None):
        
        # Transition immediately if duration is zero.
        if duration == 0:
            if brightness is not None:
                self.brightness = brightness
            if temperature is not None:
                self.temperature = temperature
            return
        if brightness != self.brightness or temperature != self.temperature:
            self._transition(duration, brightness, temperature)
821011
private void setCurrentItemShowing(int index, boolean animateCircle, boolean delayLabelAnimate,
            boolean announce) {
        mTimePicker.setCurrentItemShowing(index, animateCircle);

        TextView labelToAnimate;
        switch(index) {
            case HOUR_INDEX:
                int hours = mTimePicker.getHours();
                if (!mIs24HourMode) {
                    hours = hours % 12;
                }
                mTimePicker.setContentDescription(mHourPickerDescription + ": " + hours);
                if (announce) {
                    Utils.tryAccessibilityAnnounce(mTimePicker, mSelectHours);
                }
                labelToAnimate = mHourView;
                break;
            case MINUTE_INDEX:
                int minutes = mTimePicker.getMinutes();
                mTimePicker.setContentDescription(mMinutePickerDescription + ": " + minutes);
                if (announce) {
                    Utils.tryAccessibilityAnnounce(mTimePicker, mSelectMinutes);
                }
                labelToAnimate = mMinuteView;
                break;
            default:
                int seconds = mTimePicker.getSeconds();
                mTimePicker.setContentDescription(mSecondPickerDescription + ": " + seconds);
                if (announce) {
                    Utils.tryAccessibilityAnnounce(mTimePicker, mSelectSeconds);
                }
                labelToAnimate = mSecondView;
        }

        int hourColor = (index == HOUR_INDEX) ? mSelectedColor : mUnselectedColor;
        int minuteColor = (index == MINUTE_INDEX) ? mSelectedColor : mUnselectedColor;
        int secondColor = (index == SECOND_INDEX) ? mSelectedColor : mUnselectedColor;
        mHourView.setTextColor(hourColor);
        mMinuteView.setTextColor(minuteColor);
        mSecondView.setTextColor(secondColor);

        ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f);
        if (delayLabelAnimate) {
            pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY);
        }
        pulseAnimator.start();
    }
83043
def _to_brightness(self, brightness):
        
        self._to_value(self._brightness, brightness,
                       self.command_set.brightness_steps,
                       self._dimmer, self._brighter)
106766
def set_pixel(self, x, y, value):
        
        if x < 0 or x > 7 or y < 0 or y > 15:
            # Ignore out of bounds pixels.
            return
        self.set_led((7 - x) * 16 + y, value)
716349
def set_transition(self, p_self):
        '''
        '''
        if p_self is None:
            self.transition = None
        else:
            self.transition = transition_loop(len(self._classes), p_self)
693284
def set_back_led_output(self, value):
        """"""
        return self.write(request.SetBackLEDOutput(self.seq, value))
1145083
def _dimmest(self):
        
        for _ in range(steps(self.brightness, 0.0,
                             self.command_set.brightness_steps)):
            self._dimmer()
1071878
def snake(self, duration: float = 0.03):
        
        for button in BUTTONS:
            self.light_on(button)
            time.sleep(duration)

        for button in reversed(BUTTONS):
            self.light_off(button)
            time.sleep(duration)
68762
def setImembPtr(self): 
        """"""
        jseg = 0
        for sec in list(self.secs.values()):
            hSec = sec['hObj']
            for iseg, seg in enumerate(hSec):
                self.imembPtr.pset(jseg, seg._ref_i_membrane_)  # notice the underscore at the end (in nA)
                jseg += 1
992845
def set_pwm(self, led_num, value):
        
        self.__check_range('led_number', led_num)
        self.__check_range('led_value', value)

        register_low = self.calc_led_register(led_num)

        self.write(register_low, value_low(value))
        self.write(register_low + 1, value_high(value))
1330851
def set_hsb(self, hue, saturation, brightness=None, *, index=0,
                transition_time=None):
        """"""
        self._value_validate(hue, RANGE_HUE, "Hue")
        self._value_validate(saturation, RANGE_SATURATION, "Saturation")

        values = {
            ATTR_LIGHT_COLOR_SATURATION: saturation,
            ATTR_LIGHT_COLOR_HUE: hue
        }

        if brightness is not None:
            values[ATTR_LIGHT_DIMMER] = brightness
            self._value_validate(brightness, RANGE_BRIGHTNESS, "Brightness")

        if transition_time is not None:
            values[ATTR_TRANSITION_TIME] = transition_time

        return self.set_values(values, index=index)
21056
def _transition(self, duration, brightness, temperature):
        
        # Set initial value.
        b_start = self.brightness
        t_start = self.temperature
        # Compute ideal step amount.
        b_steps = 0
        if brightness is not None:
            b_steps = steps(self.brightness, brightness,
                            self.command_set.brightness_steps)
        t_steps = 0
        if temperature is not None:
            t_steps = steps(self.temperature, temperature,
                            self.command_set.temperature_steps)
        # Compute ideal step amount (at least one).
        total_steps = max(b_steps, t_steps, 1)
        total_commands = b_steps + t_steps
        # Calculate wait.
        wait = self._wait(duration, total_steps, total_commands)
        # Scale down steps if no wait time.
        if wait == 0:
            b_steps, t_steps = self._scale_steps(duration, total_commands,
                                                 b_steps, t_steps)
            total_steps = max(b_steps, t_steps, 1)
        # Perform transition.
        for i in range(total_steps):
            # Brightness.
            if b_steps > 0 and i % (total_steps / b_steps) == 0:
                self.brightness = util.transition(i, total_steps,
                                                  b_start, brightness)
            # Temperature.
            elif t_steps > 0:
                self.temperature = util.transition(i, total_steps,
                                                   t_start, temperature)
            # Wait.
            time.sleep(wait)
596348
def set_led(self, led, value):
        
        if led < 0 or led > 127:
            raise ValueError('LED must be value of 0 to 127.')
        # Calculate position in byte buffer and bit offset of desired LED.
        pos = led // 8
        offset = led % 8
        if not value:
            # Turn off the specified LED (set bit to zero).
            self.buffer[pos] &= ~(1 << offset)
        else:
            # Turn on the speciried LED (set bit to one).
            self.buffer[pos] |= (1 << offset)
417076
def compensate_system_time_change(self, difference):  # pragma: no cover,
        # not with unit tests
        
        # We only need to change some value
        for prop in ('last_notification', 'last_state_change', 'last_hard_state_change'):
            val = getattr(self, prop)  # current value
            # Do not go below 1970 :)
            val = max(0, val + difference)  # diff may be negative
            setattr(self, prop, val)
281249
def _transition_steps(self, brightness=None):
        
        if brightness is not None:
            self._assert_is_brightness(brightness)
            return self._driver.steps(self.brightness, brightness)

        return 0
482840
def set_brightness(host, did, value, token=None):
    """"""
    urllib3.disable_warnings()
    if token:
        scheme = "https"
    if not token:
        scheme = "http"
        token = "1234567890"
    url = (
            scheme + '://' + host + '/gwr/gop.php?cmd=DeviceSendCommand&data=<gip><version>1</version><token>' + token + '</token><did>' + did + '</did><value>' + str(
        value) + '</value><type>level</type></gip>&fmt=xml')
    response = requests.get(url, verify=False)
    if response.status_code == '200':
        return True
    else:
        return False