Get an actor's power state
345946
def switch_state(context, ain):
    """"""
    context.obj.login()
    actor = context.obj.get_actor_by_ain(ain)
    if actor:
        click.echo("State for {} is: {}".format(ain,'ON' if actor.get_state() else 'OFF'))
    else:
        click.echo("Actor not found: {}".format(ain))
832567
@Override
    public PowerState getState() {
        if(pin.isState(onState))
            return PowerState.ON;
        else if(pin.isState(offState))
            return PowerState.OFF;
        else
            return PowerState.UNKNOWN;
    }
925072
def play_state(self):
        """"""
        state = parser.first(self.playstatus, 'cmst', 'caps')
        return convert.playstate(state)
604395
def first_active(self):
        
        result = None
        for actor in self.actors:
            if not actor.skip:
                result = actor
                break
        return result
916514
public void readArduinoPowerState(final Callback<Boolean> callback) {
        addCallback(BeanMessageID.CC_GET_AR_POWER, callback);
        sendMessageWithoutPayload(BeanMessageID.CC_GET_AR_POWER);
    }
319534
def getstate(d):
    '''
    '''
    if not isinstance(d, dict):
        raise TypeError("Can only get the state of a dictionary")
    cpd = copy.deepcopy(d)
    cpd.pop('_links', None)
    cpd.pop('_embedded', None)
    return cpd
446485
def _get_state(self, **kwargs):
        '''
        

        '''

        return self.describe(fields=dict(state=True), **kwargs)["state"]
122230
async def power(source, exponent):
    """"""
    async with streamcontext(source) as streamer:
        async for item in streamer:
            yield item ** exponent
91998
def get_controller_state(self):
        """"""
        dpos = self.control[:3] * 0.005
        roll, pitch, yaw = self.control[3:] * 0.005
        self.grasp = self.control_gripper

        # convert RPY to an absolute orientation
        drot1 = rotation_matrix(angle=-pitch, direction=[1., 0, 0], point=None)[:3, :3]
        drot2 = rotation_matrix(angle=roll, direction=[0, 1., 0], point=None)[:3, :3]
        drot3 = rotation_matrix(angle=yaw, direction=[0, 0, 1.], point=None)[:3, :3]

        self.rotation = self.rotation.dot(drot1.dot(drot2.dot(drot3)))

        return dict(
            dpos=dpos, rotation=self.rotation, grasp=self.grasp, reset=self._reset_state
        )
75561
def get_actor_by_ain(self, ain):
        
        for actor in self.get_actors():
            if actor.actor_id == ain:
                return actor
830050
def get_state(self):
        
        # Include battery level in state
        battery = self.player.stats['battery']/100
        # Create observation from sensor proximities
        # TODO: Have state persist, then update columns by `sensed_type`

        # Multi-channel; detecting `items`
        if len(self.mode['items']) > 0:
            observation = []
            for sensor in self.player.sensors:
                col = []
                # Always include range in channel 0
                col.append(sensor.proximity_norm())
                for item_type in self.mode['items']:
                    if sensor.sensed_type == item_type:
                        col.append(sensor.proximity_norm())
                    else:
                        # Default to 1 (`max_range/max_range`)
                        col.append(1)
                observation.append(col)
            if 'battery' in self.mode:
                observation.append([battery,1,1])

        # Single-channel; walls only
        else:
            observation = [o.proximity_norm() for o in self.player.sensors]
            if 'battery' in self.mode:
                observation.append(battery)

        return observation
415172
def state(self) -> str:
        """"""
        return self._coerce_state_from_string(
            next(
                attr['Value'] for attr in self._device_json.get(
                    'Attributes', [])
                if attr.get('AttributeDisplayName') == 'doorstate'))
505477
def get_host_power_status(self):
        
        sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID)
        return GET_POWER_STATE_MAP.get(sushy_system.power_state)
839522
def get_consumption(self):
        """"""
        self.get_status()
        try:
            self.consumption = self.data['power']
        except TypeError:
            self.consumption = 0

        return self.consumption
900866
def _on_power_state(self, header, payload, rest, addr):
        
        with self.lock:
            self.power_state[header.mac] = payload
            if len(self.power_state) >= self.num_bulbs:
                self.power_state_event.set()

        self.callbacks.put(EVENT_POWER_STATE, self.get_bulb(header.mac),
                           is_on=bool(payload['is_on']))
1194416
def async_get_ac_states(self, uid, limit=1, offset=0, fields='*'):
        """"""
        return (yield from self._get('/pods/{}/acStates'.format(uid),
                                     limit=limit,
                                     fields=fields,
                                     offset=offset))
956774
def state(self):
        """"""
        if self.lightlevel is None:
            return None
        lux = round(10 ** (float(self.lightlevel - 1) / 10000), 1)
        return lux