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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
MaxCubeClimate.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
device = self._cubehandle.cube.device_by_rf(self._rf_address)
return device.actual_temperature | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"device",
"=",
"self",
".",
"_cubehandle",
".",
"cube",
".",
"device_by_rf",
"(",
"self",
".",
"_rf_address",
")",
"return",
"device",
".",
"actual_temperature"
] | [
125,
4
] | [
128,
40
] | python | en | ['en', 'la', 'en'] | True |
MaxCubeClimate.hvac_mode | (self) | Return current operation mode. | Return current operation mode. | def hvac_mode(self):
"""Return current operation mode."""
device = self._cubehandle.cube.device_by_rf(self._rf_address)
if device.mode in [MAX_DEVICE_MODE_AUTOMATIC, MAX_DEVICE_MODE_BOOST]:
return HVAC_MODE_AUTO
if (
device.mode == MAX_DEVICE_MODE_MANUAL
... | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"device",
"=",
"self",
".",
"_cubehandle",
".",
"cube",
".",
"device_by_rf",
"(",
"self",
".",
"_rf_address",
")",
"if",
"device",
".",
"mode",
"in",
"[",
"MAX_DEVICE_MODE_AUTOMATIC",
",",
"MAX_DEVICE_MODE_BOOST",
"... | [
131,
4
] | [
142,
29
] | python | da | ['nl', 'da', 'en'] | False |
MaxCubeClimate.hvac_modes | (self) | Return the list of available operation modes. | Return the list of available operation modes. | def hvac_modes(self):
"""Return the list of available operation modes."""
return [HVAC_MODE_OFF, HVAC_MODE_AUTO, HVAC_MODE_HEAT] | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"return",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_AUTO",
",",
"HVAC_MODE_HEAT",
"]"
] | [
145,
4
] | [
147,
62
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.set_hvac_mode | (self, hvac_mode: str) | Set new target hvac mode. | Set new target hvac mode. | def set_hvac_mode(self, hvac_mode: str):
"""Set new target hvac mode."""
device = self._cubehandle.cube.device_by_rf(self._rf_address)
temp = device.target_temperature
mode = MAX_DEVICE_MODE_MANUAL
if hvac_mode == HVAC_MODE_OFF:
temp = OFF_TEMPERATURE
elif hv... | [
"def",
"set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
":",
"str",
")",
":",
"device",
"=",
"self",
".",
"_cubehandle",
".",
"cube",
".",
"device_by_rf",
"(",
"self",
".",
"_rf_address",
")",
"temp",
"=",
"device",
".",
"target_temperature",
"mode",
"=",
... | [
149,
4
] | [
173,
22
] | python | da | ['da', 'su', 'en'] | False |
MaxCubeClimate.hvac_action | (self) | Return the current running hvac operation if supported. | Return the current running hvac operation if supported. | def hvac_action(self):
"""Return the current running hvac operation if supported."""
cube = self._cubehandle.cube
device = cube.device_by_rf(self._rf_address)
valve = 0
if cube.is_thermostat(device):
valve = device.valve_position
elif cube.is_wallthermostat(d... | [
"def",
"hvac_action",
"(",
"self",
")",
":",
"cube",
"=",
"self",
".",
"_cubehandle",
".",
"cube",
"device",
"=",
"cube",
".",
"device_by_rf",
"(",
"self",
".",
"_rf_address",
")",
"valve",
"=",
"0",
"if",
"cube",
".",
"is_thermostat",
"(",
"device",
"... | [
176,
4
] | [
198,
9
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self):
"""Return the temperature we try to reach."""
device = self._cubehandle.cube.device_by_rf(self._rf_address)
if (
device.target_temperature is None
or device.target_temperature < self.min_temp
or device.target_temperature > self.ma... | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"device",
"=",
"self",
".",
"_cubehandle",
".",
"cube",
".",
"device_by_rf",
"(",
"self",
".",
"_rf_address",
")",
"if",
"(",
"device",
".",
"target_temperature",
"is",
"None",
"or",
"device",
".",
"targe... | [
201,
4
] | [
210,
40
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.set_temperature | (self, **kwargs) | Set new target temperatures. | Set new target temperatures. | def set_temperature(self, **kwargs):
"""Set new target temperatures."""
if kwargs.get(ATTR_TEMPERATURE) is None:
return False
target_temperature = kwargs.get(ATTR_TEMPERATURE)
device = self._cubehandle.cube.device_by_rf(self._rf_address)
cube = self._cubehandle.cube... | [
"def",
"set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"is",
"None",
":",
"return",
"False",
"target_temperature",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"device... | [
212,
4
] | [
227,
28
] | python | en | ['en', 'ca', 'en'] | True |
MaxCubeClimate.preset_mode | (self) | Return the current preset mode. | Return the current preset mode. | def preset_mode(self):
"""Return the current preset mode."""
device = self._cubehandle.cube.device_by_rf(self._rf_address)
if self.hvac_mode == HVAC_MODE_OFF:
return PRESET_NONE
if device.mode == MAX_DEVICE_MODE_MANUAL:
if device.target_temperature == device.comf... | [
"def",
"preset_mode",
"(",
"self",
")",
":",
"device",
"=",
"self",
".",
"_cubehandle",
".",
"cube",
".",
"device_by_rf",
"(",
"self",
".",
"_rf_address",
")",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
":",
"return",
"PRESET_NONE",
"if",
"devi... | [
230,
4
] | [
245,
51
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.preset_modes | (self) | Return available preset modes. | Return available preset modes. | def preset_modes(self):
"""Return available preset modes."""
return [
PRESET_NONE,
PRESET_BOOST,
PRESET_COMFORT,
PRESET_ECO,
PRESET_AWAY,
PRESET_ON,
] | [
"def",
"preset_modes",
"(",
"self",
")",
":",
"return",
"[",
"PRESET_NONE",
",",
"PRESET_BOOST",
",",
"PRESET_COMFORT",
",",
"PRESET_ECO",
",",
"PRESET_AWAY",
",",
"PRESET_ON",
",",
"]"
] | [
248,
4
] | [
257,
9
] | python | en | ['fr', 'en', 'en'] | True |
MaxCubeClimate.set_preset_mode | (self, preset_mode) | Set new operation mode. | Set new operation mode. | def set_preset_mode(self, preset_mode):
"""Set new operation mode."""
device = self._cubehandle.cube.device_by_rf(self._rf_address)
temp = device.target_temperature
mode = MAX_DEVICE_MODE_AUTOMATIC
if preset_mode in [PRESET_COMFORT, PRESET_ECO, PRESET_ON]:
mode = MAX... | [
"def",
"set_preset_mode",
"(",
"self",
",",
"preset_mode",
")",
":",
"device",
"=",
"self",
".",
"_cubehandle",
".",
"cube",
".",
"device_by_rf",
"(",
"self",
".",
"_rf_address",
")",
"temp",
"=",
"device",
".",
"target_temperature",
"mode",
"=",
"MAX_DEVICE... | [
259,
4
] | [
281,
22
] | python | en | ['en', 'ny', 'en'] | True |
MaxCubeClimate.device_state_attributes | (self) | Return the optional state attributes. | Return the optional state attributes. | def device_state_attributes(self):
"""Return the optional state attributes."""
cube = self._cubehandle.cube
device = cube.device_by_rf(self._rf_address)
if not cube.is_thermostat(device):
return {}
return {ATTR_VALVE_POSITION: device.valve_position} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"cube",
"=",
"self",
".",
"_cubehandle",
".",
"cube",
"device",
"=",
"cube",
".",
"device_by_rf",
"(",
"self",
".",
"_rf_address",
")",
"if",
"not",
"cube",
".",
"is_thermostat",
"(",
"device",
")",
... | [
284,
4
] | [
291,
59
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.update | (self) | Get latest data from MAX! Cube. | Get latest data from MAX! Cube. | def update(self):
"""Get latest data from MAX! Cube."""
self._cubehandle.update() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_cubehandle",
".",
"update",
"(",
")"
] | [
293,
4
] | [
295,
33
] | python | en | ['en', 'en', 'en'] | True |
test_default_state | (hass) | Test light switch default state. | Test light switch default state. | async def test_default_state(hass):
"""Test light switch default state."""
await async_setup_component(
hass,
"light",
{
"light": {
"platform": "switch",
"entity_id": "switch.test",
"name": "Christmas Tree Lights",
}... | [
"async",
"def",
"test_default_state",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"switch\"",
",",
"\"entity_id\"",
":",
"\"switch.test\"",
",",
"\"name\"",
":",
... | [
8,
0
] | [
32,
49
] | python | en | ['de', 'en', 'en'] | True |
test_light_service_calls | (hass) | Test service calls to light. | Test service calls to light. | async def test_light_service_calls(hass):
"""Test service calls to light."""
await async_setup_component(hass, "switch", {"switch": [{"platform": "demo"}]})
await async_setup_component(
hass,
"light",
{"light": [{"platform": "switch", "entity_id": "switch.decorative_lights"}]},
)... | [
"async",
"def",
"test_light_service_calls",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"switch\"",
",",
"{",
"\"switch\"",
":",
"[",
"{",
"\"platform\"",
":",
"\"demo\"",
"}",
"]",
"}",
")",
"await",
"async_setup_component",
"... | [
35,
0
] | [
61,
63
] | python | en | ['en', 'en', 'en'] | True |
test_switch_service_calls | (hass) | Test service calls to switch. | Test service calls to switch. | async def test_switch_service_calls(hass):
"""Test service calls to switch."""
await async_setup_component(hass, "switch", {"switch": [{"platform": "demo"}]})
await async_setup_component(
hass,
"light",
{"light": [{"platform": "switch", "entity_id": "switch.decorative_lights"}]},
... | [
"async",
"def",
"test_switch_service_calls",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"switch\"",
",",
"{",
"\"switch\"",
":",
"[",
"{",
"\"platform\"",
":",
"\"demo\"",
"}",
"]",
"}",
")",
"await",
"async_setup_component",
... | [
64,
0
] | [
86,
62
] | python | en | ['en', 'en', 'en'] | True |
get_vessel_data | (experiment_name: str, episode: str, tick: str) | Get the vessel data within one tick.
Args:
experiment_name (str): Name of the experiment expected to be displayed.
episode (str) : Number of the episode of expected data.
tick (str): Number of tick of expected data.
Returns:
json: Jsonfied vessel value of current tick.
... | Get the vessel data within one tick. | def get_vessel_data(experiment_name: str, episode: str, tick: str) -> json:
"""Get the vessel data within one tick.
Args:
experiment_name (str): Name of the experiment expected to be displayed.
episode (str) : Number of the episode of expected data.
tick (str): Number of tick of expecte... | [
"def",
"get_vessel_data",
"(",
"experiment_name",
":",
"str",
",",
"episode",
":",
"str",
",",
"tick",
":",
"str",
")",
"->",
"json",
":",
"params",
"=",
"{",
"\"query\"",
":",
"f\"select {request_column.vessel_header.value} from {experiment_name}.vessel_details\"",
"... | [
14,
0
] | [
36,
61
] | python | en | ['en', 'en', 'en'] | True |
get_acc_vessel_data | (experiment_name: str, episode: str, start_tick: str, end_tick: str) | Get the vessel data within a range.
Args:
experiment_name (str): Name of the experiment expected to be displayed.
episode (str) : Number of the episode of expected data.
start_tick (str): Number of tick to the start point of vessel data.
end_tick(str): Number of tick to the end poin... | Get the vessel data within a range. | def get_acc_vessel_data(experiment_name: str, episode: str, start_tick: str, end_tick: str) -> json:
"""Get the vessel data within a range.
Args:
experiment_name (str): Name of the experiment expected to be displayed.
episode (str) : Number of the episode of expected data.
start_tick (s... | [
"def",
"get_acc_vessel_data",
"(",
"experiment_name",
":",
"str",
",",
"episode",
":",
"str",
",",
"start_tick",
":",
"str",
",",
"end_tick",
":",
"str",
")",
"->",
"json",
":",
"input_range",
"=",
"get_input_range",
"(",
"start_tick",
",",
"end_tick",
")",
... | [
39,
0
] | [
63,
67
] | python | en | ['en', 'en', 'en'] | True |
process_vessel_data | (db_vessel_data: json, start_tick: str) | Process the vessel data with route information.
Args:
db_vessel_data(json): Original vessel data.
Both accumulated data and single data are possible.
start_tick(str): Number of first tick of data.
Returns:
json: Jsonified formatted vessel value.
| Process the vessel data with route information. | def process_vessel_data(db_vessel_data: json, start_tick: str) -> json:
"""Process the vessel data with route information.
Args:
db_vessel_data(json): Original vessel data.
Both accumulated data and single data are possible.
start_tick(str): Number of first tick of data.
Return... | [
"def",
"process_vessel_data",
"(",
"db_vessel_data",
":",
"json",
",",
"start_tick",
":",
"str",
")",
"->",
"json",
":",
"exec_path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"dirname"... | [
66,
0
] | [
111,
30
] | python | en | ['en', 'en', 'en'] | True |
get_single_snapshot_vessel_data | (
original_vessel_data: pd.DataFrame, vessel_list: list, vessel_info: json,
route_list: list, cim_information: json
) | Generate compulsory data and change vessel data format.
Args:
original_vessel_data(DataFrame): Vessel data without generated columns.
vessel_list(list): List of vessel of current topology.
vessel_info(json): Vessel detailed information.
route_list(list): List of route of current top... | Generate compulsory data and change vessel data format. | def get_single_snapshot_vessel_data(
original_vessel_data: pd.DataFrame, vessel_list: list, vessel_info: json,
route_list: list, cim_information: json
):
"""Generate compulsory data and change vessel data format.
Args:
original_vessel_data(DataFrame): Vessel data without generated colum... | [
"def",
"get_single_snapshot_vessel_data",
"(",
"original_vessel_data",
":",
"pd",
".",
"DataFrame",
",",
"vessel_list",
":",
"list",
",",
"vessel_info",
":",
"json",
",",
"route_list",
":",
"list",
",",
"cim_information",
":",
"json",
")",
":",
"original_vessel_da... | [
114,
0
] | [
171,
17
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the configured Numato USB GPIO ADC sensor ports. | Set up the configured Numato USB GPIO ADC sensor ports. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the configured Numato USB GPIO ADC sensor ports."""
if discovery_info is None:
return
api = hass.data[DOMAIN][DATA_API]
sensors = []
devices = hass.data[DOMAIN][CONF_DEVICES]
for device in [d for d in devices... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"api",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"DATA_API",
"]",
"senso... | [
23,
0
] | [
57,
31
] | python | en | ['en', 'sm', 'en'] | True |
NumatoGpioAdc.__init__ | (self, name, device_id, port, src_range, dst_range, dst_unit, api) | Initialize the sensor. | Initialize the sensor. | def __init__(self, name, device_id, port, src_range, dst_range, dst_unit, api):
"""Initialize the sensor."""
self._name = name
self._device_id = device_id
self._port = port
self._src_range = src_range
self._dst_range = dst_range
self._state = None
self._un... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"device_id",
",",
"port",
",",
"src_range",
",",
"dst_range",
",",
"dst_unit",
",",
"api",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_device_id",
"=",
"device_id",
"self",
".",
"_port",... | [
63,
4
] | [
72,
23
] | python | en | ['en', 'en', 'en'] | True |
NumatoGpioAdc.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
75,
4
] | [
77,
25
] | python | en | ['en', 'mi', 'en'] | True |
NumatoGpioAdc.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
80,
4
] | [
82,
26
] | python | en | ['en', 'en', 'en'] | True |
NumatoGpioAdc.unit_of_measurement | (self) | Return the unit the value is expressed in. | Return the unit the value is expressed in. | def unit_of_measurement(self):
"""Return the unit the value is expressed in."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
85,
4
] | [
87,
40
] | python | en | ['en', 'en', 'en'] | True |
NumatoGpioAdc.icon | (self) | Return the icon to use in the frontend, if any. | Return the icon to use in the frontend, if any. | def icon(self):
"""Return the icon to use in the frontend, if any."""
return ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"ICON"
] | [
90,
4
] | [
92,
19
] | python | en | ['en', 'en', 'en'] | True |
NumatoGpioAdc.update | (self) | Get the latest data and updates the state. | Get the latest data and updates the state. | def update(self):
"""Get the latest data and updates the state."""
try:
adc_val = self._api.read_adc_input(self._device_id, self._port)
adc_val = self._clamp_to_source_range(adc_val)
self._state = self._linear_scale_to_dest_range(adc_val)
except NumatoGpioErro... | [
"def",
"update",
"(",
"self",
")",
":",
"try",
":",
"adc_val",
"=",
"self",
".",
"_api",
".",
"read_adc_input",
"(",
"self",
".",
"_device_id",
",",
"self",
".",
"_port",
")",
"adc_val",
"=",
"self",
".",
"_clamp_to_source_range",
"(",
"adc_val",
")",
... | [
94,
4
] | [
107,
13
] | python | en | ['en', 'en', 'en'] | True |
test_get_system_info | (hass) | Test the get system info. | Test the get system info. | async def test_get_system_info(hass):
"""Test the get system info."""
info = await hass.helpers.system_info.async_get_system_info()
assert isinstance(info, dict)
assert info["version"] == current_version
assert json.dumps(info) is not None | [
"async",
"def",
"test_get_system_info",
"(",
"hass",
")",
":",
"info",
"=",
"await",
"hass",
".",
"helpers",
".",
"system_info",
".",
"async_get_system_info",
"(",
")",
"assert",
"isinstance",
"(",
"info",
",",
"dict",
")",
"assert",
"info",
"[",
"\"version\... | [
6,
0
] | [
11,
39
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Add Vilfo Router entities from a config_entry. | Add Vilfo Router entities from a config_entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Add Vilfo Router entities from a config_entry."""
vilfo = hass.data[DOMAIN][config_entry.entry_id]
sensors = []
for sensor_type in SENSOR_TYPES:
sensors.append(VilfoRouterSensor(sensor_type, vilfo))
async_add_entities... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"vilfo",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"sensors",
"=",
"[",
"]",
"for",
"sensor_type",
"i... | [
17,
0
] | [
26,
37
] | python | en | ['en', 'en', 'en'] | True |
VilfoRouterSensor.__init__ | (self, sensor_type, api) | Initialize. | Initialize. | def __init__(self, sensor_type, api):
"""Initialize."""
self.api = api
self.sensor_type = sensor_type
self._device_info = {
"identifiers": {(DOMAIN, api.host, api.mac_address)},
"name": ROUTER_DEFAULT_NAME,
"manufacturer": ROUTER_MANUFACTURER,
... | [
"def",
"__init__",
"(",
"self",
",",
"sensor_type",
",",
"api",
")",
":",
"self",
".",
"api",
"=",
"api",
"self",
".",
"sensor_type",
"=",
"sensor_type",
"self",
".",
"_device_info",
"=",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"api",
"."... | [
32,
4
] | [
44,
26
] | python | en | ['en', 'en', 'it'] | False |
VilfoRouterSensor.available | (self) | Return whether the sensor is available or not. | Return whether the sensor is available or not. | def available(self):
"""Return whether the sensor is available or not."""
return self.api.available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"api",
".",
"available"
] | [
47,
4
] | [
49,
33
] | python | en | ['en', 'en', 'en'] | True |
VilfoRouterSensor.device_info | (self) | Return the device info. | Return the device info. | def device_info(self):
"""Return the device info."""
return self._device_info | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_info"
] | [
52,
4
] | [
54,
32
] | python | en | ['en', 'en', 'en'] | True |
VilfoRouterSensor.device_class | (self) | Return the device class. | Return the device class. | def device_class(self):
"""Return the device class."""
return SENSOR_TYPES[self.sensor_type].get(ATTR_DEVICE_CLASS) | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"SENSOR_TYPES",
"[",
"self",
".",
"sensor_type",
"]",
".",
"get",
"(",
"ATTR_DEVICE_CLASS",
")"
] | [
57,
4
] | [
59,
68
] | python | en | ['en', 'en', 'en'] | True |
VilfoRouterSensor.icon | (self) | Return the icon for the sensor. | Return the icon for the sensor. | def icon(self):
"""Return the icon for the sensor."""
return SENSOR_TYPES[self.sensor_type][ATTR_ICON] | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"SENSOR_TYPES",
"[",
"self",
".",
"sensor_type",
"]",
"[",
"ATTR_ICON",
"]"
] | [
62,
4
] | [
64,
56
] | python | en | ['en', 'en', 'en'] | True |
VilfoRouterSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
parent_device_name = self._device_info["name"]
sensor_name = SENSOR_TYPES[self.sensor_type][ATTR_LABEL]
return f"{parent_device_name} {sensor_name}" | [
"def",
"name",
"(",
"self",
")",
":",
"parent_device_name",
"=",
"self",
".",
"_device_info",
"[",
"\"name\"",
"]",
"sensor_name",
"=",
"SENSOR_TYPES",
"[",
"self",
".",
"sensor_type",
"]",
"[",
"ATTR_LABEL",
"]",
"return",
"f\"{parent_device_name} {sensor_name}\"... | [
67,
4
] | [
71,
52
] | python | en | ['en', 'mi', 'en'] | True |
VilfoRouterSensor.state | (self) | Return the state. | Return the state. | def state(self):
"""Return the state."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
74,
4
] | [
76,
26
] | python | en | ['en', 'en', 'en'] | True |
VilfoRouterSensor.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"
] | [
79,
4
] | [
81,
30
] | python | en | ['en', 'en', 'en'] | True |
VilfoRouterSensor.unit_of_measurement | (self) | Return the unit of measurement of this entity. | Return the unit of measurement of this entity. | def unit_of_measurement(self):
"""Return the unit of measurement of this entity."""
return SENSOR_TYPES[self.sensor_type].get(ATTR_UNIT) | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"SENSOR_TYPES",
"[",
"self",
".",
"sensor_type",
"]",
".",
"get",
"(",
"ATTR_UNIT",
")"
] | [
84,
4
] | [
86,
60
] | python | en | ['en', 'en', 'en'] | True |
VilfoRouterSensor.async_update | (self) | Update the router data. | Update the router data. | async def async_update(self):
"""Update the router data."""
await self.api.async_update()
self._state = self.api.data.get(
SENSOR_TYPES[self.sensor_type][ATTR_API_DATA_FIELD]
) | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"api",
".",
"async_update",
"(",
")",
"self",
".",
"_state",
"=",
"self",
".",
"api",
".",
"data",
".",
"get",
"(",
"SENSOR_TYPES",
"[",
"self",
".",
"sensor_type",
"]",
"["... | [
88,
4
] | [
93,
9
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, entry, async_add_entities) | Set up TotalConnect device sensors based on a config entry. | Set up TotalConnect device sensors based on a config entry. | async def async_setup_entry(hass, entry, async_add_entities) -> None:
"""Set up TotalConnect device sensors based on a config entry."""
sensors = []
client_locations = hass.data[DOMAIN][entry.entry_id].locations
for location_id, location in client_locations.items():
for zone_id, zone in locati... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
",",
"async_add_entities",
")",
"->",
"None",
":",
"sensors",
"=",
"[",
"]",
"client_locations",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"entry",
".",
"entry_id",
"]",
".",
"locat... | [
15,
0
] | [
25,
37
] | python | en | ['en', 'en', 'en'] | True |
TotalConnectBinarySensor.__init__ | (self, zone_id, location_id, zone) | Initialize the TotalConnect status. | Initialize the TotalConnect status. | def __init__(self, zone_id, location_id, zone):
"""Initialize the TotalConnect status."""
self._zone_id = zone_id
self._location_id = location_id
self._zone = zone
self._name = self._zone.description
self._unique_id = f"{location_id} {zone_id}"
self._is_on = None
... | [
"def",
"__init__",
"(",
"self",
",",
"zone_id",
",",
"location_id",
",",
"zone",
")",
":",
"self",
".",
"_zone_id",
"=",
"zone_id",
"self",
".",
"_location_id",
"=",
"location_id",
"self",
".",
"_zone",
"=",
"zone",
"self",
".",
"_name",
"=",
"self",
"... | [
31,
4
] | [
40,
35
] | python | en | ['en', 'en', 'en'] | True |
TotalConnectBinarySensor.unique_id | (self) | Return the unique id. | Return the unique id. | def unique_id(self):
"""Return the unique id."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
43,
4
] | [
45,
30
] | python | en | ['en', 'la', 'en'] | True |
TotalConnectBinarySensor.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
48,
4
] | [
50,
25
] | python | en | ['en', 'en', 'en'] | True |
TotalConnectBinarySensor.update | (self) | Return the state of the device. | Return the state of the device. | def update(self):
"""Return the state of the device."""
self._is_tampered = self._zone.is_tampered()
self._is_low_battery = self._zone.is_low_battery()
if self._zone.is_faulted() or self._zone.is_triggered():
self._is_on = True
else:
self._is_on = False | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_is_tampered",
"=",
"self",
".",
"_zone",
".",
"is_tampered",
"(",
")",
"self",
".",
"_is_low_battery",
"=",
"self",
".",
"_zone",
".",
"is_low_battery",
"(",
")",
"if",
"self",
".",
"_zone",
".",
... | [
52,
4
] | [
60,
31
] | python | en | ['en', 'en', 'en'] | True |
TotalConnectBinarySensor.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._is_on | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_on"
] | [
63,
4
] | [
65,
26
] | python | en | ['en', 'fy', 'en'] | True |
TotalConnectBinarySensor.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
if self._zone.is_type_security():
return DEVICE_CLASS_DOOR
if self._zone.is_type_fire():
return DEVICE_CLASS_SMOKE
if self._zone.is_type_carbon_monoxide():
re... | [
"def",
"device_class",
"(",
"self",
")",
":",
"if",
"self",
".",
"_zone",
".",
"is_type_security",
"(",
")",
":",
"return",
"DEVICE_CLASS_DOOR",
"if",
"self",
".",
"_zone",
".",
"is_type_fire",
"(",
")",
":",
"return",
"DEVICE_CLASS_SMOKE",
"if",
"self",
"... | [
68,
4
] | [
76,
19
] | python | en | ['en', 'en', 'en'] | True |
TotalConnectBinarySensor.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self):
"""Return the state attributes."""
attributes = {
"zone_id": self._zone_id,
"location_id": self._location_id,
"low_battery": self._is_low_battery,
"tampered": self._is_tampered,
}
return attributes | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"attributes",
"=",
"{",
"\"zone_id\"",
":",
"self",
".",
"_zone_id",
",",
"\"location_id\"",
":",
"self",
".",
"_location_id",
",",
"\"low_battery\"",
":",
"self",
".",
"_is_low_battery",
",",
"\"tampered\... | [
79,
4
] | [
87,
25
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: dict) | Set up the Logitech Squeezebox component. | Set up the Logitech Squeezebox component. | async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Logitech Squeezebox component."""
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
":",
"return",
"True"
] | [
13,
0
] | [
15,
15
] | python | en | ['en', 'fr', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up Logitech Squeezebox from a config entry. | Set up Logitech Squeezebox from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Logitech Squeezebox from a config entry."""
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, MP_DOMAIN)
)
return True | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
"config_entries",
".",
"async_forward_entry_setup",
"(",
"entry",
",",
"MP_DOMAIN",
")",
")",
... | [
18,
0
] | [
23,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, entry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass, entry):
"""Unload a config entry."""
# Stop player discovery task for this config entry.
hass.data[DOMAIN][entry.entry_id][PLAYER_DISCOVERY_UNSUB]()
# Remove stored data for this config entry
hass.data[DOMAIN].pop(entry.entry_id)
# Stop server discovery task ... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"entry",
")",
":",
"# Stop player discovery task for this config entry.",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"entry",
".",
"entry_id",
"]",
"[",
"PLAYER_DISCOVERY_UNSUB",
"]",
"(",
")",
"# Remove s... | [
26,
0
] | [
41,
81
] | python | en | ['en', 'es', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the miio fan device from config. | Set up the miio fan device from config. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the miio fan device from config."""
if DATA_KEY not in hass.data:
hass.data[DATA_KEY] = {}
host = config[CONF_HOST]
token = config[CONF_TOKEN]
name = config[CONF_NAME]
model = config.get(CON... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"DATA_KEY",
"not",
"in",
"hass",
".",
"data",
":",
"hass",
".",
"data",
"[",
"DATA_KEY",
"]",
"=",
"{",
"}"... | [
554,
0
] | [
641,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericDevice.__init__ | (self, name, device, model, unique_id) | Initialize the generic Xiaomi device. | Initialize the generic Xiaomi device. | def __init__(self, name, device, model, unique_id):
"""Initialize the generic Xiaomi device."""
self._name = name
self._device = device
self._model = model
self._unique_id = unique_id
self._available = False
self._state = None
self._state_attrs = {ATTR_MO... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"device",
",",
"model",
",",
"unique_id",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_device",
"=",
"device",
"self",
".",
"_model",
"=",
"model",
"self",
".",
"_unique_id",
"=",
"uniq... | [
647,
4
] | [
658,
33
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericDevice.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
return SUPPORT_SET_SPEED | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_SET_SPEED"
] | [
661,
4
] | [
663,
32
] | python | en | ['da', 'en', 'en'] | True |
XiaomiGenericDevice.should_poll | (self) | Poll the device. | Poll the device. | def should_poll(self):
"""Poll the device."""
return True | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"True"
] | [
666,
4
] | [
668,
19
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericDevice.unique_id | (self) | Return an unique ID. | Return an unique ID. | def unique_id(self):
"""Return an unique ID."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
671,
4
] | [
673,
30
] | python | fr | ['fr', 'fr', 'en'] | True |
XiaomiGenericDevice.name | (self) | Return the name of the device if any. | Return the name of the device if any. | def name(self):
"""Return the name of the device if any."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
676,
4
] | [
678,
25
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericDevice.available | (self) | Return true when state is known. | Return true when state is known. | def available(self):
"""Return true when state is known."""
return self._available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available"
] | [
681,
4
] | [
683,
30
] | python | en | ['en', 'de', 'en'] | True |
XiaomiGenericDevice.device_state_attributes | (self) | Return the state attributes of the device. | Return the state attributes of the device. | def device_state_attributes(self):
"""Return the state attributes of the device."""
return self._state_attrs | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state_attrs"
] | [
686,
4
] | [
688,
32
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericDevice.is_on | (self) | Return true if device is on. | Return true if device is on. | def is_on(self):
"""Return true if device is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
691,
4
] | [
693,
26
] | python | en | ['en', 'fy', 'en'] | True |
XiaomiGenericDevice._try_command | (self, mask_error, func, *args, **kwargs) | Call a miio device command handling error messages. | Call a miio device command handling error messages. | async def _try_command(self, mask_error, func, *args, **kwargs):
"""Call a miio device command handling error messages."""
try:
result = await self.hass.async_add_executor_job(
partial(func, *args, **kwargs)
)
_LOGGER.debug("Response received from mii... | [
"async",
"def",
"_try_command",
"(",
"self",
",",
"mask_error",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"result",
"=",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"partial",
"(",
"func",
",",
... | [
703,
4
] | [
718,
24
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericDevice.async_turn_on | (self, speed: str = None, **kwargs) | Turn the device on. | Turn the device on. | async def async_turn_on(self, speed: str = None, **kwargs) -> None:
"""Turn the device on."""
if speed:
# If operation mode was set the device must not be turned on.
result = await self.async_set_speed(speed)
else:
result = await self._try_command(
... | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"speed",
":",
"str",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"if",
"speed",
":",
"# If operation mode was set the device must not be turned on.",
"result",
"=",
"await",
"self",
".",
"asy... | [
720,
4
] | [
732,
36
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericDevice.async_turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | async def async_turn_off(self, **kwargs) -> None:
"""Turn the device off."""
result = await self._try_command(
"Turning the miio device off failed.", self._device.off
)
if result:
self._state = False
self._skip_update = True | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"result",
"=",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the miio device off failed.\"",
",",
"self",
".",
"_device",
".",
"off",
")",
"if",
"result",... | [
734,
4
] | [
742,
36
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericDevice.async_set_buzzer_on | (self) | Turn the buzzer on. | Turn the buzzer on. | async def async_set_buzzer_on(self):
"""Turn the buzzer on."""
if self._device_features & FEATURE_SET_BUZZER == 0:
return
await self._try_command(
"Turning the buzzer of the miio device on failed.",
self._device.set_buzzer,
True,
) | [
"async",
"def",
"async_set_buzzer_on",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_BUZZER",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the buzzer of the miio device on failed.\"",
",",
"self",
... | [
744,
4
] | [
753,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericDevice.async_set_buzzer_off | (self) | Turn the buzzer off. | Turn the buzzer off. | async def async_set_buzzer_off(self):
"""Turn the buzzer off."""
if self._device_features & FEATURE_SET_BUZZER == 0:
return
await self._try_command(
"Turning the buzzer of the miio device off failed.",
self._device.set_buzzer,
False,
) | [
"async",
"def",
"async_set_buzzer_off",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_BUZZER",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the buzzer of the miio device off failed.\"",
",",
"self",
... | [
755,
4
] | [
764,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiGenericDevice.async_set_child_lock_on | (self) | Turn the child lock on. | Turn the child lock on. | async def async_set_child_lock_on(self):
"""Turn the child lock on."""
if self._device_features & FEATURE_SET_CHILD_LOCK == 0:
return
await self._try_command(
"Turning the child lock of the miio device on failed.",
self._device.set_child_lock,
Tru... | [
"async",
"def",
"async_set_child_lock_on",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_CHILD_LOCK",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the child lock of the miio device on failed.\"",
",",
... | [
766,
4
] | [
775,
9
] | python | en | ['en', 'fi', 'en'] | True |
XiaomiGenericDevice.async_set_child_lock_off | (self) | Turn the child lock off. | Turn the child lock off. | async def async_set_child_lock_off(self):
"""Turn the child lock off."""
if self._device_features & FEATURE_SET_CHILD_LOCK == 0:
return
await self._try_command(
"Turning the child lock of the miio device off failed.",
self._device.set_child_lock,
... | [
"async",
"def",
"async_set_child_lock_off",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_CHILD_LOCK",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the child lock of the miio device off failed.\"",
","... | [
777,
4
] | [
786,
9
] | python | en | ['en', 'ja', 'en'] | True |
XiaomiAirPurifier.__init__ | (self, name, device, model, unique_id) | Initialize the plug switch. | Initialize the plug switch. | def __init__(self, name, device, model, unique_id):
"""Initialize the plug switch."""
super().__init__(name, device, model, unique_id)
if self._model == MODEL_AIRPURIFIER_PRO:
self._device_features = FEATURE_FLAGS_AIRPURIFIER_PRO
self._available_attributes = AVAILABLE_AT... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"device",
",",
"model",
",",
"unique_id",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"name",
",",
"device",
",",
"model",
",",
"unique_id",
")",
"if",
"self",
".",
"_model",
"==",
"MODEL_AIRPU... | [
792,
4
] | [
823,
9
] | python | en | ['en', 'pl', 'en'] | True |
XiaomiAirPurifier.async_update | (self) | Fetch state from the device. | Fetch state from the device. | async def async_update(self):
"""Fetch state from the device."""
# On state change the device doesn't provide the new state immediately.
if self._skip_update:
self._skip_update = False
return
try:
state = await self.hass.async_add_executor_job(self._d... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"# On state change the device doesn't provide the new state immediately.",
"if",
"self",
".",
"_skip_update",
":",
"self",
".",
"_skip_update",
"=",
"False",
"return",
"try",
":",
"state",
"=",
"await",
"self",
... | [
825,
4
] | [
848,
79
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifier.speed_list | (self) | Get the list of available speeds. | Get the list of available speeds. | def speed_list(self) -> list:
"""Get the list of available speeds."""
return self._speed_list | [
"def",
"speed_list",
"(",
"self",
")",
"->",
"list",
":",
"return",
"self",
".",
"_speed_list"
] | [
851,
4
] | [
853,
31
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifier.speed | (self) | Return the current speed. | Return the current speed. | def speed(self):
"""Return the current speed."""
if self._state:
return AirpurifierOperationMode(self._state_attrs[ATTR_MODE]).name
return None | [
"def",
"speed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
":",
"return",
"AirpurifierOperationMode",
"(",
"self",
".",
"_state_attrs",
"[",
"ATTR_MODE",
"]",
")",
".",
"name",
"return",
"None"
] | [
856,
4
] | [
861,
19
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifier.async_set_speed | (self, speed: str) | Set the speed of the fan. | Set the speed of the fan. | async def async_set_speed(self, speed: str) -> None:
"""Set the speed of the fan."""
if self.supported_features & SUPPORT_SET_SPEED == 0:
return
_LOGGER.debug("Setting the operation mode to: %s", speed)
await self._try_command(
"Setting operation mode of the mii... | [
"async",
"def",
"async_set_speed",
"(",
"self",
",",
"speed",
":",
"str",
")",
"->",
"None",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_SET_SPEED",
"==",
"0",
":",
"return",
"_LOGGER",
".",
"debug",
"(",
"\"Setting the operation mode to: %s\"",
... | [
863,
4
] | [
874,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifier.async_set_led_on | (self) | Turn the led on. | Turn the led on. | async def async_set_led_on(self):
"""Turn the led on."""
if self._device_features & FEATURE_SET_LED == 0:
return
await self._try_command(
"Turning the led of the miio device off failed.", self._device.set_led, True
) | [
"async",
"def",
"async_set_led_on",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_LED",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the led of the miio device off failed.\"",
",",
"self",
".",
"... | [
876,
4
] | [
883,
9
] | python | en | ['en', 'zu', 'en'] | True |
XiaomiAirPurifier.async_set_led_off | (self) | Turn the led off. | Turn the led off. | async def async_set_led_off(self):
"""Turn the led off."""
if self._device_features & FEATURE_SET_LED == 0:
return
await self._try_command(
"Turning the led of the miio device off failed.",
self._device.set_led,
False,
) | [
"async",
"def",
"async_set_led_off",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_LED",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the led of the miio device off failed.\"",
",",
"self",
".",
... | [
885,
4
] | [
894,
9
] | python | en | ['en', 'sm', 'en'] | True |
XiaomiAirPurifier.async_set_led_brightness | (self, brightness: int = 2) | Set the led brightness. | Set the led brightness. | async def async_set_led_brightness(self, brightness: int = 2):
"""Set the led brightness."""
if self._device_features & FEATURE_SET_LED_BRIGHTNESS == 0:
return
await self._try_command(
"Setting the led brightness of the miio device failed.",
self._device.set_... | [
"async",
"def",
"async_set_led_brightness",
"(",
"self",
",",
"brightness",
":",
"int",
"=",
"2",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_LED_BRIGHTNESS",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Settin... | [
896,
4
] | [
905,
9
] | python | en | ['en', 'zu', 'en'] | True |
XiaomiAirPurifier.async_set_favorite_level | (self, level: int = 1) | Set the favorite level. | Set the favorite level. | async def async_set_favorite_level(self, level: int = 1):
"""Set the favorite level."""
if self._device_features & FEATURE_SET_FAVORITE_LEVEL == 0:
return
await self._try_command(
"Setting the favorite level of the miio device failed.",
self._device.set_favor... | [
"async",
"def",
"async_set_favorite_level",
"(",
"self",
",",
"level",
":",
"int",
"=",
"1",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_FAVORITE_LEVEL",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Setting the... | [
907,
4
] | [
916,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifier.async_set_fan_level | (self, level: int = 1) | Set the favorite level. | Set the favorite level. | async def async_set_fan_level(self, level: int = 1):
"""Set the favorite level."""
if self._device_features & FEATURE_SET_FAN_LEVEL == 0:
return
await self._try_command(
"Setting the fan level of the miio device failed.",
self._device.set_fan_level,
... | [
"async",
"def",
"async_set_fan_level",
"(",
"self",
",",
"level",
":",
"int",
"=",
"1",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_FAN_LEVEL",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Setting the fan level... | [
918,
4
] | [
927,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifier.async_set_auto_detect_on | (self) | Turn the auto detect on. | Turn the auto detect on. | async def async_set_auto_detect_on(self):
"""Turn the auto detect on."""
if self._device_features & FEATURE_SET_AUTO_DETECT == 0:
return
await self._try_command(
"Turning the auto detect of the miio device on failed.",
self._device.set_auto_detect,
... | [
"async",
"def",
"async_set_auto_detect_on",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_AUTO_DETECT",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the auto detect of the miio device on failed.\"",
",... | [
929,
4
] | [
938,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifier.async_set_auto_detect_off | (self) | Turn the auto detect off. | Turn the auto detect off. | async def async_set_auto_detect_off(self):
"""Turn the auto detect off."""
if self._device_features & FEATURE_SET_AUTO_DETECT == 0:
return
await self._try_command(
"Turning the auto detect of the miio device off failed.",
self._device.set_auto_detect,
... | [
"async",
"def",
"async_set_auto_detect_off",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_AUTO_DETECT",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the auto detect of the miio device off failed.\"",
... | [
940,
4
] | [
949,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifier.async_set_learn_mode_on | (self) | Turn the learn mode on. | Turn the learn mode on. | async def async_set_learn_mode_on(self):
"""Turn the learn mode on."""
if self._device_features & FEATURE_SET_LEARN_MODE == 0:
return
await self._try_command(
"Turning the learn mode of the miio device on failed.",
self._device.set_learn_mode,
Tru... | [
"async",
"def",
"async_set_learn_mode_on",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_LEARN_MODE",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the learn mode of the miio device on failed.\"",
",",
... | [
951,
4
] | [
960,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifier.async_set_learn_mode_off | (self) | Turn the learn mode off. | Turn the learn mode off. | async def async_set_learn_mode_off(self):
"""Turn the learn mode off."""
if self._device_features & FEATURE_SET_LEARN_MODE == 0:
return
await self._try_command(
"Turning the learn mode of the miio device off failed.",
self._device.set_learn_mode,
... | [
"async",
"def",
"async_set_learn_mode_off",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_LEARN_MODE",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the learn mode of the miio device off failed.\"",
","... | [
962,
4
] | [
971,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifier.async_set_volume | (self, volume: int = 50) | Set the sound volume. | Set the sound volume. | async def async_set_volume(self, volume: int = 50):
"""Set the sound volume."""
if self._device_features & FEATURE_SET_VOLUME == 0:
return
await self._try_command(
"Setting the sound volume of the miio device failed.",
self._device.set_volume,
vol... | [
"async",
"def",
"async_set_volume",
"(",
"self",
",",
"volume",
":",
"int",
"=",
"50",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_VOLUME",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Setting the sound volume ... | [
973,
4
] | [
982,
9
] | python | en | ['en', 'de', 'en'] | True |
XiaomiAirPurifier.async_set_extra_features | (self, features: int = 1) | Set the extra features. | Set the extra features. | async def async_set_extra_features(self, features: int = 1):
"""Set the extra features."""
if self._device_features & FEATURE_SET_EXTRA_FEATURES == 0:
return
await self._try_command(
"Setting the extra features of the miio device failed.",
self._device.set_ex... | [
"async",
"def",
"async_set_extra_features",
"(",
"self",
",",
"features",
":",
"int",
"=",
"1",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_EXTRA_FEATURES",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Setting ... | [
984,
4
] | [
993,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifier.async_reset_filter | (self) | Reset the filter lifetime and usage. | Reset the filter lifetime and usage. | async def async_reset_filter(self):
"""Reset the filter lifetime and usage."""
if self._device_features & FEATURE_RESET_FILTER == 0:
return
await self._try_command(
"Resetting the filter lifetime of the miio device failed.",
self._device.reset_filter,
... | [
"async",
"def",
"async_reset_filter",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_RESET_FILTER",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Resetting the filter lifetime of the miio device failed.\"",
",",
"... | [
995,
4
] | [
1003,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifierMiot.speed | (self) | Return the current speed. | Return the current speed. | def speed(self):
"""Return the current speed."""
if self._state:
return AirpurifierMiotOperationMode(self._state_attrs[ATTR_MODE]).name
return None | [
"def",
"speed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
":",
"return",
"AirpurifierMiotOperationMode",
"(",
"self",
".",
"_state_attrs",
"[",
"ATTR_MODE",
"]",
")",
".",
"name",
"return",
"None"
] | [
1010,
4
] | [
1015,
19
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifierMiot.async_set_speed | (self, speed: str) | Set the speed of the fan. | Set the speed of the fan. | async def async_set_speed(self, speed: str) -> None:
"""Set the speed of the fan."""
if self.supported_features & SUPPORT_SET_SPEED == 0:
return
_LOGGER.debug("Setting the operation mode to: %s", speed)
await self._try_command(
"Setting operation mode of the mii... | [
"async",
"def",
"async_set_speed",
"(",
"self",
",",
"speed",
":",
"str",
")",
"->",
"None",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_SET_SPEED",
"==",
"0",
":",
"return",
"_LOGGER",
".",
"debug",
"(",
"\"Setting the operation mode to: %s\"",
... | [
1017,
4
] | [
1028,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirPurifierMiot.async_set_led_brightness | (self, brightness: int = 2) | Set the led brightness. | Set the led brightness. | async def async_set_led_brightness(self, brightness: int = 2):
"""Set the led brightness."""
if self._device_features & FEATURE_SET_LED_BRIGHTNESS == 0:
return
await self._try_command(
"Setting the led brightness of the miio device failed.",
self._device.set_... | [
"async",
"def",
"async_set_led_brightness",
"(",
"self",
",",
"brightness",
":",
"int",
"=",
"2",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_LED_BRIGHTNESS",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Settin... | [
1030,
4
] | [
1039,
9
] | python | en | ['en', 'zu', 'en'] | True |
XiaomiAirHumidifier.__init__ | (self, name, device, model, unique_id) | Initialize the plug switch. | Initialize the plug switch. | def __init__(self, name, device, model, unique_id):
"""Initialize the plug switch."""
super().__init__(name, device, model, unique_id)
if self._model in [MODEL_AIRHUMIDIFIER_CA1, MODEL_AIRHUMIDIFIER_CB1]:
self._device_features = FEATURE_FLAGS_AIRHUMIDIFIER_CA_AND_CB
self... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"device",
",",
"model",
",",
"unique_id",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"name",
",",
"device",
",",
"model",
",",
"unique_id",
")",
"if",
"self",
".",
"_model",
"in",
"[",
"MODE... | [
1045,
4
] | [
1072,
9
] | python | en | ['en', 'pl', 'en'] | True |
XiaomiAirHumidifier.async_update | (self) | Fetch state from the device. | Fetch state from the device. | async def async_update(self):
"""Fetch state from the device."""
# On state change the device doesn't provide the new state immediately.
if self._skip_update:
self._skip_update = False
return
try:
state = await self.hass.async_add_executor_job(self._d... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"# On state change the device doesn't provide the new state immediately.",
"if",
"self",
".",
"_skip_update",
":",
"self",
".",
"_skip_update",
"=",
"False",
"return",
"try",
":",
"state",
"=",
"await",
"self",
... | [
1074,
4
] | [
1097,
79
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirHumidifier.speed_list | (self) | Get the list of available speeds. | Get the list of available speeds. | def speed_list(self) -> list:
"""Get the list of available speeds."""
return self._speed_list | [
"def",
"speed_list",
"(",
"self",
")",
"->",
"list",
":",
"return",
"self",
".",
"_speed_list"
] | [
1100,
4
] | [
1102,
31
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirHumidifier.speed | (self) | Return the current speed. | Return the current speed. | def speed(self):
"""Return the current speed."""
if self._state:
return AirhumidifierOperationMode(self._state_attrs[ATTR_MODE]).name
return None | [
"def",
"speed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
":",
"return",
"AirhumidifierOperationMode",
"(",
"self",
".",
"_state_attrs",
"[",
"ATTR_MODE",
"]",
")",
".",
"name",
"return",
"None"
] | [
1105,
4
] | [
1110,
19
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirHumidifier.async_set_speed | (self, speed: str) | Set the speed of the fan. | Set the speed of the fan. | async def async_set_speed(self, speed: str) -> None:
"""Set the speed of the fan."""
if self.supported_features & SUPPORT_SET_SPEED == 0:
return
_LOGGER.debug("Setting the operation mode to: %s", speed)
await self._try_command(
"Setting operation mode of the mii... | [
"async",
"def",
"async_set_speed",
"(",
"self",
",",
"speed",
":",
"str",
")",
"->",
"None",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_SET_SPEED",
"==",
"0",
":",
"return",
"_LOGGER",
".",
"debug",
"(",
"\"Setting the operation mode to: %s\"",
... | [
1112,
4
] | [
1123,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirHumidifier.async_set_led_brightness | (self, brightness: int = 2) | Set the led brightness. | Set the led brightness. | async def async_set_led_brightness(self, brightness: int = 2):
"""Set the led brightness."""
if self._device_features & FEATURE_SET_LED_BRIGHTNESS == 0:
return
await self._try_command(
"Setting the led brightness of the miio device failed.",
self._device.set_... | [
"async",
"def",
"async_set_led_brightness",
"(",
"self",
",",
"brightness",
":",
"int",
"=",
"2",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_LED_BRIGHTNESS",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Settin... | [
1125,
4
] | [
1134,
9
] | python | en | ['en', 'zu', 'en'] | True |
XiaomiAirHumidifier.async_set_target_humidity | (self, humidity: int = 40) | Set the target humidity. | Set the target humidity. | async def async_set_target_humidity(self, humidity: int = 40):
"""Set the target humidity."""
if self._device_features & FEATURE_SET_TARGET_HUMIDITY == 0:
return
await self._try_command(
"Setting the target humidity of the miio device failed.",
self._device.s... | [
"async",
"def",
"async_set_target_humidity",
"(",
"self",
",",
"humidity",
":",
"int",
"=",
"40",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_TARGET_HUMIDITY",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Setti... | [
1136,
4
] | [
1145,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirHumidifier.async_set_dry_on | (self) | Turn the dry mode on. | Turn the dry mode on. | async def async_set_dry_on(self):
"""Turn the dry mode on."""
if self._device_features & FEATURE_SET_DRY == 0:
return
await self._try_command(
"Turning the dry mode of the miio device off failed.",
self._device.set_dry,
True,
) | [
"async",
"def",
"async_set_dry_on",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_DRY",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the dry mode of the miio device off failed.\"",
",",
"self",
"."... | [
1147,
4
] | [
1156,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirHumidifier.async_set_dry_off | (self) | Turn the dry mode off. | Turn the dry mode off. | async def async_set_dry_off(self):
"""Turn the dry mode off."""
if self._device_features & FEATURE_SET_DRY == 0:
return
await self._try_command(
"Turning the dry mode of the miio device off failed.",
self._device.set_dry,
False,
) | [
"async",
"def",
"async_set_dry_off",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_DRY",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the dry mode of the miio device off failed.\"",
",",
"self",
".... | [
1158,
4
] | [
1167,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirHumidifierMiot.speed | (self) | Return the current speed. | Return the current speed. | def speed(self):
"""Return the current speed."""
if self._state:
return self.MODE_MAPPING.get(
AirhumidifierMiotOperationMode(self._state_attrs[ATTR_MODE])
)
return None | [
"def",
"speed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
":",
"return",
"self",
".",
"MODE_MAPPING",
".",
"get",
"(",
"AirhumidifierMiotOperationMode",
"(",
"self",
".",
"_state_attrs",
"[",
"ATTR_MODE",
"]",
")",
")",
"return",
"None"
] | [
1182,
4
] | [
1189,
19
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirHumidifierMiot.button_pressed | (self) | Return the last button pressed. | Return the last button pressed. | def button_pressed(self):
"""Return the last button pressed."""
if self._state:
return AirhumidifierPressedButton(
self._state_attrs[ATTR_BUTTON_PRESSED]
).name
return None | [
"def",
"button_pressed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
":",
"return",
"AirhumidifierPressedButton",
"(",
"self",
".",
"_state_attrs",
"[",
"ATTR_BUTTON_PRESSED",
"]",
")",
".",
"name",
"return",
"None"
] | [
1192,
4
] | [
1199,
19
] | python | en | ['en', 'it', 'en'] | True |
XiaomiAirHumidifierMiot.async_set_speed | (self, speed: str) | Set the speed of the fan. | Set the speed of the fan. | async def async_set_speed(self, speed: str) -> None:
"""Set the speed of the fan."""
await self._try_command(
"Setting operation mode of the miio device failed.",
self._device.set_mode,
self.REVERSE_MODE_MAPPING[speed],
) | [
"async",
"def",
"async_set_speed",
"(",
"self",
",",
"speed",
":",
"str",
")",
"->",
"None",
":",
"await",
"self",
".",
"_try_command",
"(",
"\"Setting operation mode of the miio device failed.\"",
",",
"self",
".",
"_device",
".",
"set_mode",
",",
"self",
".",
... | [
1201,
4
] | [
1208,
9
] | python | en | ['en', 'en', 'en'] | True |
XiaomiAirHumidifierMiot.async_set_led_brightness | (self, brightness: int = 2) | Set the led brightness. | Set the led brightness. | async def async_set_led_brightness(self, brightness: int = 2):
"""Set the led brightness."""
if self._device_features & FEATURE_SET_LED_BRIGHTNESS == 0:
return
await self._try_command(
"Setting the led brightness of the miio device failed.",
self._device.set_... | [
"async",
"def",
"async_set_led_brightness",
"(",
"self",
",",
"brightness",
":",
"int",
"=",
"2",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_LED_BRIGHTNESS",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Settin... | [
1210,
4
] | [
1219,
9
] | python | en | ['en', 'zu', 'en'] | True |
XiaomiAirHumidifierMiot.async_set_motor_speed | (self, motor_speed: int = 400) | Set the target motor speed. | Set the target motor speed. | async def async_set_motor_speed(self, motor_speed: int = 400):
"""Set the target motor speed."""
if self._device_features & FEATURE_SET_MOTOR_SPEED == 0:
return
await self._try_command(
"Setting the target motor speed of the miio device failed.",
self._device... | [
"async",
"def",
"async_set_motor_speed",
"(",
"self",
",",
"motor_speed",
":",
"int",
"=",
"400",
")",
":",
"if",
"self",
".",
"_device_features",
"&",
"FEATURE_SET_MOTOR_SPEED",
"==",
"0",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Setting t... | [
1221,
4
] | [
1230,
9
] | python | en | ['en', 'jv', 'en'] | True |
XiaomiAirFresh.__init__ | (self, name, device, model, unique_id) | Initialize the miio device. | Initialize the miio device. | def __init__(self, name, device, model, unique_id):
"""Initialize the miio device."""
super().__init__(name, device, model, unique_id)
self._device_features = FEATURE_FLAGS_AIRFRESH
self._available_attributes = AVAILABLE_ATTRIBUTES_AIRFRESH
self._speed_list = OPERATION_MODES_AIR... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"device",
",",
"model",
",",
"unique_id",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"name",
",",
"device",
",",
"model",
",",
"unique_id",
")",
"self",
".",
"_device_features",
"=",
"FEATURE_FL... | [
1236,
4
] | [
1245,
9
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.