desc stringlengths 3 26.7k | decl stringlengths 11 7.89k | bodies stringlengths 8 553k |
|---|---|---|
'No polling available in RFXtrx cover.'
| @property
def should_poll(self):
| return False
|
'Return if the cover is closed.'
| @property
def is_closed(self):
| return None
|
'Move the cover up.'
| def open_cover(self, **kwargs):
| self._send_command('roll_up')
|
'Move the cover down.'
| def close_cover(self, **kwargs):
| self._send_command('roll_down')
|
'Stop the cover.'
| def stop_cover(self, **kwargs):
| self._send_command('stop_roll')
|
'Return the current position of the cover.'
| @property
def is_closed(self):
| return self.device.is_down
|
'Close the cover.'
| def close_cover(self, **kwargs):
| self.device.down()
self.changed()
|
'Open the cover.'
| def open_cover(self, **kwargs):
| self.device.up()
self.changed()
|
'Stop the cover.'
| def stop_cover(self, **kwargs):
| self.device.stop()
self.changed()
|
'Return current position of cover.
None is unknown, 0 is closed, 100 is fully open.'
| @property
def current_cover_position(self):
| return int((self._hm_get_state() * 100))
|
'Move the cover to a specific position.'
| def set_cover_position(self, **kwargs):
| if (ATTR_POSITION in kwargs):
position = float(kwargs[ATTR_POSITION])
position = min(100, max(0, position))
level = (position / 100.0)
self._hmdevice.set_level(level, self._channel)
|
'Return if the cover is closed.'
| @property
def is_closed(self):
| if (self.current_cover_position is not None):
return (self.current_cover_position == 0)
|
'Open the cover.'
| def open_cover(self, **kwargs):
| self._hmdevice.move_up(self._channel)
|
'Close the cover.'
| def close_cover(self, **kwargs):
| self._hmdevice.move_down(self._channel)
|
'Stop the device if in motion.'
| def stop_cover(self, **kwargs):
| self._hmdevice.stop(self._channel)
|
'Generate a data dictoinary (self._data) from metadata.'
| def _init_data_struct(self):
| self._state = 'LEVEL'
self._data.update({self._state: STATE_UNKNOWN})
|
'Initialize the cover.'
| def __init__(self, name, relay_pin, state_pin, state_pull_mode, relay_time, invert_state, invert_relay):
| self._name = name
self._state = False
self._relay_pin = relay_pin
self._state_pin = state_pin
self._state_pull_mode = state_pull_mode
self._relay_time = relay_time
self._invert_state = invert_state
self._invert_relay = invert_relay
rpi_gpio.setup_output(self._relay_pin)
rpi_gpio.... |
'Return the ID of this cover.'
| @property
def unique_id(self):
| return '{}.{}'.format(self.__class__, self._name)
|
'Return the name of the cover if any.'
| @property
def name(self):
| return self._name
|
'Update the state of the cover.'
| def update(self):
| self._state = rpi_gpio.read_input(self._state_pin)
|
'Return true if cover is closed.'
| @property
def is_closed(self):
| return (self._state != self._invert_state)
|
'Trigger the cover.'
| def _trigger(self):
| rpi_gpio.write_output(self._relay_pin, self._invert_relay)
sleep(self._relay_time)
rpi_gpio.write_output(self._relay_pin, (not self._invert_relay))
|
'Close the cover.'
| def close_cover(self):
| if (not self.is_closed):
self._trigger()
|
'Open the cover.'
| def open_cover(self):
| if self.is_closed:
self._trigger()
|
'Return True if unable to access real state of entity.'
| @property
def assumed_state(self):
| return self.gateway.optimistic
|
'Return True if cover is closed.'
| @property
def is_closed(self):
| set_req = self.gateway.const.SetReq
if (set_req.V_DIMMER in self._values):
return (self._values.get(set_req.V_DIMMER) == 0)
return (self._values.get(set_req.V_LIGHT) == STATE_OFF)
|
'Return current position of cover.
None is unknown, 0 is closed, 100 is fully open.'
| @property
def current_cover_position(self):
| set_req = self.gateway.const.SetReq
return self._values.get(set_req.V_DIMMER)
|
'Move the cover up.'
| def open_cover(self, **kwargs):
| set_req = self.gateway.const.SetReq
self.gateway.set_child_value(self.node_id, self.child_id, set_req.V_UP, 1)
if self.gateway.optimistic:
if (set_req.V_DIMMER in self._values):
self._values[set_req.V_DIMMER] = 100
else:
self._values[set_req.V_LIGHT] = STATE_ON
... |
'Move the cover down.'
| def close_cover(self, **kwargs):
| set_req = self.gateway.const.SetReq
self.gateway.set_child_value(self.node_id, self.child_id, set_req.V_DOWN, 1)
if self.gateway.optimistic:
if (set_req.V_DIMMER in self._values):
self._values[set_req.V_DIMMER] = 0
else:
self._values[set_req.V_LIGHT] = STATE_OFF
... |
'Move the cover to a specific position.'
| def set_cover_position(self, **kwargs):
| position = kwargs.get(ATTR_POSITION)
set_req = self.gateway.const.SetReq
self.gateway.set_child_value(self.node_id, self.child_id, set_req.V_DIMMER, position)
if self.gateway.optimistic:
self._values[set_req.V_DIMMER] = position
self.schedule_update_ha_state()
|
'Stop the device.'
| def stop_cover(self, **kwargs):
| set_req = self.gateway.const.SetReq
self.gateway.set_child_value(self.node_id, self.child_id, set_req.V_STOP, 1)
|
'Initialize the Z-Wave rollershutter.'
| def __init__(self, hass, values, invert_buttons):
| ZWaveDeviceEntity.__init__(self, values, DOMAIN)
self._network = hass.data[zwave.const.DATA_NETWORK]
self._open_id = None
self._close_id = None
self._current_position = None
self._invert_buttons = invert_buttons
self._workaround = workaround.get_device_mapping(values.primary)
if self._wo... |
'Handle data changes for node values.'
| def update_properties(self):
| self._current_position = self.values.primary.data
if (self.values.open and self.values.close and (self._open_id is None) and (self._close_id is None)):
if self._invert_buttons:
self._open_id = self.values.close.value_id
self._close_id = self.values.open.value_id
else:
... |
'Return if the cover is closed.'
| @property
def is_closed(self):
| if (self.current_cover_position is None):
return None
if (self.current_cover_position > 0):
return False
return True
|
'Return the current position of Zwave roller shutter.'
| @property
def current_cover_position(self):
| if (self._workaround == workaround.WORKAROUND_NO_POSITION):
return None
if (self._current_position is not None):
if (self._current_position <= 5):
return 0
elif (self._current_position >= 95):
return 100
return self._current_position
|
'Move the roller shutter up.'
| def open_cover(self, **kwargs):
| self._network.manager.pressButton(self._open_id)
|
'Move the roller shutter down.'
| def close_cover(self, **kwargs):
| self._network.manager.pressButton(self._close_id)
|
'Move the roller shutter to a specific position.'
| def set_cover_position(self, position, **kwargs):
| self.node.set_dimmer(self.values.primary.value_id, position)
|
'Stop the roller shutter.'
| def stop_cover(self, **kwargs):
| self._network.manager.releaseButton(self._open_id)
|
'Initialize the zwave garage door.'
| def __init__(self, values):
| ZWaveDeviceEntity.__init__(self, values, DOMAIN)
self._state = None
self.update_properties()
|
'Handle data changes for node values.'
| def update_properties(self):
| self._state = self.values.primary.data
_LOGGER.debug('self._state=%s', self._state)
|
'Return the class of this device, from component DEVICE_CLASSES.'
| @property
def device_class(self):
| return 'garage'
|
'Flag supported features.'
| @property
def supported_features(self):
| return SUPPORT_GARAGE
|
'Return the current position of Zwave garage door.'
| @property
def is_closed(self):
| return (not self._state)
|
'Close the garage door.'
| def close_cover(self):
| self.values.primary.data = False
|
'Open the garage door.'
| def open_cover(self):
| self.values.primary.data = True
|
'Return true if cover is in an opening state.'
| @property
def is_opening(self):
| return (self._state == 'Opening')
|
'Return true if cover is in an closing state.'
| @property
def is_closing(self):
| return (self._state == 'Closing')
|
'Return the current position of Zwave garage door.'
| @property
def is_closed(self):
| return (self._state == 'Closed')
|
'Close the garage door.'
| def close_cover(self):
| self.values.primary.data = 'Closed'
|
'Open the garage door.'
| def open_cover(self):
| self.values.primary.data = 'Opened'
|
'Initialize the cover.'
| def __init__(self, scs_id, name, logger):
| self._scs_id = scs_id
self._name = name
self._logger = logger
|
'Return the SCSGate ID.'
| @property
def scs_id(self):
| return self._scs_id
|
'No polling needed.'
| @property
def should_poll(self):
| return False
|
'Return the name of the cover.'
| @property
def name(self):
| return self._name
|
'Return if the cover is closed.'
| @property
def is_closed(self):
| return None
|
'Move the cover.'
| def open_cover(self, **kwargs):
| from scsgate.tasks import RaiseRollerShutterTask
scsgate.SCSGATE.append_task(RaiseRollerShutterTask(target=self._scs_id))
|
'Move the cover down.'
| def close_cover(self, **kwargs):
| from scsgate.tasks import LowerRollerShutterTask
scsgate.SCSGATE.append_task(LowerRollerShutterTask(target=self._scs_id))
|
'Stop the cover.'
| def stop_cover(self, **kwargs):
| from scsgate.tasks import HaltRollerShutterTask
scsgate.SCSGATE.append_task(HaltRollerShutterTask(target=self._scs_id))
|
'Handle a SCSGate message related with this cover.'
| def process_event(self, message):
| self._logger.debug('Cover %s, got message %s', self._scs_id, message.toggled)
|
'Initialize with API object, device id.'
| def __init__(self, myq, device):
| self.myq = myq
self.device_id = device['deviceid']
self._name = device['name']
self._status = STATE_CLOSED
|
'Poll for state.'
| @property
def should_poll(self):
| return True
|
'Return the name of the garage door if any.'
| @property
def name(self):
| return (self._name if self._name else DEFAULT_NAME)
|
'Return true if cover is closed, else False.'
| @property
def is_closed(self):
| return (self._status == STATE_CLOSED)
|
'Issue close command to cover.'
| def close_cover(self):
| self.myq.close_device(self.device_id)
|
'Issue open command to cover.'
| def open_cover(self):
| self.myq.open_device(self.device_id)
|
'Update status of cover.'
| def update(self):
| self._status = self.myq.get_status(self.device_id)
|
'Initialize the cover.'
| def __init__(self, hass, name, command_open, command_close, command_stop, command_state, value_template):
| self._hass = hass
self._name = name
self._state = None
self._command_open = command_open
self._command_close = command_close
self._command_stop = command_stop
self._command_state = command_state
self._value_template = value_template
|
'Execute the actual commands.'
| @staticmethod
def _move_cover(command):
| _LOGGER.info('Running command: %s', command)
success = (subprocess.call(command, shell=True) == 0)
if (not success):
_LOGGER.error('Command failed: %s', command)
return success
|
'Execute state command for return value.'
| @staticmethod
def _query_state_value(command):
| _LOGGER.info('Running state command: %s', command)
try:
return_value = subprocess.check_output(command, shell=True)
return return_value.strip().decode('utf-8')
except subprocess.CalledProcessError:
_LOGGER.error('Command failed: %s', command)
|
'Only poll if we have state command.'
| @property
def should_poll(self):
| return (self._command_state is not None)
|
'Return the name of the cover.'
| @property
def name(self):
| return self._name
|
'Return if the cover is closed.'
| @property
def is_closed(self):
| if (self.current_cover_position is not None):
return (self.current_cover_position == 0)
|
'Return current position of cover.
None is unknown, 0 is closed, 100 is fully open.'
| @property
def current_cover_position(self):
| return self._state
|
'Query for the state.'
| def _query_state(self):
| if (not self._command_state):
_LOGGER.error('No state command specified')
return
return self._query_state_value(self._command_state)
|
'Update device state.'
| def update(self):
| if self._command_state:
payload = str(self._query_state())
if self._value_template:
payload = self._value_template.render_with_possible_json_value(payload)
self._state = int(payload)
|
'Open the cover.'
| def open_cover(self, **kwargs):
| self._move_cover(self._command_open)
|
'Close the cover.'
| def close_cover(self, **kwargs):
| self._move_cover(self._command_close)
|
'Stop the cover.'
| def stop_cover(self, **kwargs):
| self._move_cover(self._command_stop)
|
'Initialize the cover.'
| def __init__(self, hass, args):
| self.opengarage_url = 'http://{}:{}'.format(args[CONF_HOST], args[CONF_PORT])
self.hass = hass
self._name = args[CONF_NAME]
self.device_id = args['device_id']
self._devicekey = args[CONF_DEVICEKEY]
self._state = STATE_UNKNOWN
self._state_before_move = None
self.dist = None
self.signa... |
'Return the name of the cover.'
| @property
def name(self):
| return self._name
|
'Return True if entity is available.'
| @property
def available(self):
| return self._available
|
'Return the device state attributes.'
| @property
def device_state_attributes(self):
| data = {}
if (self.signal is not None):
data[ATTR_SIGNAL_STRENGTH] = self.signal
if (self.dist is not None):
data[ATTR_DISTANCE_SENSOR] = self.dist
if (self._state is not None):
data[ATTR_DOOR_STATE] = self._state
return data
|
'Return if the cover is closed.'
| @property
def is_closed(self):
| if (self._state == STATE_UNKNOWN):
return None
return (self._state in [STATE_CLOSED, STATE_OPENING])
|
'Close the cover.'
| def close_cover(self):
| if (self._state not in [STATE_CLOSED, STATE_CLOSING]):
self._state_before_move = self._state
self._state = STATE_CLOSING
self._push_button()
|
'Open the cover.'
| def open_cover(self):
| if (self._state not in [STATE_OPEN, STATE_OPENING]):
self._state_before_move = self._state
self._state = STATE_OPENING
self._push_button()
|
'Get updated status from API.'
| def update(self):
| try:
status = self._get_status()
if (self._name is None):
if (status['name'] is not None):
self._name = status['name']
state = STATES_MAP.get(status.get('door'), STATE_UNKNOWN)
if (self._state_before_move is not None):
if (self._state_before_mo... |
'Get latest status.'
| def _get_status(self):
| url = '{}/jc'.format(self.opengarage_url)
ret = requests.get(url, timeout=10)
return ret.json()
|
'Send commands to API.'
| def _push_button(self):
| url = '{}/cc?dkey={}&click=1'.format(self.opengarage_url, self._devicekey)
try:
response = requests.get(url, timeout=10).json()
if (response['result'] == 2):
_LOGGER.error('Unable to control %s: device_key is incorrect.', self._name)
self._state = self._... |
'Return the class of this device, from component DEVICE_CLASSES.'
| @property
def device_class(self):
| return 'garage'
|
'Flag supported features.'
| @property
def supported_features(self):
| return (SUPPORT_OPEN | SUPPORT_CLOSE)
|
'Initialize the cover.'
| def __init__(self, hass, config):
| KNXMultiAddressDevice.__init__(self, hass, config, ['updown', 'stop'], optional=['setposition', 'getposition', 'getangle', 'setangle'])
self._device_class = config.config.get(CONF_DEVICE_CLASS)
self._invert_position = config.config.get(CONF_INVERT_POSITION)
self._invert_angle = config.config.get(CONF_IN... |
'Polling is needed for the KNX cover.'
| @property
def should_poll(self):
| return True
|
'Flag supported features.'
| @property
def supported_features(self):
| return self._supported_features
|
'Return if the cover is closed.'
| @property
def is_closed(self):
| if (self.current_cover_position is not None):
if (self.current_cover_position > 0):
return False
else:
return True
|
'Return current position of cover.
None is unknown, 0 is closed, 100 is fully open.'
| @property
def current_cover_position(self):
| return self._current_pos
|
'Return the position we are trying to reach: 0 - 100.'
| @property
def target_position(self):
| return self._target_pos
|
'Return current position of cover.
None is unknown, 0 is closed, 100 is fully open.'
| @property
def current_cover_tilt_position(self):
| return self._current_tilt
|
'Return the tilt angle (in %) we are trying to reach: 0 - 100.'
| @property
def target_tilt(self):
| return self._target_tilt
|
'Set new target position.'
| def set_cover_position(self, **kwargs):
| position = kwargs.get(ATTR_POSITION)
if (position is None):
return
if self._invert_position:
position = (100 - position)
self._target_pos = position
self.set_percentage('setposition', position)
_LOGGER.debug('%s: Set target position to %d', self.name, position)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.