Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
RachioRainDelay.turn_on
(self, **kwargs)
Activate a 24 hour rain delay on the controller.
Activate a 24 hour rain delay on the controller.
def turn_on(self, **kwargs) -> None: """Activate a 24 hour rain delay on the controller.""" self._controller.rachio.device.rain_delay(self._controller.controller_id, 86400) _LOGGER.debug("Starting rain delay for 24 hours")
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "self", ".", "_controller", ".", "rachio", ".", "device", ".", "rain_delay", "(", "self", ".", "_controller", ".", "controller_id", ",", "86400", ")", "_LOGGER", ".", "debu...
[ 302, 4 ]
[ 305, 57 ]
python
en
['en', 'en', 'en']
True
RachioRainDelay.turn_off
(self, **kwargs)
Resume controller functionality.
Resume controller functionality.
def turn_off(self, **kwargs) -> None: """Resume controller functionality.""" self._controller.rachio.device.rain_delay(self._controller.controller_id, 0) _LOGGER.debug("Canceling rain delay")
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "self", ".", "_controller", ".", "rachio", ".", "device", ".", "rain_delay", "(", "self", ".", "_controller", ".", "controller_id", ",", "0", ")", "_LOGGER", ".", "debug",...
[ 307, 4 ]
[ 310, 45 ]
python
en
['da', 'en', 'en']
True
RachioRainDelay.async_added_to_hass
(self)
Subscribe to updates.
Subscribe to updates.
async def async_added_to_hass(self): """Subscribe to updates.""" if KEY_RAIN_DELAY in self._controller.init_data: self._state = self._controller.init_data[ KEY_RAIN_DELAY ] / 1000 > as_timestamp(now()) # If the controller was in a rain delay state during ...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "if", "KEY_RAIN_DELAY", "in", "self", ".", "_controller", ".", "init_data", ":", "self", ".", "_state", "=", "self", ".", "_controller", ".", "init_data", "[", "KEY_RAIN_DELAY", "]", "/", "1000", ...
[ 312, 4 ]
[ 335, 9 ]
python
en
['en', 'en', 'en']
True
RachioZone.__init__
(self, person, controller, data, current_schedule)
Initialize a new Rachio Zone.
Initialize a new Rachio Zone.
def __init__(self, person, controller, data, current_schedule): """Initialize a new Rachio Zone.""" self.id = data[KEY_ID] self._zone_name = data[KEY_NAME] self._zone_number = data[KEY_ZONE_NUMBER] self._zone_enabled = data[KEY_ENABLED] self._entity_picture = data.get(KEY...
[ "def", "__init__", "(", "self", ",", "person", ",", "controller", ",", "data", ",", "current_schedule", ")", ":", "self", ".", "id", "=", "data", "[", "KEY_ID", "]", "self", ".", "_zone_name", "=", "data", "[", "KEY_NAME", "]", "self", ".", "_zone_numb...
[ 341, 4 ]
[ 354, 36 ]
python
en
['es', 'pl', 'en']
False
RachioZone.__str__
(self)
Display the zone as a string.
Display the zone as a string.
def __str__(self): """Display the zone as a string.""" return 'Rachio Zone "{}" on {}'.format(self.name, str(self._controller))
[ "def", "__str__", "(", "self", ")", ":", "return", "'Rachio Zone \"{}\" on {}'", ".", "format", "(", "self", ".", "name", ",", "str", "(", "self", ".", "_controller", ")", ")" ]
[ 356, 4 ]
[ 358, 80 ]
python
en
['en', 'en', 'en']
True
RachioZone.zone_id
(self)
How the Rachio API refers to the zone.
How the Rachio API refers to the zone.
def zone_id(self) -> str: """How the Rachio API refers to the zone.""" return self.id
[ "def", "zone_id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "id" ]
[ 361, 4 ]
[ 363, 22 ]
python
en
['en', 'en', 'en']
True
RachioZone.name
(self)
Return the friendly name of the zone.
Return the friendly name of the zone.
def name(self) -> str: """Return the friendly name of the zone.""" return self._zone_name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_zone_name" ]
[ 366, 4 ]
[ 368, 30 ]
python
en
['en', 'en', 'en']
True
RachioZone.unique_id
(self)
Return a unique id by combining controller id and zone number.
Return a unique id by combining controller id and zone number.
def unique_id(self) -> str: """Return a unique id by combining controller id and zone number.""" return f"{self._controller.controller_id}-zone-{self.zone_id}"
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "f\"{self._controller.controller_id}-zone-{self.zone_id}\"" ]
[ 371, 4 ]
[ 373, 70 ]
python
en
['en', 'en', 'en']
True
RachioZone.icon
(self)
Return the icon to display.
Return the icon to display.
def icon(self) -> str: """Return the icon to display.""" return "mdi:water"
[ "def", "icon", "(", "self", ")", "->", "str", ":", "return", "\"mdi:water\"" ]
[ 376, 4 ]
[ 378, 26 ]
python
en
['en', 'en', 'en']
True
RachioZone.zone_is_enabled
(self)
Return whether the zone is allowed to run.
Return whether the zone is allowed to run.
def zone_is_enabled(self) -> bool: """Return whether the zone is allowed to run.""" return self._zone_enabled
[ "def", "zone_is_enabled", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_zone_enabled" ]
[ 381, 4 ]
[ 383, 33 ]
python
en
['en', 'en', 'en']
True
RachioZone.entity_picture
(self)
Return the entity picture to use in the frontend, if any.
Return the entity picture to use in the frontend, if any.
def entity_picture(self): """Return the entity picture to use in the frontend, if any.""" return self._entity_picture
[ "def", "entity_picture", "(", "self", ")", ":", "return", "self", ".", "_entity_picture" ]
[ 386, 4 ]
[ 388, 35 ]
python
en
['en', 'en', 'en']
True
RachioZone.device_state_attributes
(self)
Return the optional state attributes.
Return the optional state attributes.
def device_state_attributes(self) -> dict: """Return the optional state attributes.""" props = {ATTR_ZONE_NUMBER: self._zone_number, ATTR_ZONE_SUMMARY: self._summary} if self._shade_type: props[ATTR_ZONE_SHADE] = self._shade_type if self._zone_type: props[ATTR_ZON...
[ "def", "device_state_attributes", "(", "self", ")", "->", "dict", ":", "props", "=", "{", "ATTR_ZONE_NUMBER", ":", "self", ".", "_zone_number", ",", "ATTR_ZONE_SUMMARY", ":", "self", ".", "_summary", "}", "if", "self", ".", "_shade_type", ":", "props", "[", ...
[ 391, 4 ]
[ 407, 20 ]
python
en
['en', 'en', 'en']
True
RachioZone.turn_on
(self, **kwargs)
Start watering this zone.
Start watering this zone.
def turn_on(self, **kwargs) -> None: """Start watering this zone.""" # Stop other zones first self.turn_off() # Start this zone manual_run_time = timedelta( minutes=self._person.config_entry.options.get( CONF_MANUAL_RUN_MINS, DEFAULT_MANUAL_RUN_MINS ...
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "# Stop other zones first", "self", ".", "turn_off", "(", ")", "# Start this zone", "manual_run_time", "=", "timedelta", "(", "minutes", "=", "self", ".", "_person", ".", "config...
[ 409, 4 ]
[ 426, 9 ]
python
en
['en', 'sn', 'en']
True
RachioZone.turn_off
(self, **kwargs)
Stop watering all zones.
Stop watering all zones.
def turn_off(self, **kwargs) -> None: """Stop watering all zones.""" self._controller.stop_watering()
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "self", ".", "_controller", ".", "stop_watering", "(", ")" ]
[ 428, 4 ]
[ 430, 40 ]
python
en
['en', 'nl', 'en']
True
RachioZone.set_moisture_percent
(self, percent)
Set the zone moisture percent.
Set the zone moisture percent.
def set_moisture_percent(self, percent) -> None: """Set the zone moisture percent.""" _LOGGER.debug("Setting %s moisture to %s percent", self._zone_name, percent) self._controller.rachio.zone.set_moisture_percent(self.id, percent / 100)
[ "def", "set_moisture_percent", "(", "self", ",", "percent", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Setting %s moisture to %s percent\"", ",", "self", ".", "_zone_name", ",", "percent", ")", "self", ".", "_controller", ".", "rachio", ".", "zon...
[ 432, 4 ]
[ 435, 81 ]
python
en
['en', 'bg-Latn', 'en']
True
RachioZone._async_handle_update
(self, *args, **kwargs)
Handle incoming webhook zone data.
Handle incoming webhook zone data.
def _async_handle_update(self, *args, **kwargs) -> None: """Handle incoming webhook zone data.""" if args[0][KEY_ZONE_ID] != self.zone_id: return self._summary = args[0][KEY_SUMMARY] if args[0][KEY_SUBTYPE] == SUBTYPE_ZONE_STARTED: self._state = True eli...
[ "def", "_async_handle_update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "if", "args", "[", "0", "]", "[", "KEY_ZONE_ID", "]", "!=", "self", ".", "zone_id", ":", "return", "self", ".", "_summary", "=", "args", ...
[ 438, 4 ]
[ 454, 35 ]
python
en
['pl', 'xh', 'en']
False
RachioZone.async_added_to_hass
(self)
Subscribe to updates.
Subscribe to updates.
async def async_added_to_hass(self): """Subscribe to updates.""" self._state = self.zone_id == self._current_schedule.get(KEY_ZONE_ID) self.async_on_remove( async_dispatcher_connect( self.hass, SIGNAL_RACHIO_ZONE_UPDATE, self._async_handle_update ) ...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_state", "=", "self", ".", "zone_id", "==", "self", ".", "_current_schedule", ".", "get", "(", "KEY_ZONE_ID", ")", "self", ".", "async_on_remove", "(", "async_dispatcher_connect", "(",...
[ 456, 4 ]
[ 464, 9 ]
python
en
['en', 'en', 'en']
True
RachioSchedule.__init__
(self, person, controller, data, current_schedule)
Initialize a new Rachio Schedule.
Initialize a new Rachio Schedule.
def __init__(self, person, controller, data, current_schedule): """Initialize a new Rachio Schedule.""" self._schedule_id = data[KEY_ID] self._schedule_name = data[KEY_NAME] self._duration = data[KEY_DURATION] self._schedule_enabled = data[KEY_ENABLED] self._summary = dat...
[ "def", "__init__", "(", "self", ",", "person", ",", "controller", ",", "data", ",", "current_schedule", ")", ":", "self", ".", "_schedule_id", "=", "data", "[", "KEY_ID", "]", "self", ".", "_schedule_name", "=", "data", "[", "KEY_NAME", "]", "self", ".",...
[ 470, 4 ]
[ 479, 36 ]
python
co
['es', 'co', 'en']
False
RachioSchedule.name
(self)
Return the friendly name of the schedule.
Return the friendly name of the schedule.
def name(self) -> str: """Return the friendly name of the schedule.""" return f"{self._schedule_name} Schedule"
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "f\"{self._schedule_name} Schedule\"" ]
[ 482, 4 ]
[ 484, 48 ]
python
en
['en', 'en', 'en']
True
RachioSchedule.unique_id
(self)
Return a unique id by combining controller id and schedule.
Return a unique id by combining controller id and schedule.
def unique_id(self) -> str: """Return a unique id by combining controller id and schedule.""" return f"{self._controller.controller_id}-schedule-{self._schedule_id}"
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "f\"{self._controller.controller_id}-schedule-{self._schedule_id}\"" ]
[ 487, 4 ]
[ 489, 79 ]
python
en
['en', 'en', 'en']
True
RachioSchedule.icon
(self)
Return the icon to display.
Return the icon to display.
def icon(self) -> str: """Return the icon to display.""" return "mdi:water" if self.schedule_is_enabled else "mdi:water-off"
[ "def", "icon", "(", "self", ")", "->", "str", ":", "return", "\"mdi:water\"", "if", "self", ".", "schedule_is_enabled", "else", "\"mdi:water-off\"" ]
[ 492, 4 ]
[ 494, 75 ]
python
en
['en', 'en', 'en']
True
RachioSchedule.device_state_attributes
(self)
Return the optional state attributes.
Return the optional state attributes.
def device_state_attributes(self) -> dict: """Return the optional state attributes.""" return { ATTR_SCHEDULE_SUMMARY: self._summary, ATTR_SCHEDULE_ENABLED: self.schedule_is_enabled, ATTR_SCHEDULE_DURATION: f"{round(self._duration / 60)} minutes", ATTR_SCH...
[ "def", "device_state_attributes", "(", "self", ")", "->", "dict", ":", "return", "{", "ATTR_SCHEDULE_SUMMARY", ":", "self", ".", "_summary", ",", "ATTR_SCHEDULE_ENABLED", ":", "self", ".", "schedule_is_enabled", ",", "ATTR_SCHEDULE_DURATION", ":", "f\"{round(self._dur...
[ 497, 4 ]
[ 504, 9 ]
python
en
['en', 'en', 'en']
True
RachioSchedule.schedule_is_enabled
(self)
Return whether the schedule is allowed to run.
Return whether the schedule is allowed to run.
def schedule_is_enabled(self) -> bool: """Return whether the schedule is allowed to run.""" return self._schedule_enabled
[ "def", "schedule_is_enabled", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_schedule_enabled" ]
[ 507, 4 ]
[ 509, 37 ]
python
en
['en', 'en', 'en']
True
RachioSchedule.turn_on
(self, **kwargs)
Start this schedule.
Start this schedule.
def turn_on(self, **kwargs) -> None: """Start this schedule.""" self._controller.rachio.schedulerule.start(self._schedule_id) _LOGGER.debug( "Schedule %s started on %s", self.name, self._controller.name, )
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "self", ".", "_controller", ".", "rachio", ".", "schedulerule", ".", "start", "(", "self", ".", "_schedule_id", ")", "_LOGGER", ".", "debug", "(", "\"Schedule %s started on %s\...
[ 511, 4 ]
[ 518, 9 ]
python
en
['en', 'de', 'en']
True
RachioSchedule.turn_off
(self, **kwargs)
Stop watering all zones.
Stop watering all zones.
def turn_off(self, **kwargs) -> None: """Stop watering all zones.""" self._controller.stop_watering()
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "self", ".", "_controller", ".", "stop_watering", "(", ")" ]
[ 520, 4 ]
[ 522, 40 ]
python
en
['en', 'nl', 'en']
True
RachioSchedule._async_handle_update
(self, *args, **kwargs)
Handle incoming webhook schedule data.
Handle incoming webhook schedule data.
def _async_handle_update(self, *args, **kwargs) -> None: """Handle incoming webhook schedule data.""" # Schedule ID not passed when running individual zones, so we catch that error try: if args[0][KEY_SCHEDULE_ID] == self._schedule_id: if args[0][KEY_SUBTYPE] in [SUBT...
[ "def", "_async_handle_update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "# Schedule ID not passed when running individual zones, so we catch that error", "try", ":", "if", "args", "[", "0", "]", "[", "KEY_SCHEDULE_ID", "]", "...
[ 525, 4 ]
[ 540, 35 ]
python
de
['de', 'nl', 'en']
False
RachioSchedule.async_added_to_hass
(self)
Subscribe to updates.
Subscribe to updates.
async def async_added_to_hass(self): """Subscribe to updates.""" self._state = self._schedule_id == self._current_schedule.get(KEY_SCHEDULE_ID) self.async_on_remove( async_dispatcher_connect( self.hass, SIGNAL_RACHIO_SCHEDULE_UPDATE, self._async_handle_update ...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_state", "=", "self", ".", "_schedule_id", "==", "self", ".", "_current_schedule", ".", "get", "(", "KEY_SCHEDULE_ID", ")", "self", ".", "async_on_remove", "(", "async_dispatcher_connect...
[ 542, 4 ]
[ 550, 9 ]
python
en
['en', 'en', 'en']
True
calls
(hass)
Track calls to a mock service.
Track calls to a mock service.
def calls(hass): """Track calls to a mock service.""" return async_mock_service(hass, "test", "automation")
[ "def", "calls", "(", "hass", ")", ":", "return", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")" ]
[ 47, 0 ]
[ 49, 57 ]
python
en
['en', 'en', 'en']
True
mock_devices
(hass, zigpy_device_mock, zha_device_joined_restored)
IAS device fixture.
IAS device fixture.
async def mock_devices(hass, zigpy_device_mock, zha_device_joined_restored): """IAS device fixture.""" zigpy_device = zigpy_device_mock( { 1: { "in_clusters": [general.Basic.cluster_id], "out_clusters": [general.OnOff.cluster_id], "device_type...
[ "async", "def", "mock_devices", "(", "hass", ",", "zigpy_device_mock", ",", "zha_device_joined_restored", ")", ":", "zigpy_device", "=", "zigpy_device_mock", "(", "{", "1", ":", "{", "\"in_clusters\"", ":", "[", "general", ".", "Basic", ".", "cluster_id", "]", ...
[ 53, 0 ]
[ 69, 35 ]
python
en
['es', 'sr', 'en']
False
test_triggers
(hass, mock_devices)
Test zha device triggers.
Test zha device triggers.
async def test_triggers(hass, mock_devices): """Test zha device triggers.""" zigpy_device, zha_device = mock_devices zigpy_device.device_automation_triggers = { (SHAKEN, SHAKEN): {COMMAND: COMMAND_SHAKE}, (DOUBLE_PRESS, DOUBLE_PRESS): {COMMAND: COMMAND_DOUBLE}, (SHORT_PRESS, SHORT_...
[ "async", "def", "test_triggers", "(", "hass", ",", "mock_devices", ")", ":", "zigpy_device", ",", "zha_device", "=", "mock_devices", "zigpy_device", ".", "device_automation_triggers", "=", "{", "(", "SHAKEN", ",", "SHAKEN", ")", ":", "{", "COMMAND", ":", "COMM...
[ 72, 0 ]
[ 136, 51 ]
python
br
['br', 'en', 'pl']
False
test_no_triggers
(hass, mock_devices)
Test zha device with no triggers.
Test zha device with no triggers.
async def test_no_triggers(hass, mock_devices): """Test zha device with no triggers.""" _, zha_device = mock_devices ieee_address = str(zha_device.ieee) ha_device_registry = await async_get_registry(hass) reg_device = ha_device_registry.async_get_device({("zha", ieee_address)}, set()) trigger...
[ "async", "def", "test_no_triggers", "(", "hass", ",", "mock_devices", ")", ":", "_", ",", "zha_device", "=", "mock_devices", "ieee_address", "=", "str", "(", "zha_device", ".", "ieee", ")", "ha_device_registry", "=", "await", "async_get_registry", "(", "hass", ...
[ 139, 0 ]
[ 157, 5 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_event
(hass, mock_devices, calls)
Test for remote triggers firing.
Test for remote triggers firing.
async def test_if_fires_on_event(hass, mock_devices, calls): """Test for remote triggers firing.""" zigpy_device, zha_device = mock_devices zigpy_device.device_automation_triggers = { (SHAKEN, SHAKEN): {COMMAND: COMMAND_SHAKE}, (DOUBLE_PRESS, DOUBLE_PRESS): {COMMAND: COMMAND_DOUBLE}, ...
[ "async", "def", "test_if_fires_on_event", "(", "hass", ",", "mock_devices", ",", "calls", ")", ":", "zigpy_device", ",", "zha_device", "=", "mock_devices", "zigpy_device", ".", "device_automation_triggers", "=", "{", "(", "SHAKEN", ",", "SHAKEN", ")", ":", "{", ...
[ 160, 0 ]
[ 206, 55 ]
python
en
['en', 'en', 'en']
True
test_device_offline_fires
( hass, zigpy_device_mock, zha_device_restored, calls )
Test for device offline triggers firing.
Test for device offline triggers firing.
async def test_device_offline_fires( hass, zigpy_device_mock, zha_device_restored, calls ): """Test for device offline triggers firing.""" zigpy_device = zigpy_device_mock( { 1: { "in_clusters": [general.Basic.cluster_id], "out_clusters": [general.OnOff.c...
[ "async", "def", "test_device_offline_fires", "(", "hass", ",", "zigpy_device_mock", ",", "zha_device_restored", ",", "calls", ")", ":", "zigpy_device", "=", "zigpy_device_mock", "(", "{", "1", ":", "{", "\"in_clusters\"", ":", "[", "general", ".", "Basic", ".", ...
[ 209, 0 ]
[ 274, 55 ]
python
en
['en', 'en', 'en']
True
test_exception_no_triggers
(hass, mock_devices, calls, caplog)
Test for exception on event triggers firing.
Test for exception on event triggers firing.
async def test_exception_no_triggers(hass, mock_devices, calls, caplog): """Test for exception on event triggers firing.""" _, zha_device = mock_devices ieee_address = str(zha_device.ieee) ha_device_registry = await async_get_registry(hass) reg_device = ha_device_registry.async_get_device({("zha",...
[ "async", "def", "test_exception_no_triggers", "(", "hass", ",", "mock_devices", ",", "calls", ",", "caplog", ")", ":", "_", ",", "zha_device", "=", "mock_devices", "ieee_address", "=", "str", "(", "zha_device", ".", "ieee", ")", "ha_device_registry", "=", "awa...
[ 277, 0 ]
[ 308, 59 ]
python
en
['en', 'en', 'en']
True
test_exception_bad_trigger
(hass, mock_devices, calls, caplog)
Test for exception on event triggers firing.
Test for exception on event triggers firing.
async def test_exception_bad_trigger(hass, mock_devices, calls, caplog): """Test for exception on event triggers firing.""" zigpy_device, zha_device = mock_devices zigpy_device.device_automation_triggers = { (SHAKEN, SHAKEN): {COMMAND: COMMAND_SHAKE}, (DOUBLE_PRESS, DOUBLE_PRESS): {COMMAND...
[ "async", "def", "test_exception_bad_trigger", "(", "hass", ",", "mock_devices", ",", "calls", ",", "caplog", ")", ":", "zigpy_device", ",", "zha_device", "=", "mock_devices", "zigpy_device", ".", "device_automation_triggers", "=", "{", "(", "SHAKEN", ",", "SHAKEN"...
[ 311, 0 ]
[ 350, 59 ]
python
en
['en', 'en', 'en']
True
test_smoke_test_setup_component
(hass)
Smoke test for successfully set-up with default config.
Smoke test for successfully set-up with default config.
async def test_smoke_test_setup_component(hass): """Smoke test for successfully set-up with default config.""" assert await async_setup_component(hass, sensor.DOMAIN, BASE_CONFIG) await hass.async_block_till_done() for cond in CONDITIONS: state = hass.states.get(f"sensor.volkel_{cond}") ...
[ "async", "def", "test_smoke_test_setup_component", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "sensor", ".", "DOMAIN", ",", "BASE_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "for", "cond", "in"...
[ 18, 0 ]
[ 25, 39 ]
python
en
['en', 'en', 'en']
True
test_invalid_condition
(hass)
Test if invalid condition raises.
Test if invalid condition raises.
async def test_invalid_condition(hass): """Test if invalid condition raises.""" with pytest.raises(HomeAssistantError): await condition.async_from_config( hass, { "condition": "invalid", "conditions": [ { ...
[ "async", "def", "test_invalid_condition", "(", "hass", ")", ":", "with", "pytest", ".", "raises", "(", "HomeAssistantError", ")", ":", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"invalid\"", ",", "\"conditions\...
[ 14, 0 ]
[ 29, 9 ]
python
en
['fi', 'en', 'en']
True
test_and_condition
(hass)
Test the 'and' condition.
Test the 'and' condition.
async def test_and_condition(hass): """Test the 'and' condition.""" test = await condition.async_from_config( hass, { "condition": "and", "conditions": [ { "condition": "state", "entity_id": "sensor.temperature", ...
[ "async", "def", "test_and_condition", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"and\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"state\"", ",", "\...
[ 32, 0 ]
[ 60, 21 ]
python
en
['en', 'en', 'en']
True
test_and_condition_with_template
(hass)
Test the 'and' condition.
Test the 'and' condition.
async def test_and_condition_with_template(hass): """Test the 'and' condition.""" test = await condition.async_from_config( hass, { "condition": "and", "conditions": [ { "condition": "template", "value_template": '{{...
[ "async", "def", "test_and_condition_with_template", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"and\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"templat...
[ 63, 0 ]
[ 90, 21 ]
python
en
['en', 'en', 'en']
True
test_or_condition
(hass)
Test the 'or' condition.
Test the 'or' condition.
async def test_or_condition(hass): """Test the 'or' condition.""" test = await condition.async_from_config( hass, { "condition": "or", "conditions": [ { "condition": "state", "entity_id": "sensor.temperature", ...
[ "async", "def", "test_or_condition", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"or\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"state\"", ",", "\"e...
[ 93, 0 ]
[ 121, 21 ]
python
en
['en', 'en', 'en']
True
test_or_condition_with_template
(hass)
Test the 'or' condition.
Test the 'or' condition.
async def test_or_condition_with_template(hass): """Test the 'or' condition.""" test = await condition.async_from_config( hass, { "condition": "or", "conditions": [ {'{{ states.sensor.temperature.state == "100" }}'}, { "...
[ "async", "def", "test_or_condition_with_template", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"or\"", ",", "\"conditions\"", ":", "[", "{", "'{{ states.sensor.temperature.state =...
[ 124, 0 ]
[ 148, 21 ]
python
en
['en', 'en', 'en']
True
test_not_condition
(hass)
Test the 'not' condition.
Test the 'not' condition.
async def test_not_condition(hass): """Test the 'not' condition.""" test = await condition.async_from_config( hass, { "condition": "not", "conditions": [ { "condition": "state", "entity_id": "sensor.temperature", ...
[ "async", "def", "test_not_condition", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"not\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"state\"", ",", "\...
[ 151, 0 ]
[ 182, 25 ]
python
en
['en', 'en', 'en']
True
test_not_condition_with_template
(hass)
Test the 'or' condition.
Test the 'or' condition.
async def test_not_condition_with_template(hass): """Test the 'or' condition.""" test = await condition.async_from_config( hass, { "condition": "not", "conditions": [ { "condition": "template", "value_template": '{{ ...
[ "async", "def", "test_not_condition_with_template", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"not\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"templat...
[ 185, 0 ]
[ 215, 25 ]
python
en
['en', 'en', 'en']
True
test_time_window
(hass)
Test time condition windows.
Test time condition windows.
async def test_time_window(hass): """Test time condition windows.""" sixam = dt.parse_time("06:00:00") sixpm = dt.parse_time("18:00:00") with patch( "homeassistant.helpers.condition.dt_util.now", return_value=dt.now().replace(hour=3), ): assert not condition.time(hass, after...
[ "async", "def", "test_time_window", "(", "hass", ")", ":", "sixam", "=", "dt", ".", "parse_time", "(", "\"06:00:00\"", ")", "sixpm", "=", "dt", ".", "parse_time", "(", "\"18:00:00\"", ")", "with", "patch", "(", "\"homeassistant.helpers.condition.dt_util.now\"", ...
[ 218, 0 ]
[ 249, 62 ]
python
en
['en', 'en', 'en']
True
test_time_using_input_datetime
(hass)
Test time conditions using input_datetime entities.
Test time conditions using input_datetime entities.
async def test_time_using_input_datetime(hass): """Test time conditions using input_datetime entities.""" await async_setup_component( hass, "input_datetime", { "input_datetime": { "am": {"has_date": True, "has_time": True}, "pm": {"has_date": ...
[ "async", "def", "test_time_using_input_datetime", "(", "hass", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"input_datetime\"", ",", "{", "\"input_datetime\"", ":", "{", "\"am\"", ":", "{", "\"has_date\"", ":", "True", ",", "\"has_time\"", ":", ...
[ 252, 0 ]
[ 338, 73 ]
python
en
['en', 'en', 'en']
True
test_if_numeric_state_not_raise_on_unavailable
(hass)
Test numeric_state doesn't raise on unavailable/unknown state.
Test numeric_state doesn't raise on unavailable/unknown state.
async def test_if_numeric_state_not_raise_on_unavailable(hass): """Test numeric_state doesn't raise on unavailable/unknown state.""" test = await condition.async_from_config( hass, {"condition": "numeric_state", "entity_id": "sensor.temperature", "below": 42}, ) with patch("homeassistan...
[ "async", "def", "test_if_numeric_state_not_raise_on_unavailable", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"numeric_state\"", ",", "\"entity_id\"", ":", "\"sensor.temperature\"", ...
[ 341, 0 ]
[ 355, 43 ]
python
en
['en', 'en', 'en']
True
test_state_multiple_entities
(hass)
Test with multiple entities in condition.
Test with multiple entities in condition.
async def test_state_multiple_entities(hass): """Test with multiple entities in condition.""" test = await condition.async_from_config( hass, { "condition": "and", "conditions": [ { "condition": "state", "entity_id":...
[ "async", "def", "test_state_multiple_entities", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"and\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"state\"", ...
[ 358, 0 ]
[ 384, 25 ]
python
en
['en', 'en', 'en']
True
test_multiple_states
(hass)
Test with multiple states in condition.
Test with multiple states in condition.
async def test_multiple_states(hass): """Test with multiple states in condition.""" test = await condition.async_from_config( hass, { "condition": "and", "conditions": [ { "condition": "state", "entity_id": "sensor.t...
[ "async", "def", "test_multiple_states", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"and\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"state\"", ",", ...
[ 387, 0 ]
[ 410, 25 ]
python
en
['en', 'en', 'en']
True
test_state_attribute
(hass)
Test with state attribute in condition.
Test with state attribute in condition.
async def test_state_attribute(hass): """Test with state attribute in condition.""" test = await condition.async_from_config( hass, { "condition": "and", "conditions": [ { "condition": "state", "entity_id": "sensor.t...
[ "async", "def", "test_state_attribute", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"and\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"state\"", ",", ...
[ 413, 0 ]
[ 443, 25 ]
python
en
['en', 'en', 'en']
True
test_state_attribute_boolean
(hass)
Test with boolean state attribute in condition.
Test with boolean state attribute in condition.
async def test_state_attribute_boolean(hass): """Test with boolean state attribute in condition.""" test = await condition.async_from_config( hass, { "condition": "state", "entity_id": "sensor.temperature", "attribute": "happening", "state": False,...
[ "async", "def", "test_state_attribute_boolean", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"state\"", ",", "\"entity_id\"", ":", "\"sensor.temperature\"", ",", "\"attribute\"", ...
[ 446, 0 ]
[ 468, 21 ]
python
en
['en', 'en', 'en']
True
test_state_using_input_entities
(hass)
Test state conditions using input_* entities.
Test state conditions using input_* entities.
async def test_state_using_input_entities(hass): """Test state conditions using input_* entities.""" await async_setup_component( hass, "input_text", { "input_text": { "hello": {"initial": "goodbye"}, } }, ) await async_setup_compo...
[ "async", "def", "test_state_using_input_entities", "(", "hass", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"input_text\"", ",", "{", "\"input_text\"", ":", "{", "\"hello\"", ":", "{", "\"initial\"", ":", "\"goodbye\"", "}", ",", "}", "}", ...
[ 471, 0 ]
[ 550, 21 ]
python
en
['en', 'en', 'en']
True
test_numeric_state_multiple_entities
(hass)
Test with multiple entities in condition.
Test with multiple entities in condition.
async def test_numeric_state_multiple_entities(hass): """Test with multiple entities in condition.""" test = await condition.async_from_config( hass, { "condition": "and", "conditions": [ { "condition": "numeric_state", ...
[ "async", "def", "test_numeric_state_multiple_entities", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"and\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"num...
[ 553, 0 ]
[ 579, 25 ]
python
en
['en', 'en', 'en']
True
test_numberic_state_attribute
(hass)
Test with numeric state attribute in condition.
Test with numeric state attribute in condition.
async def test_numberic_state_attribute(hass): """Test with numeric state attribute in condition.""" test = await condition.async_from_config( hass, { "condition": "and", "conditions": [ { "condition": "numeric_state", ...
[ "async", "def", "test_numberic_state_attribute", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"and\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"numeric_st...
[ 582, 0 ]
[ 612, 25 ]
python
en
['en', 'en', 'en']
True
test_numeric_state_using_input_number
(hass)
Test numeric_state conditions using input_number entities.
Test numeric_state conditions using input_number entities.
async def test_numeric_state_using_input_number(hass): """Test numeric_state conditions using input_number entities.""" await async_setup_component( hass, "input_number", { "input_number": { "low": {"min": 0, "max": 255, "initial": 10}, "high":...
[ "async", "def", "test_numeric_state_using_input_number", "(", "hass", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"input_number\"", ",", "{", "\"input_number\"", ":", "{", "\"low\"", ":", "{", "\"min\"", ":", "0", ",", "\"max\"", ":", "255", ...
[ 615, 0 ]
[ 668, 5 ]
python
en
['fr', 'en', 'en']
True
test_zone_multiple_entities
(hass)
Test with multiple entities in condition.
Test with multiple entities in condition.
async def test_zone_multiple_entities(hass): """Test with multiple entities in condition.""" test = await condition.async_from_config( hass, { "condition": "and", "conditions": [ { "condition": "zone", "entity_id": [...
[ "async", "def", "test_zone_multiple_entities", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"and\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"zone\"", "...
[ 671, 0 ]
[ 727, 25 ]
python
en
['en', 'en', 'en']
True
test_multiple_zones
(hass)
Test with multiple entities in condition.
Test with multiple entities in condition.
async def test_multiple_zones(hass): """Test with multiple entities in condition.""" test = await condition.async_from_config( hass, { "condition": "and", "conditions": [ { "condition": "zone", "entity_id": "device_t...
[ "async", "def", "test_multiple_zones", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"and\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"zone\"", ",", "\...
[ 730, 0 ]
[ 776, 25 ]
python
en
['en', 'en', 'en']
True
test_extract_entities
()
Test extracting entities.
Test extracting entities.
async def test_extract_entities(): """Test extracting entities.""" assert condition.async_extract_entities( { "condition": "and", "conditions": [ { "condition": "state", "entity_id": "sensor.temperature", ...
[ "async", "def", "test_extract_entities", "(", ")", ":", "assert", "condition", ".", "async_extract_entities", "(", "{", "\"condition\"", ":", "\"and\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"state\"", ",", "\"entity_id\"", ":", "\"sensor.t...
[ 779, 0 ]
[ 849, 5 ]
python
en
['de', 'en', 'en']
True
test_extract_devices
()
Test extracting devices.
Test extracting devices.
async def test_extract_devices(): """Test extracting devices.""" assert ( condition.async_extract_devices( { "condition": "and", "conditions": [ {"condition": "device", "device_id": "abcd", "domain": "light"}, {"conditio...
[ "async", "def", "test_extract_devices", "(", ")", ":", "assert", "(", "condition", ".", "async_extract_devices", "(", "{", "\"condition\"", ":", "\"and\"", ",", "\"conditions\"", ":", "[", "{", "\"condition\"", ":", "\"device\"", ",", "\"device_id\"", ":", "\"ab...
[ 852, 0 ]
[ 901, 5 ]
python
en
['de', 'en', 'en']
True
test_condition_template_error
(hass, caplog)
Test invalid template.
Test invalid template.
async def test_condition_template_error(hass, caplog): """Test invalid template.""" caplog.set_level(ERROR) test = await condition.async_from_config( hass, {"condition": "template", "value_template": "{{ undefined.state }}"} ) assert not test(hass) assert len(caplog.records) == 1 a...
[ "async", "def", "test_condition_template_error", "(", "hass", ",", "caplog", ")", ":", "caplog", ".", "set_level", "(", "ERROR", ")", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"template\"", ",",...
[ 904, 0 ]
[ 916, 5 ]
python
en
['en', 'et', 'en']
True
test_condition_template_invalid_results
(hass)
Test template condition render false with invalid results.
Test template condition render false with invalid results.
async def test_condition_template_invalid_results(hass): """Test template condition render false with invalid results.""" test = await condition.async_from_config( hass, {"condition": "template", "value_template": "{{ 'string' }}"} ) assert not test(hass) test = await condition.async_from_c...
[ "async", "def", "test_condition_template_invalid_results", "(", "hass", ")", ":", "test", "=", "await", "condition", ".", "async_from_config", "(", "hass", ",", "{", "\"condition\"", ":", "\"template\"", ",", "\"value_template\"", ":", "\"{{ 'string' }}\"", "}", ")"...
[ 919, 0 ]
[ 939, 25 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the eight sleep binary sensor.
Set up the eight sleep binary sensor.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the eight sleep binary sensor.""" if discovery_info is None: return name = "Eight" sensors = discovery_info[CONF_BINARY_SENSORS] eight = hass.data[DATA_EIGHT] all_sensors = [] for sens...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "name", "=", "\"Eight\"", "sensors", "=", "discovery_info", "[", "...
[ 10, 0 ]
[ 24, 41 ]
python
en
['en', 'ceb', 'en']
True
EightHeatSensor.__init__
(self, name, eight, sensor)
Initialize the sensor.
Initialize the sensor.
def __init__(self, name, eight, sensor): """Initialize the sensor.""" super().__init__(eight) self._sensor = sensor self._mapped_name = NAME_MAP.get(self._sensor, self._sensor) self._name = f"{name} {self._mapped_name}" self._state = None self._side = self._sens...
[ "def", "__init__", "(", "self", ",", "name", ",", "eight", ",", "sensor", ")", ":", "super", "(", ")", ".", "__init__", "(", "eight", ")", "self", ".", "_sensor", "=", "sensor", "self", ".", "_mapped_name", "=", "NAME_MAP", ".", "get", "(", "self", ...
[ 30, 4 ]
[ 48, 9 ]
python
en
['en', 'en', 'en']
True
EightHeatSensor.name
(self)
Return the name of the sensor, if any.
Return the name of the sensor, if any.
def name(self): """Return the name of the sensor, if any.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 51, 4 ]
[ 53, 25 ]
python
en
['en', 'en', 'en']
True
EightHeatSensor.is_on
(self)
Return true if the binary sensor is on.
Return true if the binary sensor is on.
def is_on(self): """Return true if the binary sensor is on.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 56, 4 ]
[ 58, 26 ]
python
en
['en', 'fy', 'en']
True
EightHeatSensor.async_update
(self)
Retrieve latest state.
Retrieve latest state.
async def async_update(self): """Retrieve latest state.""" self._state = self._usrobj.bed_presence
[ "async", "def", "async_update", "(", "self", ")", ":", "self", ".", "_state", "=", "self", ".", "_usrobj", ".", "bed_presence" ]
[ 60, 4 ]
[ 62, 47 ]
python
en
['es', 'sk', 'en']
False
zigpy_device
(zigpy_device_mock)
Device tracker zigpy device.
Device tracker zigpy device.
def zigpy_device(zigpy_device_mock): """Device tracker zigpy device.""" endpoints = { 1: { "in_clusters": [general.Basic.cluster_id, general.OnOff.cluster_id], "out_clusters": [], "device_type": zha.DeviceType.ON_OFF_SWITCH, } } return zigpy_device_moc...
[ "def", "zigpy_device", "(", "zigpy_device_mock", ")", ":", "endpoints", "=", "{", "1", ":", "{", "\"in_clusters\"", ":", "[", "general", ".", "Basic", ".", "cluster_id", ",", "general", ".", "OnOff", ".", "cluster_id", "]", ",", "\"out_clusters\"", ":", "[...
[ 29, 0 ]
[ 38, 39 ]
python
cs
['nl', 'cs', 'en']
False
coordinator
(hass, zigpy_device_mock, zha_device_joined)
Test zha light platform.
Test zha light platform.
async def coordinator(hass, zigpy_device_mock, zha_device_joined): """Test zha light platform.""" zigpy_device = zigpy_device_mock( { 1: { "in_clusters": [], "out_clusters": [], "device_type": zha.DeviceType.COLOR_DIMMABLE_LIGHT, }...
[ "async", "def", "coordinator", "(", "hass", ",", "zigpy_device_mock", ",", "zha_device_joined", ")", ":", "zigpy_device", "=", "zigpy_device_mock", "(", "{", "1", ":", "{", "\"in_clusters\"", ":", "[", "]", ",", "\"out_clusters\"", ":", "[", "]", ",", "\"dev...
[ 42, 0 ]
[ 59, 21 ]
python
cs
['cs', 'lb', 'pl']
False
device_switch_1
(hass, zigpy_device_mock, zha_device_joined)
Test zha switch platform.
Test zha switch platform.
async def device_switch_1(hass, zigpy_device_mock, zha_device_joined): """Test zha switch platform.""" zigpy_device = zigpy_device_mock( { 1: { "in_clusters": [general.OnOff.cluster_id], "out_clusters": [], "device_type": zha.DeviceType.COLOR_...
[ "async", "def", "device_switch_1", "(", "hass", ",", "zigpy_device_mock", ",", "zha_device_joined", ")", ":", "zigpy_device", "=", "zigpy_device_mock", "(", "{", "1", ":", "{", "\"in_clusters\"", ":", "[", "general", ".", "OnOff", ".", "cluster_id", "]", ",", ...
[ 63, 0 ]
[ 78, 21 ]
python
pl
['cs', 'pl', 'pl']
True
device_switch_2
(hass, zigpy_device_mock, zha_device_joined)
Test zha switch platform.
Test zha switch platform.
async def device_switch_2(hass, zigpy_device_mock, zha_device_joined): """Test zha switch platform.""" zigpy_device = zigpy_device_mock( { 1: { "in_clusters": [general.OnOff.cluster_id], "out_clusters": [], "device_type": zha.DeviceType.COLOR_...
[ "async", "def", "device_switch_2", "(", "hass", ",", "zigpy_device_mock", ",", "zha_device_joined", ")", ":", "zigpy_device", "=", "zigpy_device_mock", "(", "{", "1", ":", "{", "\"in_clusters\"", ":", "[", "general", ".", "OnOff", ".", "cluster_id", "]", ",", ...
[ 82, 0 ]
[ 97, 21 ]
python
pl
['cs', 'pl', 'pl']
True
test_switch
(hass, zha_device_joined_restored, zigpy_device)
Test zha switch platform.
Test zha switch platform.
async def test_switch(hass, zha_device_joined_restored, zigpy_device): """Test zha switch platform.""" zha_device = await zha_device_joined_restored(zigpy_device) cluster = zigpy_device.endpoints.get(1).on_off entity_id = await find_entity_id(DOMAIN, zha_device, hass) assert entity_id is not None ...
[ "async", "def", "test_switch", "(", "hass", ",", "zha_device_joined_restored", ",", "zigpy_device", ")", ":", "zha_device", "=", "await", "zha_device_joined_restored", "(", "zigpy_device", ")", "cluster", "=", "zigpy_device", ".", "endpoints", ".", "get", "(", "1"...
[ 100, 0 ]
[ 156, 64 ]
python
pl
['cs', 'pl', 'pl']
True
async_test_zha_group_switch_entity
( hass, device_switch_1, device_switch_2, coordinator )
Test the switch entity for a ZHA group.
Test the switch entity for a ZHA group.
async def async_test_zha_group_switch_entity( hass, device_switch_1, device_switch_2, coordinator ): """Test the switch entity for a ZHA group.""" zha_gateway = get_zha_gateway(hass) assert zha_gateway is not None zha_gateway.coordinator_zha_device = coordinator coordinator._zha_gateway = zha_ga...
[ "async", "def", "async_test_zha_group_switch_entity", "(", "hass", ",", "device_switch_1", ",", "device_switch_2", ",", "coordinator", ")", ":", "zha_gateway", "=", "get_zha_gateway", "(", "hass", ")", "assert", "zha_gateway", "is", "not", "None", "zha_gateway", "."...
[ 159, 0 ]
[ 248, 55 ]
python
en
['en', 'en', 'en']
True
run
(args: List)
Run a script.
Run a script.
def run(args: List) -> int: """Run a script.""" scripts = [] path = os.path.dirname(__file__) for fil in os.listdir(path): if fil == "__pycache__": continue if os.path.isdir(os.path.join(path, fil)): scripts.append(fil) elif fil != "__init__.py" and fil.e...
[ "def", "run", "(", "args", ":", "List", ")", "->", "int", ":", "scripts", "=", "[", "]", "path", "=", "os", ".", "path", ".", "dirname", "(", "__file__", ")", "for", "fil", "in", "os", ".", "listdir", "(", "path", ")", ":", "if", "fil", "==", ...
[ 18, 0 ]
[ 64, 31 ]
python
co
['es', 'co', 'en']
False
extract_config_dir
(args: Optional[Sequence[Text]] = None)
Extract the config dir from the arguments or get the default.
Extract the config dir from the arguments or get the default.
def extract_config_dir(args: Optional[Sequence[Text]] = None) -> str: """Extract the config dir from the arguments or get the default.""" parser = argparse.ArgumentParser(add_help=False) parser.add_argument("-c", "--config", default=None) parsed_args = parser.parse_known_args(args)[0] return ( ...
[ "def", "extract_config_dir", "(", "args", ":", "Optional", "[", "Sequence", "[", "Text", "]", "]", "=", "None", ")", "->", "str", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "add_help", "=", "False", ")", "parser", ".", "add_argument", "(...
[ 67, 0 ]
[ 76, 5 ]
python
en
['en', 'en', 'en']
True
GaussianProcess_QuasiPeriodicActivity.convert_val2gp
(self, input_pams)
:param input_pam: dictonary with the 'physically meaningful' parameters of the GP kernel :return: dictonary with the parameters to be fed to 'george' WARNING: this subroutine is HIGHLY specific of your choice of the kernel! I reccomend to create a new Class with different transformation...
:param input_pam: dictonary with the 'physically meaningful' parameters of the GP kernel :return: dictonary with the parameters to be fed to 'george' WARNING: this subroutine is HIGHLY specific of your choice of the kernel! I reccomend to create a new Class with different transformation...
def convert_val2gp(self, input_pams): """ :param input_pam: dictonary with the 'physically meaningful' parameters of the GP kernel :return: dictonary with the parameters to be fed to 'george' WARNING: this subroutine is HIGHLY specific of your choice of the kernel! I reccomend to ...
[ "def", "convert_val2gp", "(", "self", ",", "input_pams", ")", ":", "output_pams", "=", "np", ".", "zeros", "(", "self", ".", "n_pams", ",", "dtype", "=", "np", ".", "double", ")", "\"\"\" You must check _george_ documentation (and possibily do a lot of testing) to kno...
[ 57, 4 ]
[ 76, 26 ]
python
en
['en', 'error', 'th']
False
GaussianProcess_QuasiPeriodicActivity.convert_gp2val
(self, input_pams)
:param input_pam: dictonary with the parameters to be fed to 'george' :return: dictonary with the 'physically meaningful' parameters of the GP kernel WARNING: this subroutine is HIGHLY specific of your choice of the kernel! I reccomend to create a new Class with different transformation...
:param input_pam: dictonary with the parameters to be fed to 'george' :return: dictonary with the 'physically meaningful' parameters of the GP kernel WARNING: this subroutine is HIGHLY specific of your choice of the kernel! I reccomend to create a new Class with different transformation...
def convert_gp2val(self, input_pams): """ :param input_pam: dictonary with the parameters to be fed to 'george' :return: dictonary with the 'physically meaningful' parameters of the GP kernel WARNING: this subroutine is HIGHLY specific of your choice of the kernel! I reccomend to ...
[ "def", "convert_gp2val", "(", "self", ",", "input_pams", ")", ":", "return", "{", "'Hamp'", ":", "np", ".", "exp", "(", "input_pams", "[", "self", ".", "gp_pams_index", "[", "'Hamp'", "]", "]", "/", "2.0", ")", ",", "'Pdec'", ":", "np", ".", "exp", ...
[ 78, 4 ]
[ 91, 9 ]
python
en
['en', 'error', 'th']
False
GaussianProcess_QuasiPeriodicActivity.define_kernel
(self, dataset)
Kernel initialized with fake values... don't worry, they'll be overwritten soon
Kernel initialized with fake values... don't worry, they'll be overwritten soon
def define_kernel(self, dataset): gp_pams = np.ones(self.n_pams) """ Kernel initialized with fake values... don't worry, they'll be overwritten soon""" kernel = np.exp(gp_pams[0]) * \ george.kernels.ExpSquaredKernel(metric=np.exp(gp_pams[1])) * \ geor...
[ "def", "define_kernel", "(", "self", ",", "dataset", ")", ":", "gp_pams", "=", "np", ".", "ones", "(", "self", ".", "n_pams", ")", "kernel", "=", "np", ".", "exp", "(", "gp_pams", "[", "0", "]", ")", "*", "george", ".", "kernels", ".", "ExpSquaredK...
[ 102, 4 ]
[ 135, 14 ]
python
en
['en', 'en', 'en']
True
GaussianProcess_QuasiPeriodicActivity.lnlk_compute
(self, variable_value, dataset)
2 steps: 1) theta parameters must be converted in physical units (e.g. from logarithmic to linear spaces) 2) physical values must be converted to {\tt george} input parameters
2 steps: 1) theta parameters must be converted in physical units (e.g. from logarithmic to linear spaces) 2) physical values must be converted to {\tt george} input parameters
def lnlk_compute(self, variable_value, dataset): """ 2 steps: 1) theta parameters must be converted in physical units (e.g. from logarithmic to linear spaces) 2) physical values must be converted to {\tt george} input parameters """ gp_pams = self.convert_val2gp(variable_va...
[ "def", "lnlk_compute", "(", "self", ",", "variable_value", ",", "dataset", ")", ":", "gp_pams", "=", "self", ".", "convert_val2gp", "(", "variable_value", ")", "env", "=", "np", ".", "sqrt", "(", "dataset", ".", "e", "**", "2.0", "+", "dataset", ".", "...
[ 137, 4 ]
[ 147, 86 ]
python
en
['en', 'sk', 'en']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up Tahoma switches.
Set up Tahoma switches.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up Tahoma switches.""" if discovery_info is None: return controller = hass.data[TAHOMA_DOMAIN]["controller"] devices = [] for switch in hass.data[TAHOMA_DOMAIN]["devices"]["switch"]: devices.append(TahomaSwit...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "controller", "=", "hass", ".", "data", "[", "TAHOMA_DOMAIN", "]", "[", "\"controller...
[ 13, 0 ]
[ 21, 31 ]
python
en
['en', 'en', 'en']
True
TahomaSwitch.__init__
(self, tahoma_device, controller)
Initialize the switch.
Initialize the switch.
def __init__(self, tahoma_device, controller): """Initialize the switch.""" super().__init__(tahoma_device, controller) self._state = STATE_OFF self._skip_update = False self._available = False
[ "def", "__init__", "(", "self", ",", "tahoma_device", ",", "controller", ")", ":", "super", "(", ")", ".", "__init__", "(", "tahoma_device", ",", "controller", ")", "self", ".", "_state", "=", "STATE_OFF", "self", ".", "_skip_update", "=", "False", "self",...
[ 27, 4 ]
[ 32, 31 ]
python
en
['en', 'en', 'en']
True
TahomaSwitch.update
(self)
Update method.
Update method.
def update(self): """Update method.""" # Postpone the immediate state check for changes that take time. if self._skip_update: self._skip_update = False return self.controller.get_states([self.tahoma_device]) if self.tahoma_device.type == "io:OnOffLightIO...
[ "def", "update", "(", "self", ")", ":", "# Postpone the immediate state check for changes that take time.", "if", "self", ".", "_skip_update", ":", "self", ".", "_skip_update", "=", "False", "return", "self", ".", "controller", ".", "get_states", "(", "[", "self", ...
[ 34, 4 ]
[ 66, 70 ]
python
en
['en', 'nl', 'en']
False
TahomaSwitch.device_class
(self)
Return the class of the device.
Return the class of the device.
def device_class(self): """Return the class of the device.""" if self.tahoma_device.type == "rts:GarageDoor4TRTSComponent": return "garage" return None
[ "def", "device_class", "(", "self", ")", ":", "if", "self", ".", "tahoma_device", ".", "type", "==", "\"rts:GarageDoor4TRTSComponent\"", ":", "return", "\"garage\"", "return", "None" ]
[ 69, 4 ]
[ 73, 19 ]
python
en
['en', 'en', 'en']
True
TahomaSwitch.turn_on
(self, **kwargs)
Send the on command.
Send the on command.
def turn_on(self, **kwargs): """Send the on command.""" _LOGGER.debug("Turn on: %s", self._name) if self.tahoma_device.type == "rts:GarageDoor4TRTSComponent": self.toggle() else: self.apply_action("on") self._skip_update = True self._state ...
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "_LOGGER", ".", "debug", "(", "\"Turn on: %s\"", ",", "self", ".", "_name", ")", "if", "self", ".", "tahoma_device", ".", "type", "==", "\"rts:GarageDoor4TRTSComponent\"", ":", "self", ".", ...
[ 75, 4 ]
[ 83, 34 ]
python
en
['en', 'en', 'en']
True
TahomaSwitch.turn_off
(self, **kwargs)
Send the off command.
Send the off command.
def turn_off(self, **kwargs): """Send the off command.""" _LOGGER.debug("Turn off: %s", self._name) if self.tahoma_device.type == "rts:GarageDoor4TRTSComponent": return self.apply_action("off") self._skip_update = True self._state = STATE_OFF
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "_LOGGER", ".", "debug", "(", "\"Turn off: %s\"", ",", "self", ".", "_name", ")", "if", "self", ".", "tahoma_device", ".", "type", "==", "\"rts:GarageDoor4TRTSComponent\"", ":", "return", "...
[ 85, 4 ]
[ 93, 31 ]
python
en
['en', 'en', 'en']
True
TahomaSwitch.toggle
(self, **kwargs)
Click the switch.
Click the switch.
def toggle(self, **kwargs): """Click the switch.""" self.apply_action("cycle")
[ "def", "toggle", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "apply_action", "(", "\"cycle\"", ")" ]
[ 95, 4 ]
[ 97, 34 ]
python
en
['en', 'en', 'en']
True
TahomaSwitch.is_on
(self)
Get whether the switch is in on state.
Get whether the switch is in on state.
def is_on(self): """Get whether the switch is in on state.""" if self.tahoma_device.type == "rts:GarageDoor4TRTSComponent": return False return bool(self._state == STATE_ON)
[ "def", "is_on", "(", "self", ")", ":", "if", "self", ".", "tahoma_device", ".", "type", "==", "\"rts:GarageDoor4TRTSComponent\"", ":", "return", "False", "return", "bool", "(", "self", ".", "_state", "==", "STATE_ON", ")" ]
[ 100, 4 ]
[ 104, 44 ]
python
en
['en', 'en', 'en']
True
TahomaSwitch.device_state_attributes
(self)
Return the device state attributes.
Return the device state attributes.
def device_state_attributes(self): """Return the device state attributes.""" attr = {} super_attr = super().device_state_attributes if super_attr is not None: attr.update(super_attr) if "core:RSSILevelState" in self.tahoma_device.active_states: attr[ATTR_...
[ "def", "device_state_attributes", "(", "self", ")", ":", "attr", "=", "{", "}", "super_attr", "=", "super", "(", ")", ".", "device_state_attributes", "if", "super_attr", "is", "not", "None", ":", "attr", ".", "update", "(", "super_attr", ")", "if", "\"core...
[ 107, 4 ]
[ 118, 19 ]
python
en
['en', 'en', 'en']
True
TahomaSwitch.available
(self)
Return True if entity is available.
Return True if entity is available.
def available(self): """Return True if entity is available.""" return self._available
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_available" ]
[ 121, 4 ]
[ 123, 30 ]
python
en
['en', 'en', 'en']
True
get_scanner
(hass, config)
Validate the configuration and return a Bbox scanner.
Validate the configuration and return a Bbox scanner.
def get_scanner(hass, config): """Validate the configuration and return a Bbox scanner.""" scanner = BboxDeviceScanner(config[DOMAIN]) return scanner if scanner.success_init else None
[ "def", "get_scanner", "(", "hass", ",", "config", ")", ":", "scanner", "=", "BboxDeviceScanner", "(", "config", "[", "DOMAIN", "]", ")", "return", "scanner", "if", "scanner", ".", "success_init", "else", "None" ]
[ 30, 0 ]
[ 34, 52 ]
python
en
['en', 'en', 'en']
True
BboxDeviceScanner.__init__
(self, config)
Get host from config.
Get host from config.
def __init__(self, config): """Get host from config.""" self.host = config[CONF_HOST] """Initialize the scanner.""" self.last_results: List[Device] = [] self.success_init = self._update_info() _LOGGER.info("Scanner initialized")
[ "def", "__init__", "(", "self", ",", "config", ")", ":", "self", ".", "host", "=", "config", "[", "CONF_HOST", "]", "\"\"\"Initialize the scanner.\"\"\"", "self", ".", "last_results", ":", "List", "[", "Device", "]", "=", "[", "]", "self", ".", "success_in...
[ 43, 4 ]
[ 52, 43 ]
python
en
['en', 'en', 'en']
True
BboxDeviceScanner.scan_devices
(self)
Scan for new devices and return a list with found device IDs.
Scan for new devices and return a list with found device IDs.
def scan_devices(self): """Scan for new devices and return a list with found device IDs.""" self._update_info() return [device.mac for device in self.last_results]
[ "def", "scan_devices", "(", "self", ")", ":", "self", ".", "_update_info", "(", ")", "return", "[", "device", ".", "mac", "for", "device", "in", "self", ".", "last_results", "]" ]
[ 54, 4 ]
[ 58, 59 ]
python
en
['en', 'en', 'en']
True
BboxDeviceScanner.get_device_name
(self, device)
Return the name of the given device or None if we don't know.
Return the name of the given device or None if we don't know.
def get_device_name(self, device): """Return the name of the given device or None if we don't know.""" filter_named = [ result.name for result in self.last_results if result.mac == device ] if filter_named: return filter_named[0] return None
[ "def", "get_device_name", "(", "self", ",", "device", ")", ":", "filter_named", "=", "[", "result", ".", "name", "for", "result", "in", "self", ".", "last_results", "if", "result", ".", "mac", "==", "device", "]", "if", "filter_named", ":", "return", "fi...
[ 60, 4 ]
[ 68, 19 ]
python
en
['en', 'en', 'en']
True
BboxDeviceScanner._update_info
(self)
Check the Bbox for devices. Returns boolean if scanning successful.
Check the Bbox for devices.
def _update_info(self): """Check the Bbox for devices. Returns boolean if scanning successful. """ _LOGGER.info("Scanning...") box = pybbox.Bbox(ip=self.host) result = box.get_all_connected_devices() now = dt_util.now() last_results = [] for dev...
[ "def", "_update_info", "(", "self", ")", ":", "_LOGGER", ".", "info", "(", "\"Scanning...\"", ")", "box", "=", "pybbox", ".", "Bbox", "(", "ip", "=", "self", ".", "host", ")", "result", "=", "box", ".", "get_all_connected_devices", "(", ")", "now", "="...
[ 71, 4 ]
[ 95, 19 ]
python
en
['en', 'en', 'en']
True
AbstractOpenWeatherMapSensor.__init__
( self, name, unique_id, sensor_type, sensor_configuration, coordinator: DataUpdateCoordinator, )
Initialize the sensor.
Initialize the sensor.
def __init__( self, name, unique_id, sensor_type, sensor_configuration, coordinator: DataUpdateCoordinator, ): """Initialize the sensor.""" self._name = name self._unique_id = unique_id self._sensor_type = sensor_type self._sens...
[ "def", "__init__", "(", "self", ",", "name", ",", "unique_id", ",", "sensor_type", ",", "sensor_configuration", ",", "coordinator", ":", "DataUpdateCoordinator", ",", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_unique_id", "=", "unique_id", "...
[ 11, 4 ]
[ 26, 39 ]
python
en
['en', 'en', 'en']
True
AbstractOpenWeatherMapSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return f"{self._name} {self._sensor_name}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self._name} {self._sensor_name}\"" ]
[ 29, 4 ]
[ 31, 50 ]
python
en
['en', 'mi', 'en']
True
AbstractOpenWeatherMapSensor.unique_id
(self)
Return a unique_id for this entity.
Return a unique_id for this entity.
def unique_id(self): """Return a unique_id for this entity.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 34, 4 ]
[ 36, 30 ]
python
en
['en', 'en', 'en']
True
AbstractOpenWeatherMapSensor.should_poll
(self)
Return the polling requirement of the entity.
Return the polling requirement of the entity.
def should_poll(self): """Return the polling requirement of the entity.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 39, 4 ]
[ 41, 20 ]
python
en
['en', 'en', 'en']
True
AbstractOpenWeatherMapSensor.attribution
(self)
Return the attribution.
Return the attribution.
def attribution(self): """Return the attribution.""" return ATTRIBUTION
[ "def", "attribution", "(", "self", ")", ":", "return", "ATTRIBUTION" ]
[ 44, 4 ]
[ 46, 26 ]
python
en
['en', 'ja', 'en']
True
AbstractOpenWeatherMapSensor.device_class
(self)
Return the device_class.
Return the device_class.
def device_class(self): """Return the device_class.""" return self._device_class
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_device_class" ]
[ 49, 4 ]
[ 51, 33 ]
python
en
['en', 'en', 'en']
True
AbstractOpenWeatherMapSensor.unit_of_measurement
(self)
Return the unit of measurement of this entity, if any.
Return the unit of measurement of this entity, if any.
def unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 54, 4 ]
[ 56, 40 ]
python
en
['en', 'en', 'en']
True
AbstractOpenWeatherMapSensor.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" return {ATTR_ATTRIBUTION: ATTRIBUTION}
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_ATTRIBUTION", ":", "ATTRIBUTION", "}" ]
[ 59, 4 ]
[ 61, 46 ]
python
en
['en', 'en', 'en']
True