Switch power on/off to a zone
        :param controller: Russound Controller ID. For systems with one controller this should be a value of 1.
        :param zone: The zone to be controlled. Expect a 1 based number.
        :param power: 0 = off, 1 = on
974086
def set_power(self, controller, zone, power):
        

        _LOGGER.debug("Begin - controller= %s, zone= %s, change power to %s",controller, zone, power)
        send_msg = self.create_send_message("F0 @cc 00 7F 00 00 @kk 05 02 02 00 00 F1 23 00 @pr 00 @zz 00 01",
                                            controller, zone, power)
        try:
            self.lock.acquire()
            _LOGGER.debug('Zone %s - acquired lock for ', zone)
            self.send_data(send_msg)
            _LOGGER.debug("Zone %s - sent message %s", zone, send_msg)
            self.get_response_message()  # Clear response buffer
        finally:
            self.lock.release()
            _LOGGER.debug("Zone %s - released lock for ", zone)
            _LOGGER.debug("End - controller %s, zone %s, power set to %s.\n", controller, zone, power)
520275
def _store_cached_zone_variable(self, zone_id, name, value):
        
        zone_state = self._zone_state.setdefault(zone_id, {})
        name = name.lower()
        zone_state[name] = value
        logger.debug("Zone Cache store %s.%s = %s",
                     zone_id.device_str(), name, value)
        for callback in self._zone_callbacks:
            callback(zone_id, name, value)
95907
def get_zone(self, zone_id, records=True):
        
        mask = None
        if records:
            mask = 'resourceRecords'
        return self.service.getObject(id=zone_id, mask=mask)
1273549
private int zoneOffsetAt(int transIdx) {
        int typeIdx = transIdx >= 0 ? getInt(typeMapData[transIdx]) * 2 : 0;
        return typeOffsets[typeIdx] + typeOffsets[typeIdx + 1];
    }
1164251
def get_volume(self, controller, zone):
        
        volume_level = self.get_zone_info(controller, zone, 2)
        if volume_level is not None:
            volume_level *= 2
        return volume_level
734138
def turn_on(self, channel, callback=None):
        
        if callback is None:
            def callb():
                """No-op"""
                pass
            callback = callb
        message = velbus.SwitchRelayOnMessage(self._address)
        message.relay_channels = [channel]
        self._controller.send(message, callback)
1220579
def set_power(self, state):
    """"""
    packet = bytearray(16)
    packet[0] = 2
    if self.check_nightlight():
      packet[4] = 3 if state else 2
    else:
      packet[4] = 1 if state else 0
    self.send_packet(0x6a, packet)
737083
def on_controller_change(self, name, value):
        
        if self.__controller != name:
            # Nothing to do
            return

        # Update the controller value
        self.__controller_on = value
        if value:
            # Controller switched to "ON"
            self._register_service()
        else:
            # Controller switched to "OFF"
            self._unregister_service()
640834
def power_status_update(self, POWER_STATUS):
        ''''''
        now = time.time()
        Vservo = POWER_STATUS.Vservo * 0.001
        Vcc = POWER_STATUS.Vcc * 0.001
        self.high_servo_voltage = max(self.high_servo_voltage, Vservo)
        if self.high_servo_voltage > 1 and Vservo < self.settings.servowarn:
            if now - self.last_servo_warn_time > 30:
                self.last_servo_warn_time = now
                self.say("Servo volt %.1f" % Vservo)
                if Vservo < 1:
                    # prevent continuous announcements on power down
                    self.high_servo_voltage = Vservo

        if Vcc > 0 and Vcc < self.settings.vccwarn:
            if now - self.last_vcc_warn_time > 30:
                self.last_vcc_warn_time = now
                self.say("Vcc %.1f" % Vcc)
536653
def _set_auto_watering(self, zoneid, value):
        """"""
        if not isinstance(value, bool):
            return None

        ddata = self.preupdate()
        attr = 'zone{}_program_toggle'.format(zoneid)
        try:
            if not value:
                ddata.pop(attr)
            else:
                ddata[attr] = 'on'
        except KeyError:
            pass
        self.submit_action(ddata)
        return True
725744
def power_on(self):
        """"""
        payload = amt.wsman.power_state_request(self.uri, "on")
        return self.post(payload, CIM_PowerManagementService)
186099
def deactivate_boost_by_name(self, zone_name):
        

        zone = self.get_zone(zone_name)
        if zone is None:
            raise RuntimeError("Unknown zone")

        return self.deactivate_boost_by_id(zone["zoneId"])
1164091
def zone(self) -> Optional[str]:
        """"""
        if self._device_category == DC_BASEUNIT:
            return None
        return '{:02x}-{:02x}'.format(self._group_number, self._unit_number)
989544
async def set_power(self, value: bool):
        """"""
        if value:
            status = "active"
        else:
            status = "off"
        # TODO WoL works when quickboot is not enabled
        return await self.services["system"]["setPowerStatus"](status=status)
880620
def turn_on(self):
        """"""
        if self.device_status != 'on':
            body = helpers.req_body(self.manager, 'devicestatus')
            body['uuid'] = self.uuid
            body['status'] = 'on'
            head = helpers.req_headers(self.manager)

            r, _ = helpers.call_api('/131airPurifier/v1/device/deviceStatus',
                                    'put', json=body, headers=head)

            if r is not None and helpers.check_response(r, 'airpur_status'):
                self.device_status = 'on'
                return True
            else:
                return False
953130
def set_operation_mode(self, mode):
        
        if mode == "off":
            desired_state = {"powered": False}
        else:
            desired_state = {"powered": True, "mode": mode}

        response = self.api_interface.set_device_state(self, {
            "desired_state": desired_state
        })

        self._update_state_from_response(response)
1255573
def control_circuit_breakers(self, mode=None):
        

        for grid_district in self.mv_grid_districts():
            if mode == 'open':
                grid_district.mv_grid.open_circuit_breakers()
            elif mode == 'close':
                grid_district.mv_grid.close_circuit_breakers()
            else:
                raise ValueError('\'mode\' is invalid.')

        if mode == 'open':
            logger.info('=====> MV Circuit Breakers opened')
        elif mode == 'close':
            logger.info('=====> MV Circuit Breakers closed')