Turn on bulb or fixture
555481
def turn_on(host, did, 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>1</value></gip>&fmt=xml')
    response = requests.get(url, verify=False)
    if response.status_code == '200':
        return True
    else:
        return False
843986
def power_on(self):
        """"""
        try:
            self.send_command("POWER_ON")
            self._power = POWER_ON
            self._state = STATE_ON
            return True
        except requests.exceptions.RequestException:
            _LOGGER.error("Connection error: power on command not sent.")
            return False
1366602
def switch_on(self):
        """"""
        success = self.set_status(CONST.STATUS_ON_INT)

        if success:
            self._json_state['status'] = CONST.STATUS_ON

        return success
1342217
def set_light_state_raw(self, hue, saturation, brightness, kelvin,
                            bulb=ALL_BULBS, timeout=None):
        
        with _blocking(self.lock, self.light_state, self.light_state_event,
                       timeout):
            self.send(REQ_SET_LIGHT_STATE, bulb, 'xHHHHI',
                      hue, saturation, brightness, kelvin, 0)
            self.send(REQ_GET_LIGHT_STATE, ALL_BULBS, '')
        return self.light_state
77998
def set_led(self, red=0, green=0, blue=0):
        """"""
        self._led = (red, green, blue)
        self._control()
280464
async def power(dev: Device, cmd, target, value):
    
    async def try_turn(cmd):
        state = True if cmd == "on" else False
        try:
            return await dev.set_power(state)
        except SongpalException as ex:
            if ex.code == 3:
                err("The device is already %s." % cmd)
            else:
                raise ex

    if cmd == "on" or cmd == "off":
        click.echo(await try_turn(cmd))
    elif cmd == "settings":
        settings = await dev.get_power_settings()
        print_settings(settings)
    elif cmd == "set" and target and value:
        click.echo(await dev.set_power_settings(target, value))
    else:
        power = await dev.get_power()
        click.echo(click.style(str(power), bold=power))
1245705
def open
      context = LIBUSB::Context.new
      device = context.devices(:idVendor => LEGO_VENDOR_ID, :idProduct => NXT_PRODUCT_ID).first
      raise ::LegoNXT::NoDeviceError.new("Please make sure the device is plugged in and powered on") if device.nil?
      @handle = device.open
      @handle.claim_interface(0)
    end
1212394
def trigger(self):
        
        ibsta = self._lib.ibtrg(self._device)
        self._check_status(ibsta)
986329
function () {
    let light = new THREE.PointLight(0xffffff, 1, c.SUN_RADIUS * 5);
    light.position.y = c.SUN_RADIUS * 4;
    return light;
  }
1113887
def get_bulb(self, mac):
        
        return self.bulbs.get(mac, Bulb('Bulb %s' % _bytes(mac), mac))
1245064
def power_on(self):
        """"""
        try:
            if self.send_get_command(self._urls.command_power_on):
                self._power = POWER_ON
                self._state = STATE_ON
                return True
            else:
                return False
        except requests.exceptions.RequestException:
            _LOGGER.error("Connection error: power on command not sent.")
            return False
650593
def light_on(self, button: Button):
        """"""
        self.outport.send(mido.Message('polytouch', note=button.light, value=1))
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)
660170
def lighting(self, func:LightingFunc, *args:Any, **kwargs:Any):
        ""
        self.logit_px = func(self.logit_px, *args, **kwargs)
        return self
1350737
def setup_handler(setup_fixtures_fn, setup_fn):
        
        def handler(obj):
            setup_fixtures_fn(obj)
            setup_fn(obj)
        return handler
1159893
def to_grey(self, on: bool=False):
        
        self._on = False
        self._load_new(led_grey)
1073795
function(x, y) {
            // remove light from current position
            if(this.game.lighting.get(this.x, this.y)){
                this.game.lighting.remove(this.x, this.y);
            }
            // add to new position
            this.game.lighting.set(x, y, this.light_r, this.light_g, this.light_b);

            RL.Entity.prototype.moveTo.call(this, x, y);
        }