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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
HealthCheckResult.__repr__ | (self) | For `print` and `pprint` | For `print` and `pprint` | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | [
110,
4
] | [
112,
28
] | python | en | ['en', 'en', 'en'] | True |
HealthCheckResult.__eq__ | (self, other) | Returns true if both objects are equal | Returns true if both objects are equal | def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, HealthCheckResult):
return False
return self.to_dict() == other.to_dict() | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"HealthCheckResult",
")",
":",
"return",
"False",
"return",
"self",
".",
"to_dict",
"(",
")",
"==",
"other",
".",
"to_dict",
"(",
")"
] | [
114,
4
] | [
119,
48
] | python | en | ['en', 'en', 'en'] | True |
HealthCheckResult.__ne__ | (self, other) | Returns true if both objects are not equal | Returns true if both objects are not equal | def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, HealthCheckResult):
return True
return self.to_dict() != other.to_dict() | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"HealthCheckResult",
")",
":",
"return",
"True",
"return",
"self",
".",
"to_dict",
"(",
")",
"!=",
"other",
".",
"to_dict",
"(",
")"
] | [
121,
4
] | [
126,
48
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Set up the sensor config entry. | Set up the sensor config entry. | async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the sensor config entry."""
controller_data = get_controller_data(hass, entry)
async_add_entities(
[
VeraThermostat(device, controller_data)
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"None",
":",
"controller_data",
"=",
"get_controller_data",
"(",
"hass",
",",
"entry",
... | [
37,
0
] | [
50,
5
] | python | en | ['en', 'pt', 'en'] | True |
VeraThermostat.__init__ | (
self, vera_device: veraApi.VeraThermostat, controller_data: ControllerData
) | Initialize the Vera device. | Initialize the Vera device. | def __init__(
self, vera_device: veraApi.VeraThermostat, controller_data: ControllerData
) -> None:
"""Initialize the Vera device."""
VeraDevice.__init__(self, vera_device, controller_data)
self.entity_id = ENTITY_ID_FORMAT.format(self.vera_id) | [
"def",
"__init__",
"(",
"self",
",",
"vera_device",
":",
"veraApi",
".",
"VeraThermostat",
",",
"controller_data",
":",
"ControllerData",
")",
"->",
"None",
":",
"VeraDevice",
".",
"__init__",
"(",
"self",
",",
"vera_device",
",",
"controller_data",
")",
"self... | [
56,
4
] | [
61,
62
] | python | en | ['en', 'en', 'en'] | True |
VeraThermostat.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self) -> int | None:
"""Return the list of supported features."""
return SUPPORT_FLAGS | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
"|",
"None",
":",
"return",
"SUPPORT_FLAGS"
] | [
64,
4
] | [
66,
28
] | python | en | ['en', 'en', 'en'] | True |
VeraThermostat.hvac_mode | (self) | Return hvac operation ie. heat, cool mode.
Need to be one of HVAC_MODE_*.
| Return hvac operation ie. heat, cool mode. | def hvac_mode(self) -> str:
"""Return hvac operation ie. heat, cool mode.
Need to be one of HVAC_MODE_*.
"""
mode = self.vera_device.get_hvac_mode()
if mode == "HeatOn":
return HVAC_MODE_HEAT
if mode == "CoolOn":
return HVAC_MODE_COOL
if m... | [
"def",
"hvac_mode",
"(",
"self",
")",
"->",
"str",
":",
"mode",
"=",
"self",
".",
"vera_device",
".",
"get_hvac_mode",
"(",
")",
"if",
"mode",
"==",
"\"HeatOn\"",
":",
"return",
"HVAC_MODE_HEAT",
"if",
"mode",
"==",
"\"CoolOn\"",
":",
"return",
"HVAC_MODE_... | [
69,
4
] | [
81,
28
] | python | bg | ['en', 'bg', 'bg'] | True |
VeraThermostat.hvac_modes | (self) | Return the list of available hvac operation modes.
Need to be a subset of HVAC_MODES.
| Return the list of available hvac operation modes. | def hvac_modes(self) -> list[str]:
"""Return the list of available hvac operation modes.
Need to be a subset of HVAC_MODES.
"""
return SUPPORT_HVAC | [
"def",
"hvac_modes",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
":",
"return",
"SUPPORT_HVAC"
] | [
84,
4
] | [
89,
27
] | python | en | ['en', 'en', 'en'] | True |
VeraThermostat.fan_mode | (self) | Return the fan setting. | Return the fan setting. | def fan_mode(self) -> str | None:
"""Return the fan setting."""
mode = self.vera_device.get_fan_mode()
if mode == "ContinuousOn":
return FAN_ON
return FAN_AUTO | [
"def",
"fan_mode",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"mode",
"=",
"self",
".",
"vera_device",
".",
"get_fan_mode",
"(",
")",
"if",
"mode",
"==",
"\"ContinuousOn\"",
":",
"return",
"FAN_ON",
"return",
"FAN_AUTO"
] | [
92,
4
] | [
97,
23
] | python | en | ['en', 'fy', 'en'] | True |
VeraThermostat.fan_modes | (self) | Return a list of available fan modes. | Return a list of available fan modes. | def fan_modes(self) -> list[str] | None:
"""Return a list of available fan modes."""
return FAN_OPERATION_LIST | [
"def",
"fan_modes",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
"|",
"None",
":",
"return",
"FAN_OPERATION_LIST"
] | [
100,
4
] | [
102,
33
] | python | en | ['en', 'en', 'en'] | True |
VeraThermostat.set_fan_mode | (self, fan_mode) | Set new target temperature. | Set new target temperature. | def set_fan_mode(self, fan_mode) -> None:
"""Set new target temperature."""
if fan_mode == FAN_ON:
self.vera_device.fan_on()
else:
self.vera_device.fan_auto()
self.schedule_update_ha_state() | [
"def",
"set_fan_mode",
"(",
"self",
",",
"fan_mode",
")",
"->",
"None",
":",
"if",
"fan_mode",
"==",
"FAN_ON",
":",
"self",
".",
"vera_device",
".",
"fan_on",
"(",
")",
"else",
":",
"self",
".",
"vera_device",
".",
"fan_auto",
"(",
")",
"self",
".",
... | [
104,
4
] | [
111,
39
] | python | en | ['en', 'ca', 'en'] | True |
VeraThermostat.current_power_w | (self) | Return the current power usage in W. | Return the current power usage in W. | def current_power_w(self) -> float | None:
"""Return the current power usage in W."""
power = self.vera_device.power
if power:
return convert(power, float, 0.0) | [
"def",
"current_power_w",
"(",
"self",
")",
"->",
"float",
"|",
"None",
":",
"power",
"=",
"self",
".",
"vera_device",
".",
"power",
"if",
"power",
":",
"return",
"convert",
"(",
"power",
",",
"float",
",",
"0.0",
")"
] | [
114,
4
] | [
118,
45
] | python | en | ['en', 'en', 'en'] | True |
VeraThermostat.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self) -> str:
"""Return the unit of measurement."""
vera_temp_units = self.vera_device.vera_controller.temperature_units
if vera_temp_units == "F":
return TEMP_FAHRENHEIT
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
"->",
"str",
":",
"vera_temp_units",
"=",
"self",
".",
"vera_device",
".",
"vera_controller",
".",
"temperature_units",
"if",
"vera_temp_units",
"==",
"\"F\"",
":",
"return",
"TEMP_FAHRENHEIT",
"return",
"TEMP_CELSIUS"
] | [
121,
4
] | [
128,
27
] | python | en | ['en', 'la', 'en'] | True |
VeraThermostat.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self) -> float | None:
"""Return the current temperature."""
return self.vera_device.get_current_temperature() | [
"def",
"current_temperature",
"(",
"self",
")",
"->",
"float",
"|",
"None",
":",
"return",
"self",
".",
"vera_device",
".",
"get_current_temperature",
"(",
")"
] | [
131,
4
] | [
133,
57
] | python | en | ['en', 'la', 'en'] | True |
VeraThermostat.operation | (self) | Return current operation ie. heat, cool, idle. | Return current operation ie. heat, cool, idle. | def operation(self) -> str:
"""Return current operation ie. heat, cool, idle."""
return self.vera_device.get_hvac_mode() | [
"def",
"operation",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"vera_device",
".",
"get_hvac_mode",
"(",
")"
] | [
136,
4
] | [
138,
47
] | python | en | ['nl', 'en', 'en'] | True |
VeraThermostat.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self) -> float | None:
"""Return the temperature we try to reach."""
return self.vera_device.get_current_goal_temperature() | [
"def",
"target_temperature",
"(",
"self",
")",
"->",
"float",
"|",
"None",
":",
"return",
"self",
".",
"vera_device",
".",
"get_current_goal_temperature",
"(",
")"
] | [
141,
4
] | [
143,
62
] | python | en | ['en', 'en', 'en'] | True |
VeraThermostat.set_temperature | (self, **kwargs: Any) | Set new target temperatures. | Set new target temperatures. | def set_temperature(self, **kwargs: Any) -> None:
"""Set new target temperatures."""
if kwargs.get(ATTR_TEMPERATURE) is not None:
self.vera_device.set_temperature(kwargs.get(ATTR_TEMPERATURE))
self.schedule_update_ha_state() | [
"def",
"set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"if",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"is",
"not",
"None",
":",
"self",
".",
"vera_device",
".",
"set_temperature",
"(",
"kwargs",
"... | [
145,
4
] | [
150,
39
] | python | en | ['en', 'ca', 'en'] | True |
VeraThermostat.set_hvac_mode | (self, hvac_mode) | Set new target hvac mode. | Set new target hvac mode. | def set_hvac_mode(self, hvac_mode) -> None:
"""Set new target hvac mode."""
if hvac_mode == HVAC_MODE_OFF:
self.vera_device.turn_off()
elif hvac_mode == HVAC_MODE_HEAT_COOL:
self.vera_device.turn_auto_on()
elif hvac_mode == HVAC_MODE_COOL:
self.vera_de... | [
"def",
"set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
"->",
"None",
":",
"if",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
":",
"self",
".",
"vera_device",
".",
"turn_off",
"(",
")",
"elif",
"hvac_mode",
"==",
"HVAC_MODE_HEAT_COOL",
":",
"self",
".",
"vera_dev... | [
152,
4
] | [
163,
39
] | python | da | ['da', 'su', 'en'] | False |
async_setup_entry | (
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Set up Verisure sensors based on a config entry. | Set up Verisure sensors based on a config entry. | async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up Verisure sensors based on a config entry."""
coordinator: VerisureDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
sensors: list[Entity] = [
Veris... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"None",
":",
"coordinator",
":",
"VerisureDataUpdateCoordinator",
"=",
"hass",
".",
"da... | [
19,
0
] | [
44,
31
] | python | en | ['en', 'da', 'en'] | True |
VerisureThermometer.__init__ | (
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
) | Initialize the sensor. | Initialize the sensor. | def __init__(
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
) -> None:
"""Initialize the sensor."""
super().__init__(coordinator)
self._attr_unique_id = f"{serial_number}_temperature"
self.serial_number = serial_number | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
":",
"VerisureDataUpdateCoordinator",
",",
"serial_number",
":",
"str",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_attr_unique_id",
"=",
"f\"{serial_nu... | [
55,
4
] | [
61,
42
] | python | en | ['en', 'en', 'en'] | True |
VerisureThermometer.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self) -> str:
"""Return the name of the entity."""
name = self.coordinator.data["climate"][self.serial_number]["deviceArea"]
return f"{name} Temperature" | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"name",
"=",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"climate\"",
"]",
"[",
"self",
".",
"serial_number",
"]",
"[",
"\"deviceArea\"",
"]",
"return",
"f\"{name} Temperature\""
] | [
64,
4
] | [
67,
36
] | python | en | ['en', 'en', 'en'] | True |
VerisureThermometer.device_info | (self) | Return device information about this entity. | Return device information about this entity. | def device_info(self) -> DeviceInfo:
"""Return device information about this entity."""
device_type = self.coordinator.data["climate"][self.serial_number].get(
"deviceType"
)
area = self.coordinator.data["climate"][self.serial_number]["deviceArea"]
return {
... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"DeviceInfo",
":",
"device_type",
"=",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"climate\"",
"]",
"[",
"self",
".",
"serial_number",
"]",
".",
"get",
"(",
"\"deviceType\"",
")",
"area",
"=",
"self",
".... | [
70,
4
] | [
83,
9
] | python | en | ['en', 'en', 'en'] | True |
VerisureThermometer.native_value | (self) | Return the state of the entity. | Return the state of the entity. | def native_value(self) -> str | None:
"""Return the state of the entity."""
return self.coordinator.data["climate"][self.serial_number]["temperature"] | [
"def",
"native_value",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"climate\"",
"]",
"[",
"self",
".",
"serial_number",
"]",
"[",
"\"temperature\"",
"]"
] | [
86,
4
] | [
88,
82
] | python | en | ['en', 'en', 'en'] | True |
VerisureThermometer.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self) -> bool:
"""Return True if entity is available."""
return (
super().available
and self.serial_number in self.coordinator.data["climate"]
and "temperature" in self.coordinator.data["climate"][self.serial_number]
) | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"(",
"super",
"(",
")",
".",
"available",
"and",
"self",
".",
"serial_number",
"in",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"climate\"",
"]",
"and",
"\"temperature\"",
"in",
"sel... | [
91,
4
] | [
97,
9
] | python | en | ['en', 'en', 'en'] | True |
VerisureHygrometer.__init__ | (
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
) | Initialize the sensor. | Initialize the sensor. | def __init__(
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
) -> None:
"""Initialize the sensor."""
super().__init__(coordinator)
self._attr_unique_id = f"{serial_number}_humidity"
self.serial_number = serial_number | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
":",
"VerisureDataUpdateCoordinator",
",",
"serial_number",
":",
"str",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_attr_unique_id",
"=",
"f\"{serial_nu... | [
108,
4
] | [
114,
42
] | python | en | ['en', 'en', 'en'] | True |
VerisureHygrometer.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self) -> str:
"""Return the name of the entity."""
name = self.coordinator.data["climate"][self.serial_number]["deviceArea"]
return f"{name} Humidity" | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"name",
"=",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"climate\"",
"]",
"[",
"self",
".",
"serial_number",
"]",
"[",
"\"deviceArea\"",
"]",
"return",
"f\"{name} Humidity\""
] | [
117,
4
] | [
120,
33
] | python | en | ['en', 'en', 'en'] | True |
VerisureHygrometer.device_info | (self) | Return device information about this entity. | Return device information about this entity. | def device_info(self) -> DeviceInfo:
"""Return device information about this entity."""
device_type = self.coordinator.data["climate"][self.serial_number].get(
"deviceType"
)
area = self.coordinator.data["climate"][self.serial_number]["deviceArea"]
return {
... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"DeviceInfo",
":",
"device_type",
"=",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"climate\"",
"]",
"[",
"self",
".",
"serial_number",
"]",
".",
"get",
"(",
"\"deviceType\"",
")",
"area",
"=",
"self",
".... | [
123,
4
] | [
136,
9
] | python | en | ['en', 'en', 'en'] | True |
VerisureHygrometer.native_value | (self) | Return the state of the entity. | Return the state of the entity. | def native_value(self) -> str | None:
"""Return the state of the entity."""
return self.coordinator.data["climate"][self.serial_number]["humidity"] | [
"def",
"native_value",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"climate\"",
"]",
"[",
"self",
".",
"serial_number",
"]",
"[",
"\"humidity\"",
"]"
] | [
139,
4
] | [
141,
79
] | python | en | ['en', 'en', 'en'] | True |
VerisureHygrometer.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self) -> bool:
"""Return True if entity is available."""
return (
super().available
and self.serial_number in self.coordinator.data["climate"]
and "humidity" in self.coordinator.data["climate"][self.serial_number]
) | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"(",
"super",
"(",
")",
".",
"available",
"and",
"self",
".",
"serial_number",
"in",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"climate\"",
"]",
"and",
"\"humidity\"",
"in",
"self",... | [
144,
4
] | [
150,
9
] | python | en | ['en', 'en', 'en'] | True |
VerisureMouseDetection.__init__ | (
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
) | Initialize the sensor. | Initialize the sensor. | def __init__(
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
) -> None:
"""Initialize the sensor."""
super().__init__(coordinator)
self._attr_unique_id = f"{serial_number}_mice"
self.serial_number = serial_number | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
":",
"VerisureDataUpdateCoordinator",
",",
"serial_number",
":",
"str",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_attr_unique_id",
"=",
"f\"{serial_nu... | [
160,
4
] | [
166,
42
] | python | en | ['en', 'en', 'en'] | True |
VerisureMouseDetection.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self) -> str:
"""Return the name of the entity."""
name = self.coordinator.data["mice"][self.serial_number]["area"]
return f"{name} Mouse" | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"name",
"=",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"mice\"",
"]",
"[",
"self",
".",
"serial_number",
"]",
"[",
"\"area\"",
"]",
"return",
"f\"{name} Mouse\""
] | [
169,
4
] | [
172,
30
] | python | en | ['en', 'en', 'en'] | True |
VerisureMouseDetection.device_info | (self) | Return device information about this entity. | Return device information about this entity. | def device_info(self) -> DeviceInfo:
"""Return device information about this entity."""
area = self.coordinator.data["mice"][self.serial_number]["area"]
return {
"name": area,
"suggested_area": area,
"manufacturer": "Verisure",
"model": "Mouse dete... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"DeviceInfo",
":",
"area",
"=",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"mice\"",
"]",
"[",
"self",
".",
"serial_number",
"]",
"[",
"\"area\"",
"]",
"return",
"{",
"\"name\"",
":",
"area",
",",
"\"s... | [
175,
4
] | [
185,
9
] | python | en | ['en', 'en', 'en'] | True |
VerisureMouseDetection.native_value | (self) | Return the state of the entity. | Return the state of the entity. | def native_value(self) -> str | None:
"""Return the state of the entity."""
return self.coordinator.data["mice"][self.serial_number]["detections"] | [
"def",
"native_value",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"mice\"",
"]",
"[",
"self",
".",
"serial_number",
"]",
"[",
"\"detections\"",
"]"
] | [
188,
4
] | [
190,
78
] | python | en | ['en', 'en', 'en'] | True |
VerisureMouseDetection.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self) -> bool:
"""Return True if entity is available."""
return (
super().available
and self.serial_number in self.coordinator.data["mice"]
and "detections" in self.coordinator.data["mice"][self.serial_number]
) | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"(",
"super",
"(",
")",
".",
"available",
"and",
"self",
".",
"serial_number",
"in",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"mice\"",
"]",
"and",
"\"detections\"",
"in",
"self",
... | [
193,
4
] | [
199,
9
] | python | en | ['en', 'en', 'en'] | True |
activate | (hass, entity_id=ENTITY_MATCH_ALL) | Activate a scene. | Activate a scene. | def activate(hass, entity_id=ENTITY_MATCH_ALL):
"""Activate a scene."""
data = {}
if entity_id:
data[ATTR_ENTITY_ID] = entity_id
hass.services.call(DOMAIN, SERVICE_TURN_ON, data) | [
"def",
"activate",
"(",
"hass",
",",
"entity_id",
"=",
"ENTITY_MATCH_ALL",
")",
":",
"data",
"=",
"{",
"}",
"if",
"entity_id",
":",
"data",
"[",
"ATTR_ENTITY_ID",
"]",
"=",
"entity_id",
"hass",
".",
"services",
".",
"call",
"(",
"DOMAIN",
",",
"SERVICE_T... | [
11,
0
] | [
18,
53
] | python | en | ['en', 'it', 'en'] | True |
mock_dummy_device_from_host_light_fan | () | Mock a valid api_devce. | Mock a valid api_devce. | def mock_dummy_device_from_host_light_fan():
"""Mock a valid api_devce."""
device = pywilight.wilight_from_discovery(
f"http://{HOST}:45995/wilight.xml",
UPNP_MAC_ADDRESS,
UPNP_MODEL_NAME_COVER,
UPNP_SERIAL,
UPNP_MODEL_NUMBER,
)
device.set_dummy(True)
with ... | [
"def",
"mock_dummy_device_from_host_light_fan",
"(",
")",
":",
"device",
"=",
"pywilight",
".",
"wilight_from_discovery",
"(",
"f\"http://{HOST}:45995/wilight.xml\"",
",",
"UPNP_MAC_ADDRESS",
",",
"UPNP_MODEL_NAME_COVER",
",",
"UPNP_SERIAL",
",",
"UPNP_MODEL_NUMBER",
",",
"... | [
37,
0
] | [
54,
20
] | python | en | ['en', 'ca', 'en'] | True |
test_loading_cover | (
hass: HomeAssistant,
dummy_device_from_host_cover,
) | Test the WiLight configuration entry loading. | Test the WiLight configuration entry loading. | async def test_loading_cover(
hass: HomeAssistant,
dummy_device_from_host_cover,
) -> None:
"""Test the WiLight configuration entry loading."""
entry = await setup_integration(hass)
assert entry
assert entry.unique_id == WILIGHT_ID
entity_registry = er.async_get(hass)
# First segment ... | [
"async",
"def",
"test_loading_cover",
"(",
"hass",
":",
"HomeAssistant",
",",
"dummy_device_from_host_cover",
",",
")",
"->",
"None",
":",
"entry",
"=",
"await",
"setup_integration",
"(",
"hass",
")",
"assert",
"entry",
"assert",
"entry",
".",
"unique_id",
"==",... | [
57,
0
] | [
76,
48
] | python | en | ['en', 'en', 'en'] | True |
test_open_close_cover_state | (
hass: HomeAssistant, dummy_device_from_host_cover
) | Test the change of state of the cover. | Test the change of state of the cover. | async def test_open_close_cover_state(
hass: HomeAssistant, dummy_device_from_host_cover
) -> None:
"""Test the change of state of the cover."""
await setup_integration(hass)
# Open
await hass.services.async_call(
COVER_DOMAIN,
SERVICE_OPEN_COVER,
{ATTR_ENTITY_ID: "cover.wl0... | [
"async",
"def",
"test_open_close_cover_state",
"(",
"hass",
":",
"HomeAssistant",
",",
"dummy_device_from_host_cover",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass",
")",
"# Open",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"COVE... | [
79,
0
] | [
136,
36
] | python | en | ['en', 'en', 'en'] | True |
get_service | (hass, config, discovery_info=None) | Get the MessageBird notification service. | Get the MessageBird notification service. | def get_service(hass, config, discovery_info=None):
"""Get the MessageBird notification service."""
client = messagebird.Client(config[CONF_API_KEY])
try:
# validates the api key
client.balance()
except messagebird.client.ErrorException:
_LOGGER.error("The specified MessageBird A... | [
"def",
"get_service",
"(",
"hass",
",",
"config",
",",
"discovery_info",
"=",
"None",
")",
":",
"client",
"=",
"messagebird",
".",
"Client",
"(",
"config",
"[",
"CONF_API_KEY",
"]",
")",
"try",
":",
"# validates the api key",
"client",
".",
"balance",
"(",
... | [
27,
0
] | [
37,
74
] | python | en | ['en', 'lb', 'en'] | True |
MessageBirdNotificationService.__init__ | (self, sender, client) | Initialize the service. | Initialize the service. | def __init__(self, sender, client):
"""Initialize the service."""
self.sender = sender
self.client = client | [
"def",
"__init__",
"(",
"self",
",",
"sender",
",",
"client",
")",
":",
"self",
".",
"sender",
"=",
"sender",
"self",
".",
"client",
"=",
"client"
] | [
43,
4
] | [
46,
28
] | python | en | ['en', 'en', 'en'] | True |
MessageBirdNotificationService.send_message | (self, message=None, **kwargs) | Send a message to a specified target. | Send a message to a specified target. | def send_message(self, message=None, **kwargs):
"""Send a message to a specified target."""
targets = kwargs.get(ATTR_TARGET)
if not targets:
_LOGGER.error("No target specified")
return
for target in targets:
try:
self.client.message_c... | [
"def",
"send_message",
"(",
"self",
",",
"message",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"targets",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TARGET",
")",
"if",
"not",
"targets",
":",
"_LOGGER",
".",
"error",
"(",
"\"No target specified\"",
")",
... | [
48,
4
] | [
62,
24
] | python | en | ['en', 'en', 'en'] | True |
async_init_integration | (
hass: HomeAssistant,
skip_setup: bool = False,
) | Set up the tado integration in Home Assistant. | Set up the tado integration in Home Assistant. | async def async_init_integration(
hass: HomeAssistant,
skip_setup: bool = False,
):
"""Set up the tado integration in Home Assistant."""
token_fixture = "tado/token.json"
devices_fixture = "tado/devices.json"
me_fixture = "tado/me.json"
weather_fixture = "tado/weather.json"
zones_fixtur... | [
"async",
"def",
"async_init_integration",
"(",
"hass",
":",
"HomeAssistant",
",",
"skip_setup",
":",
"bool",
"=",
"False",
",",
")",
":",
"token_fixture",
"=",
"\"tado/token.json\"",
"devices_fixture",
"=",
"\"tado/devices.json\"",
"me_fixture",
"=",
"\"tado/me.json\"... | [
11,
0
] | [
149,
46
] | python | en | ['en', 'en', 'en'] | True |
sense_to_mdi | (sense_icon) | Convert sense icon to mdi icon. | Convert sense icon to mdi icon. | def sense_to_mdi(sense_icon):
"""Convert sense icon to mdi icon."""
return "mdi:{}".format(MDI_ICONS.get(sense_icon, "power-plug")) | [
"def",
"sense_to_mdi",
"(",
"sense_icon",
")",
":",
"return",
"\"mdi:{}\"",
".",
"format",
"(",
"MDI_ICONS",
".",
"get",
"(",
"sense_icon",
",",
"\"power-plug\"",
")",
")"
] | [
80,
0
] | [
82,
67
] | python | el-Latn | ['en', 'el-Latn', 'pt'] | False |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the Sense sensor. | Set up the Sense sensor. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Sense sensor."""
data = hass.data[DOMAIN][config_entry.entry_id][SENSE_DATA]
sense_devices_data = hass.data[DOMAIN][config_entry.entry_id][SENSE_DEVICES_DATA]
trends_coordinator = hass.data[DOMAIN][config_entry.entry_id][... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"[",
"SENSE_DATA",
"]",
"sense_devices_data",
"=",
"h... | [
85,
0
] | [
146,
31
] | python | en | ['en', 'sq', 'en'] | True |
SensorConfig.__init__ | (self, name, sensor_type) | Sensor name and type to pass to API. | Sensor name and type to pass to API. | def __init__(self, name, sensor_type):
"""Sensor name and type to pass to API."""
self.name = name
self.sensor_type = sensor_type | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"sensor_type",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"sensor_type",
"=",
"sensor_type"
] | [
50,
4
] | [
53,
38
] | python | en | ['en', 'mi', 'en'] | True |
SenseActiveSensor.__init__ | (
self,
data,
name,
sensor_type,
sense_monitor_id,
variant_id,
variant_name,
unique_id,
) | Initialize the Sense sensor. | Initialize the Sense sensor. | def __init__(
self,
data,
name,
sensor_type,
sense_monitor_id,
variant_id,
variant_name,
unique_id,
):
"""Initialize the Sense sensor."""
self._attr_name = f"{name} {variant_name}"
self._attr_unique_id = unique_id
self._... | [
"def",
"__init__",
"(",
"self",
",",
"data",
",",
"name",
",",
"sensor_type",
",",
"sense_monitor_id",
",",
"variant_id",
",",
"variant_name",
",",
"unique_id",
",",
")",
":",
"self",
".",
"_attr_name",
"=",
"f\"{name} {variant_name}\"",
"self",
".",
"_attr_un... | [
159,
4
] | [
176,
41
] | python | en | ['en', 'sq', 'en'] | True |
SenseActiveSensor.async_added_to_hass | (self) | Register callbacks. | Register callbacks. | async def async_added_to_hass(self):
"""Register callbacks."""
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{SENSE_DEVICE_UPDATE}-{self._sense_monitor_id}",
self._async_update_from_data,
)
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"f\"{SENSE_DEVICE_UPDATE}-{self._sense_monitor_id}\"",
",",
"self",
".",
"_async_update_from_data",
",",
")",
... | [
178,
4
] | [
186,
9
] | python | en | ['en', 'no', 'en'] | False |
SenseActiveSensor._async_update_from_data | (self) | Update the sensor from the data. Must not do I/O. | Update the sensor from the data. Must not do I/O. | def _async_update_from_data(self):
"""Update the sensor from the data. Must not do I/O."""
new_state = round(
self._data.active_solar_power
if self._variant_id == PRODUCTION_ID
else self._data.active_power
)
if self._attr_available and self._attr_nativ... | [
"def",
"_async_update_from_data",
"(",
"self",
")",
":",
"new_state",
"=",
"round",
"(",
"self",
".",
"_data",
".",
"active_solar_power",
"if",
"self",
".",
"_variant_id",
"==",
"PRODUCTION_ID",
"else",
"self",
".",
"_data",
".",
"active_power",
")",
"if",
"... | [
189,
4
] | [
200,
35
] | python | en | ['en', 'en', 'en'] | True |
SenseVoltageSensor.__init__ | (
self,
data,
index,
sense_monitor_id,
) | Initialize the Sense sensor. | Initialize the Sense sensor. | def __init__(
self,
data,
index,
sense_monitor_id,
):
"""Initialize the Sense sensor."""
line_num = index + 1
self._attr_name = f"L{line_num} Voltage"
self._attr_unique_id = f"{sense_monitor_id}-L{line_num}"
self._data = data
self._sens... | [
"def",
"__init__",
"(",
"self",
",",
"data",
",",
"index",
",",
"sense_monitor_id",
",",
")",
":",
"line_num",
"=",
"index",
"+",
"1",
"self",
".",
"_attr_name",
"=",
"f\"L{line_num} Voltage\"",
"self",
".",
"_attr_unique_id",
"=",
"f\"{sense_monitor_id}-L{line_... | [
212,
4
] | [
224,
35
] | python | en | ['en', 'sq', 'en'] | True |
SenseVoltageSensor.async_added_to_hass | (self) | Register callbacks. | Register callbacks. | async def async_added_to_hass(self):
"""Register callbacks."""
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{SENSE_DEVICE_UPDATE}-{self._sense_monitor_id}",
self._async_update_from_data,
)
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"f\"{SENSE_DEVICE_UPDATE}-{self._sense_monitor_id}\"",
",",
"self",
".",
"_async_update_from_data",
",",
")",
... | [
226,
4
] | [
234,
9
] | python | en | ['en', 'no', 'en'] | False |
SenseVoltageSensor._async_update_from_data | (self) | Update the sensor from the data. Must not do I/O. | Update the sensor from the data. Must not do I/O. | def _async_update_from_data(self):
"""Update the sensor from the data. Must not do I/O."""
new_state = round(self._data.active_voltage[self._voltage_index], 1)
if self._attr_available and self._attr_native_value == new_state:
return
self._attr_available = True
self._a... | [
"def",
"_async_update_from_data",
"(",
"self",
")",
":",
"new_state",
"=",
"round",
"(",
"self",
".",
"_data",
".",
"active_voltage",
"[",
"self",
".",
"_voltage_index",
"]",
",",
"1",
")",
"if",
"self",
".",
"_attr_available",
"and",
"self",
".",
"_attr_n... | [
237,
4
] | [
244,
35
] | python | en | ['en', 'en', 'en'] | True |
SenseTrendsSensor.__init__ | (
self,
data,
name,
sensor_type,
variant_id,
variant_name,
trends_coordinator,
unique_id,
) | Initialize the Sense sensor. | Initialize the Sense sensor. | def __init__(
self,
data,
name,
sensor_type,
variant_id,
variant_name,
trends_coordinator,
unique_id,
):
"""Initialize the Sense sensor."""
self._attr_name = f"{name} {variant_name}"
self._attr_unique_id = unique_id
self... | [
"def",
"__init__",
"(",
"self",
",",
"data",
",",
"name",
",",
"sensor_type",
",",
"variant_id",
",",
"variant_name",
",",
"trends_coordinator",
",",
"unique_id",
",",
")",
":",
"self",
".",
"_attr_name",
"=",
"f\"{name} {variant_name}\"",
"self",
".",
"_attr_... | [
257,
4
] | [
280,
42
] | python | en | ['en', 'sq', 'en'] | True |
SenseTrendsSensor.native_value | (self) | Return the state of the sensor. | Return the state of the sensor. | def native_value(self):
"""Return the state of the sensor."""
return round(self._data.get_trend(self._sensor_type, self._variant_id), 1) | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"round",
"(",
"self",
".",
"_data",
".",
"get_trend",
"(",
"self",
".",
"_sensor_type",
",",
"self",
".",
"_variant_id",
")",
",",
"1",
")"
] | [
283,
4
] | [
285,
82
] | python | en | ['en', 'en', 'en'] | True |
SenseTrendsSensor.available | (self) | Return if entity is available. | Return if entity is available. | def available(self):
"""Return if entity is available."""
return self._had_any_update and self._coordinator.last_update_success | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_had_any_update",
"and",
"self",
".",
"_coordinator",
".",
"last_update_success"
] | [
288,
4
] | [
290,
77
] | python | en | ['en', 'en', 'en'] | True |
SenseTrendsSensor._async_update | (self) | Track if we had an update so we do not report zero data. | Track if we had an update so we do not report zero data. | def _async_update(self):
"""Track if we had an update so we do not report zero data."""
self._had_any_update = True
self.async_write_ha_state() | [
"def",
"_async_update",
"(",
"self",
")",
":",
"self",
".",
"_had_any_update",
"=",
"True",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
293,
4
] | [
296,
35
] | python | en | ['br', 'en', 'en'] | True |
SenseTrendsSensor.async_update | (self) | Update the entity.
Only used by the generic entity update service.
| Update the entity. | async def async_update(self):
"""Update the entity.
Only used by the generic entity update service.
"""
await self._coordinator.async_request_refresh() | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"_coordinator",
".",
"async_request_refresh",
"(",
")"
] | [
298,
4
] | [
303,
55
] | python | en | ['en', 'en', 'en'] | True |
SenseTrendsSensor.async_added_to_hass | (self) | When entity is added to hass. | When entity is added to hass. | async def async_added_to_hass(self):
"""When entity is added to hass."""
self.async_on_remove(self._coordinator.async_add_listener(self._async_update)) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"self",
".",
"_coordinator",
".",
"async_add_listener",
"(",
"self",
".",
"_async_update",
")",
")"
] | [
305,
4
] | [
307,
86
] | python | en | ['en', 'en', 'en'] | True |
SenseEnergyDevice.__init__ | (self, sense_devices_data, device, sense_monitor_id) | Initialize the Sense binary sensor. | Initialize the Sense binary sensor. | def __init__(self, sense_devices_data, device, sense_monitor_id):
"""Initialize the Sense binary sensor."""
self._attr_name = f"{device['name']} {CONSUMPTION_NAME}"
self._id = device["id"]
self._sense_monitor_id = sense_monitor_id
self._attr_unique_id = f"{sense_monitor_id}-{self... | [
"def",
"__init__",
"(",
"self",
",",
"sense_devices_data",
",",
"device",
",",
"sense_monitor_id",
")",
":",
"self",
".",
"_attr_name",
"=",
"f\"{device['name']} {CONSUMPTION_NAME}\"",
"self",
".",
"_id",
"=",
"device",
"[",
"\"id\"",
"]",
"self",
".",
"_sense_m... | [
320,
4
] | [
327,
53
] | python | en | ['en', 'pt', 'en'] | True |
SenseEnergyDevice.async_added_to_hass | (self) | Register callbacks. | Register callbacks. | async def async_added_to_hass(self):
"""Register callbacks."""
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{SENSE_DEVICE_UPDATE}-{self._sense_monitor_id}",
self._async_update_from_data,
)
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"f\"{SENSE_DEVICE_UPDATE}-{self._sense_monitor_id}\"",
",",
"self",
".",
"_async_update_from_data",
",",
")",
... | [
329,
4
] | [
337,
9
] | python | en | ['en', 'no', 'en'] | False |
SenseEnergyDevice._async_update_from_data | (self) | Get the latest data, update state. Must not do I/O. | Get the latest data, update state. Must not do I/O. | def _async_update_from_data(self):
"""Get the latest data, update state. Must not do I/O."""
device_data = self._sense_devices_data.get_device_by_id(self._id)
if not device_data or "w" not in device_data:
new_state = 0
else:
new_state = int(device_data["w"])
... | [
"def",
"_async_update_from_data",
"(",
"self",
")",
":",
"device_data",
"=",
"self",
".",
"_sense_devices_data",
".",
"get_device_by_id",
"(",
"self",
".",
"_id",
")",
"if",
"not",
"device_data",
"or",
"\"w\"",
"not",
"in",
"device_data",
":",
"new_state",
"="... | [
340,
4
] | [
351,
35
] | python | en | ['en', 'en', 'en'] | True |
mill_setup_fixture | () | Patch mill setup entry. | Patch mill setup entry. | def mill_setup_fixture():
"""Patch mill setup entry."""
with patch("homeassistant.components.mill.async_setup_entry", return_value=True):
yield | [
"def",
"mill_setup_fixture",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.mill.async_setup_entry\"",
",",
"return_value",
"=",
"True",
")",
":",
"yield"
] | [
13,
0
] | [
16,
13
] | python | en | ['en', 'cs', 'en'] | True |
test_show_config_form | (hass) | Test show configuration form. | Test show configuration form. | async def test_show_config_form(hass):
"""Test show configuration form."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["step_id"] == "user" | [
"async",
"def",
"test_show_config_form",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")",... | [
19,
0
] | [
26,
38
] | python | en | ['en', 'fr', 'en'] | True |
test_create_entry | (hass) | Test create entry from user input. | Test create entry from user input. | async def test_create_entry(hass):
"""Test create entry from user input."""
test_data = {
CONF_USERNAME: "user",
CONF_PASSWORD: "pswd",
}
with patch("mill.Mill.connect", return_value=True):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source"... | [
"async",
"def",
"test_create_entry",
"(",
"hass",
")",
":",
"test_data",
"=",
"{",
"CONF_USERNAME",
":",
"\"user\"",
",",
"CONF_PASSWORD",
":",
"\"pswd\"",
",",
"}",
"with",
"patch",
"(",
"\"mill.Mill.connect\"",
",",
"return_value",
"=",
"True",
")",
":",
"... | [
29,
0
] | [
43,
38
] | python | en | ['en', 'en', 'en'] | True |
test_flow_entry_already_exists | (hass) | Test user input for config_entry that already exists. | Test user input for config_entry that already exists. | async def test_flow_entry_already_exists(hass):
"""Test user input for config_entry that already exists."""
test_data = {
CONF_USERNAME: "user",
CONF_PASSWORD: "pswd",
}
first_entry = MockConfigEntry(
domain="mill",
data=test_data,
unique_id=test_data[CONF_USERN... | [
"async",
"def",
"test_flow_entry_already_exists",
"(",
"hass",
")",
":",
"test_data",
"=",
"{",
"CONF_USERNAME",
":",
"\"user\"",
",",
"CONF_PASSWORD",
":",
"\"pswd\"",
",",
"}",
"first_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"mill\"",
",",
"data",... | [
46,
0
] | [
67,
51
] | python | en | ['en', 'en', 'en'] | True |
test_connection_error | (hass) | Test connection error. | Test connection error. | async def test_connection_error(hass):
"""Test connection error."""
test_data = {
CONF_USERNAME: "user",
CONF_PASSWORD: "pswd",
}
first_entry = MockConfigEntry(
domain="mill",
data=test_data,
unique_id=test_data[CONF_USERNAME],
)
first_entry.add_to_hass(... | [
"async",
"def",
"test_connection_error",
"(",
"hass",
")",
":",
"test_data",
"=",
"{",
"CONF_USERNAME",
":",
"\"user\"",
",",
"CONF_PASSWORD",
":",
"\"pswd\"",
",",
"}",
"first_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"mill\"",
",",
"data",
"=",
... | [
70,
0
] | [
91,
65
] | python | de | ['eu', 'de', 'en'] | False |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the Smile switches from a config entry. | Set up the Smile switches from a config entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Smile switches from a config entry."""
# PLACEHOLDER USB entry setup
return await async_setup_entry_gateway(hass, config_entry, async_add_entities) | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"# PLACEHOLDER USB entry setup",
"return",
"await",
"async_setup_entry_gateway",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")"
] | [
15,
0
] | [
18,
82
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry_gateway | (hass, config_entry, async_add_entities) | Set up the Smile switches from a config entry. | Set up the Smile switches from a config entry. | async def async_setup_entry_gateway(hass, config_entry, async_add_entities):
"""Set up the Smile switches from a config entry."""
api = hass.data[DOMAIN][config_entry.entry_id]["api"]
coordinator = hass.data[DOMAIN][config_entry.entry_id][COORDINATOR]
entities = []
switch_classes = ["plug", "switch... | [
"async",
"def",
"async_setup_entry_gateway",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"api",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"[",
"\"api\"",
"]",
"coordinator",
"=",
"hass... | [
21,
0
] | [
50,
38
] | python | en | ['en', 'en', 'en'] | True |
GwSwitch.__init__ | (self, api, coordinator, name, dev_id, members, model) | Set up the Plugwise API. | Set up the Plugwise API. | def __init__(self, api, coordinator, name, dev_id, members, model):
"""Set up the Plugwise API."""
super().__init__(api, coordinator, name, dev_id)
self._members = members
self._model = model
self._is_on = False
self._icon = SWITCH_ICON
self._unique_id = f"{dev... | [
"def",
"__init__",
"(",
"self",
",",
"api",
",",
"coordinator",
",",
"name",
",",
"dev_id",
",",
"members",
",",
"model",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"api",
",",
"coordinator",
",",
"name",
",",
"dev_id",
")",
"self",
".",
"_... | [
56,
4
] | [
66,
42
] | python | en | ['en', 'zu', 'en'] | True |
GwSwitch.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._is_on | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_on"
] | [
69,
4
] | [
71,
26
] | python | en | ['en', 'fy', 'en'] | True |
GwSwitch.icon | (self) | Return the icon of this entity. | Return the icon of this entity. | def icon(self):
"""Return the icon of this entity."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_icon"
] | [
74,
4
] | [
76,
25
] | python | en | ['en', 'en', 'en'] | True |
GwSwitch.async_turn_on | (self, **kwargs) | Turn the device on. | Turn the device on. | async def async_turn_on(self, **kwargs):
"""Turn the device on."""
try:
state_on = await self._api.set_relay_state(
self._dev_id, self._members, "on"
)
if state_on:
self._is_on = True
self.async_write_ha_state()
... | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"state_on",
"=",
"await",
"self",
".",
"_api",
".",
"set_relay_state",
"(",
"self",
".",
"_dev_id",
",",
"self",
".",
"_members",
",",
"\"on\"",
")",
"if",
"... | [
78,
4
] | [
88,
64
] | python | en | ['en', 'en', 'en'] | True |
GwSwitch.async_turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | async def async_turn_off(self, **kwargs):
"""Turn the device off."""
try:
state_off = await self._api.set_relay_state(
self._dev_id, self._members, "off"
)
if state_off:
self._is_on = False
self.async_write_ha_state()
... | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"state_off",
"=",
"await",
"self",
".",
"_api",
".",
"set_relay_state",
"(",
"self",
".",
"_dev_id",
",",
"self",
".",
"_members",
",",
"\"off\"",
")",
"if",
... | [
90,
4
] | [
100,
64
] | python | en | ['en', 'en', 'en'] | True |
GwSwitch._async_process_data | (self) | Update the data from the Plugs. | Update the data from the Plugs. | def _async_process_data(self):
"""Update the data from the Plugs."""
data = self._api.get_device_data(self._dev_id)
if not data:
_LOGGER.error("Received no data for device %s", self._name)
self.async_write_ha_state()
return
if "relay" in data:
... | [
"def",
"_async_process_data",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"_api",
".",
"get_device_data",
"(",
"self",
".",
"_dev_id",
")",
"if",
"not",
"data",
":",
"_LOGGER",
".",
"error",
"(",
"\"Received no data for device %s\"",
",",
"self",
".",
... | [
103,
4
] | [
115,
35
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (
hass: HomeAssistant,
config: ConfigType,
async_add_entities,
discovery_info: DiscoveryInfoType = None,
) | Set up the Flexit Platform. | Set up the Flexit Platform. | async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities,
discovery_info: DiscoveryInfoType = None,
):
"""Set up the Flexit Platform."""
modbus_slave = config.get(CONF_SLAVE)
name = config.get(CONF_NAME)
hub = get_hub(hass, config[CONF_HUB])
async_a... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"async_add_entities",
",",
"discovery_info",
":",
"DiscoveryInfoType",
"=",
"None",
",",
")",
":",
"modbus_slave",
"=",
"config",
".",
"get",
"(",
... | [
46,
0
] | [
56,
63
] | python | en | ['en', 'da', 'en'] | True |
Flexit.__init__ | (
self, hub: ModbusHub, modbus_slave: int | None, name: str | None
) | Initialize the unit. | Initialize the unit. | def __init__(
self, hub: ModbusHub, modbus_slave: int | None, name: str | None
) -> None:
"""Initialize the unit."""
self._hub = hub
self._name = name
self._slave = modbus_slave
self._target_temperature = None
self._current_temperature = None
self._cur... | [
"def",
"__init__",
"(",
"self",
",",
"hub",
":",
"ModbusHub",
",",
"modbus_slave",
":",
"int",
"|",
"None",
",",
"name",
":",
"str",
"|",
"None",
")",
"->",
"None",
":",
"self",
".",
"_hub",
"=",
"hub",
"self",
".",
"_name",
"=",
"name",
"self",
... | [
62,
4
] | [
82,
37
] | python | en | ['en', 'en', 'en'] | True |
Flexit.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self):
"""Return the list of supported features."""
return SUPPORT_FLAGS | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_FLAGS"
] | [
85,
4
] | [
87,
28
] | python | en | ['en', 'en', 'en'] | True |
Flexit.async_update | (self) | Update unit attributes. | Update unit attributes. | async def async_update(self):
"""Update unit attributes."""
self._target_temperature = await self._async_read_temp_from_register(
CALL_TYPE_REGISTER_HOLDING, 8
)
self._current_temperature = await self._async_read_temp_from_register(
CALL_TYPE_REGISTER_INPUT, 9
... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"self",
".",
"_target_temperature",
"=",
"await",
"self",
".",
"_async_read_temp_from_register",
"(",
"CALL_TYPE_REGISTER_HOLDING",
",",
"8",
")",
"self",
".",
"_current_temperature",
"=",
"await",
"self",
"."... | [
89,
4
] | [
140,
43
] | python | en | ['en', 'la', 'en'] | True |
Flexit.extra_state_attributes | (self) | Return device specific state attributes. | Return device specific state attributes. | def extra_state_attributes(self):
"""Return device specific state attributes."""
return {
"filter_hours": self._filter_hours,
"filter_alarm": self._filter_alarm,
"heat_recovery": self._heat_recovery,
"heating": self._heating,
"heater_enabled": ... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"\"filter_hours\"",
":",
"self",
".",
"_filter_hours",
",",
"\"filter_alarm\"",
":",
"self",
".",
"_filter_alarm",
",",
"\"heat_recovery\"",
":",
"self",
".",
"_heat_recovery",
",",
"\"heating\... | [
143,
4
] | [
153,
9
] | python | en | ['fr', 'en', 'en'] | True |
Flexit.should_poll | (self) | Return the polling state. | Return the polling state. | def should_poll(self):
"""Return the polling state."""
return True | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"True"
] | [
156,
4
] | [
158,
19
] | python | en | ['en', 'en', 'en'] | True |
Flexit.name | (self) | Return the name of the climate device. | Return the name of the climate device. | def name(self):
"""Return the name of the climate device."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
161,
4
] | [
163,
25
] | python | en | ['en', 'en', 'en'] | True |
Flexit.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self):
"""Return the unit of measurement."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
166,
4
] | [
168,
27
] | python | en | ['en', 'la', 'en'] | True |
Flexit.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self._current_temperature | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_current_temperature"
] | [
171,
4
] | [
173,
40
] | python | en | ['en', 'la', 'en'] | True |
Flexit.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."""
return self._target_temperature | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_target_temperature"
] | [
176,
4
] | [
178,
39
] | python | en | ['en', 'en', 'en'] | True |
Flexit.hvac_mode | (self) | Return current operation ie. heat, cool, idle. | Return current operation ie. heat, cool, idle. | def hvac_mode(self):
"""Return current operation ie. heat, cool, idle."""
return self._current_operation | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_current_operation"
] | [
181,
4
] | [
183,
38
] | python | en | ['nl', 'en', 'en'] | True |
Flexit.hvac_modes | (self) | Return the list of available hvac operation modes.
Need to be a subset of HVAC_MODES.
| Return the list of available hvac operation modes. | def hvac_modes(self) -> list[str]:
"""Return the list of available hvac operation modes.
Need to be a subset of HVAC_MODES.
"""
return [HVAC_MODE_COOL] | [
"def",
"hvac_modes",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
":",
"return",
"[",
"HVAC_MODE_COOL",
"]"
] | [
186,
4
] | [
191,
31
] | python | en | ['en', 'en', 'en'] | True |
Flexit.fan_mode | (self) | Return the fan setting. | Return the fan setting. | def fan_mode(self):
"""Return the fan setting."""
return self._current_fan_mode | [
"def",
"fan_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_current_fan_mode"
] | [
194,
4
] | [
196,
37
] | python | en | ['en', 'fy', 'en'] | True |
Flexit.fan_modes | (self) | Return the list of available fan modes. | Return the list of available fan modes. | def fan_modes(self):
"""Return the list of available fan modes."""
return self._fan_modes | [
"def",
"fan_modes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_fan_modes"
] | [
199,
4
] | [
201,
30
] | python | en | ['en', 'en', 'en'] | True |
Flexit.async_set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
if kwargs.get(ATTR_TEMPERATURE) is not None:
target_temperature = kwargs.get(ATTR_TEMPERATURE)
else:
_LOGGER.error("Received invalid temperature")
return
if await self.... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"is",
"not",
"None",
":",
"target_temperature",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"els... | [
203,
4
] | [
214,
78
] | python | en | ['en', 'ca', 'en'] | True |
Flexit.async_set_fan_mode | (self, fan_mode) | Set new fan mode. | Set new fan mode. | async def async_set_fan_mode(self, fan_mode):
"""Set new fan mode."""
if await self._async_write_int16_to_register(
17, self.fan_modes.index(fan_mode)
):
self._current_fan_mode = self.fan_modes.index(fan_mode)
else:
_LOGGER.error("Modbus error setting ... | [
"async",
"def",
"async_set_fan_mode",
"(",
"self",
",",
"fan_mode",
")",
":",
"if",
"await",
"self",
".",
"_async_write_int16_to_register",
"(",
"17",
",",
"self",
".",
"fan_modes",
".",
"index",
"(",
"fan_mode",
")",
")",
":",
"self",
".",
"_current_fan_mod... | [
216,
4
] | [
223,
68
] | python | en | ['id', 'fy', 'en'] | False |
Flexit._async_read_int16_from_register | (self, register_type, register) | Read register using the Modbus hub slave. | Read register using the Modbus hub slave. | async def _async_read_int16_from_register(self, register_type, register) -> int:
"""Read register using the Modbus hub slave."""
result = await self._hub.async_pymodbus_call(
self._slave, register, 1, register_type
)
if result is None:
_LOGGER.error("Error reading... | [
"async",
"def",
"_async_read_int16_from_register",
"(",
"self",
",",
"register_type",
",",
"register",
")",
"->",
"int",
":",
"result",
"=",
"await",
"self",
".",
"_hub",
".",
"async_pymodbus_call",
"(",
"self",
".",
"_slave",
",",
"register",
",",
"1",
",",... | [
226,
4
] | [
235,
39
] | python | en | ['en', 'hmn', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up Risco from a config entry. | Set up Risco from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Risco from a config entry."""
data = entry.data
risco = RiscoAPI(data[CONF_USERNAME], data[CONF_PASSWORD], data[CONF_PIN])
try:
await risco.login(async_get_clientsession(hass))
except CannotConnectError a... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"data",
"=",
"entry",
".",
"data",
"risco",
"=",
"RiscoAPI",
"(",
"data",
"[",
"CONF_USERNAME",
"]",
",",
"data",
"[",
"CONF... | [
29,
0
] | [
68,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
hass.data[DOMAIN][entry.entry_id][UNDO_UPDATE_LISTENER]()
hass.data[DOMAIN].pop(entry.entry_id)
... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"unload_ok",
"=",
"await",
"hass",
".",
"config_entries",
".",
"async_unload_platforms",
"(",
"entry",
",",
"PLATFORMS",
")",
"if",
"unload_ok",
... | [
71,
0
] | [
78,
20
] | python | en | ['en', 'es', 'en'] | True |
_update_listener | (hass: HomeAssistant, entry: ConfigEntry) | Handle options update. | Handle options update. | async def _update_listener(hass: HomeAssistant, entry: ConfigEntry):
"""Handle options update."""
await hass.config_entries.async_reload(entry.entry_id) | [
"async",
"def",
"_update_listener",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"await",
"hass",
".",
"config_entries",
".",
"async_reload",
"(",
"entry",
".",
"entry_id",
")"
] | [
81,
0
] | [
83,
58
] | python | en | ['en', 'nl', 'en'] | True |
RiscoDataUpdateCoordinator.__init__ | (self, hass, risco, scan_interval) | Initialize global risco data updater. | Initialize global risco data updater. | def __init__(self, hass, risco, scan_interval):
"""Initialize global risco data updater."""
self.risco = risco
interval = timedelta(seconds=scan_interval)
super().__init__(
hass,
_LOGGER,
name=DOMAIN,
update_interval=interval,
) | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"risco",
",",
"scan_interval",
")",
":",
"self",
".",
"risco",
"=",
"risco",
"interval",
"=",
"timedelta",
"(",
"seconds",
"=",
"scan_interval",
")",
"super",
"(",
")",
".",
"__init__",
"(",
"hass",
","... | [
89,
4
] | [
98,
9
] | python | co | ['it', 'co', 'pt'] | False |
RiscoDataUpdateCoordinator._async_update_data | (self) | Fetch data from risco. | Fetch data from risco. | async def _async_update_data(self):
"""Fetch data from risco."""
try:
return await self.risco.get_state()
except (CannotConnectError, UnauthorizedError, OperationError) as error:
raise UpdateFailed(error) from error | [
"async",
"def",
"_async_update_data",
"(",
"self",
")",
":",
"try",
":",
"return",
"await",
"self",
".",
"risco",
".",
"get_state",
"(",
")",
"except",
"(",
"CannotConnectError",
",",
"UnauthorizedError",
",",
"OperationError",
")",
"as",
"error",
":",
"rais... | [
100,
4
] | [
105,
48
] | python | en | ['en', 'en', 'en'] | True |
RiscoEventsDataUpdateCoordinator.__init__ | (self, hass, risco, eid, scan_interval) | Initialize global risco data updater. | Initialize global risco data updater. | def __init__(self, hass, risco, eid, scan_interval):
"""Initialize global risco data updater."""
self.risco = risco
self._store = Store(
hass, LAST_EVENT_STORAGE_VERSION, f"risco_{eid}_last_event_timestamp"
)
interval = timedelta(seconds=scan_interval)
super()... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"risco",
",",
"eid",
",",
"scan_interval",
")",
":",
"self",
".",
"risco",
"=",
"risco",
"self",
".",
"_store",
"=",
"Store",
"(",
"hass",
",",
"LAST_EVENT_STORAGE_VERSION",
",",
"f\"risco_{eid}_last_event_ti... | [
111,
4
] | [
123,
9
] | python | co | ['it', 'co', 'pt'] | False |
RiscoEventsDataUpdateCoordinator._async_update_data | (self) | Fetch data from risco. | Fetch data from risco. | async def _async_update_data(self):
"""Fetch data from risco."""
last_store = await self._store.async_load() or {}
last_timestamp = last_store.get(
LAST_EVENT_TIMESTAMP_KEY, "2020-01-01T00:00:00Z"
)
try:
events = await self.risco.get_events(last_timestamp,... | [
"async",
"def",
"_async_update_data",
"(",
"self",
")",
":",
"last_store",
"=",
"await",
"self",
".",
"_store",
".",
"async_load",
"(",
")",
"or",
"{",
"}",
"last_timestamp",
"=",
"last_store",
".",
"get",
"(",
"LAST_EVENT_TIMESTAMP_KEY",
",",
"\"2020-01-01T00... | [
125,
4
] | [
139,
21
] | python | en | ['en', 'en', 'en'] | True |
async_get_triggers | (
hass: HomeAssistant, device_id: str
) | List device triggers for Climate devices. | List device triggers for Climate devices. | async def async_get_triggers(
hass: HomeAssistant, device_id: str
) -> list[dict[str, Any]]:
"""List device triggers for Climate devices."""
registry = await entity_registry.async_get_registry(hass)
triggers = []
# Get all the integrations entities for this device
for entry in entity_registry.a... | [
"async",
"def",
"async_get_triggers",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"list",
"[",
"dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"registry",
"=",
"await",
"entity_registry",
".",
"async_get_registry",
"(",
"hass... | [
65,
0
] | [
110,
19
] | python | en | ['fr', 'en', 'en'] | True |
async_attach_trigger | (
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: AutomationTriggerInfo,
) | Attach a trigger. | Attach a trigger. | async def async_attach_trigger(
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: AutomationTriggerInfo,
) -> CALLBACK_TYPE:
"""Attach a trigger."""
trigger_type = config[CONF_TYPE]
if trigger_type == "hvac_mode_changed":
state_config = {
... | [
"async",
"def",
"async_attach_trigger",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"action",
":",
"AutomationActionType",
",",
"automation_info",
":",
"AutomationTriggerInfo",
",",
")",
"->",
"CALLBACK_TYPE",
":",
"trigger_type",
"=",
... | [
113,
0
] | [
164,
5
] | python | en | ['en', 'lb', 'en'] | True |
async_get_trigger_capabilities | (
hass: HomeAssistant, config: ConfigType
) | List trigger capabilities. | List trigger capabilities. | async def async_get_trigger_capabilities(
hass: HomeAssistant, config: ConfigType
) -> dict[str, vol.Schema]:
"""List trigger capabilities."""
trigger_type = config[CONF_TYPE]
if trigger_type == "hvac_action_changed":
return {}
if trigger_type == "hvac_mode_changed":
return {
... | [
"async",
"def",
"async_get_trigger_capabilities",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"dict",
"[",
"str",
",",
"vol",
".",
"Schema",
"]",
":",
"trigger_type",
"=",
"config",
"[",
"CONF_TYPE",
"]",
"if",
"trigger_ty... | [
167,
0
] | [
200,
5
] | python | en | ['en', 'la', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.