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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Dyson fan components. | Set up the Dyson fan components. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Dyson fan components."""
if discovery_info is None:
return
_LOGGER.debug("Creating new Dyson fans")
if DYSON_FAN_DEVICES not in hass.data:
hass.data[DYSON_FAN_DEVICES] = []
# Get Dyson Devices from ... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"_LOGGER",
".",
"debug",
"(",
"\"Creating new Dyson fans\"",
")",
"if",
"DYSON_FAN_DEVICE... | [
90,
0
] | [
178,
9
] | python | en | ['en', 'fr', 'en'] | True |
DysonPureCoolLinkDevice.__init__ | (self, hass, device) | Initialize the fan. | Initialize the fan. | def __init__(self, hass, device):
"""Initialize the fan."""
_LOGGER.debug("Creating device %s", device.name)
self.hass = hass
self._device = device | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"device",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Creating device %s\"",
",",
"device",
".",
"name",
")",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"_device",
"=",
"device"
] | [
184,
4
] | [
188,
29
] | python | en | ['en', 'fy', 'en'] | True |
DysonPureCoolLinkDevice.async_added_to_hass | (self) | Call when entity is added to hass. | Call when entity is added to hass. | async def async_added_to_hass(self):
"""Call when entity is added to hass."""
self._device.add_message_listener(self.on_message) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"_device",
".",
"add_message_listener",
"(",
"self",
".",
"on_message",
")"
] | [
190,
4
] | [
192,
58
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolLinkDevice.on_message | (self, message) | Call when new messages received from the fan. | Call when new messages received from the fan. | def on_message(self, message):
"""Call when new messages received from the fan."""
if isinstance(message, DysonPureCoolState):
_LOGGER.debug("Message received for fan device %s: %s", self.name, message)
self.schedule_update_ha_state() | [
"def",
"on_message",
"(",
"self",
",",
"message",
")",
":",
"if",
"isinstance",
"(",
"message",
",",
"DysonPureCoolState",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Message received for fan device %s: %s\"",
",",
"self",
".",
"name",
",",
"message",
")",
"sel... | [
194,
4
] | [
199,
43
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolLinkDevice.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self):
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
202,
4
] | [
204,
20
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolLinkDevice.name | (self) | Return the display name of this fan. | Return the display name of this fan. | def name(self):
"""Return the display name of this fan."""
return self._device.name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"name"
] | [
207,
4
] | [
209,
32
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolLinkDevice.set_speed | (self, speed: str) | Set the speed of the fan. Never called ??. | Set the speed of the fan. Never called ??. | def set_speed(self, speed: str) -> None:
"""Set the speed of the fan. Never called ??."""
_LOGGER.debug("Set fan speed to: %s", speed)
if speed == FanSpeed.FAN_SPEED_AUTO.value:
self._device.set_configuration(fan_mode=FanMode.AUTO)
else:
fan_speed = FanSpeed(f"{i... | [
"def",
"set_speed",
"(",
"self",
",",
"speed",
":",
"str",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Set fan speed to: %s\"",
",",
"speed",
")",
"if",
"speed",
"==",
"FanSpeed",
".",
"FAN_SPEED_AUTO",
".",
"value",
":",
"self",
".",
"_devi... | [
211,
4
] | [
219,
85
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolLinkDevice.turn_on | (self, speed: str = None, **kwargs) | Turn on the fan. | Turn on the fan. | def turn_on(self, speed: str = None, **kwargs) -> None:
"""Turn on the fan."""
_LOGGER.debug("Turn on fan %s with speed %s", self.name, speed)
if speed:
if speed == FanSpeed.FAN_SPEED_AUTO.value:
self._device.set_configuration(fan_mode=FanMode.AUTO)
else:
... | [
"def",
"turn_on",
"(",
"self",
",",
"speed",
":",
"str",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turn on fan %s with speed %s\"",
",",
"self",
".",
"name",
",",
"speed",
")",
"if",
"speed",
":",
... | [
221,
4
] | [
234,
64
] | python | en | ['en', 'fy', 'en'] | True |
DysonPureCoolLinkDevice.turn_off | (self, **kwargs) | Turn off the fan. | Turn off the fan. | def turn_off(self, **kwargs) -> None:
"""Turn off the fan."""
_LOGGER.debug("Turn off fan %s", self.name)
self._device.set_configuration(fan_mode=FanMode.OFF) | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turn off fan %s\"",
",",
"self",
".",
"name",
")",
"self",
".",
"_device",
".",
"set_configuration",
"(",
"fan_mode",
"=",
"FanMode",
".",
... | [
236,
4
] | [
239,
60
] | python | en | ['en', 'fy', 'en'] | True |
DysonPureCoolLinkDevice.oscillate | (self, oscillating: bool) | Turn on/off oscillating. | Turn on/off oscillating. | def oscillate(self, oscillating: bool) -> None:
"""Turn on/off oscillating."""
_LOGGER.debug("Turn oscillation %s for device %s", oscillating, self.name)
if oscillating:
self._device.set_configuration(oscillation=Oscillation.OSCILLATION_ON)
else:
self._device.set... | [
"def",
"oscillate",
"(",
"self",
",",
"oscillating",
":",
"bool",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turn oscillation %s for device %s\"",
",",
"oscillating",
",",
"self",
".",
"name",
")",
"if",
"oscillating",
":",
"self",
".",
"_devic... | [
241,
4
] | [
248,
83
] | python | en | ['it', 'ja', 'en'] | False |
DysonPureCoolLinkDevice.oscillating | (self) | Return the oscillation state. | Return the oscillation state. | def oscillating(self):
"""Return the oscillation state."""
return self._device.state and self._device.state.oscillation == "ON" | [
"def",
"oscillating",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"state",
"and",
"self",
".",
"_device",
".",
"state",
".",
"oscillation",
"==",
"\"ON\""
] | [
251,
4
] | [
253,
76
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolLinkDevice.is_on | (self) | Return true if the entity is on. | Return true if the entity is on. | def is_on(self):
"""Return true if the entity is on."""
if self._device.state:
return self._device.state.fan_mode == "FAN"
return False | [
"def",
"is_on",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device",
".",
"state",
":",
"return",
"self",
".",
"_device",
".",
"state",
".",
"fan_mode",
"==",
"\"FAN\"",
"return",
"False"
] | [
256,
4
] | [
260,
20
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolLinkDevice.speed | (self) | Return the current speed. | Return the current speed. | def speed(self) -> str:
"""Return the current speed."""
if self._device.state:
if self._device.state.speed == FanSpeed.FAN_SPEED_AUTO.value:
return self._device.state.speed
return int(self._device.state.speed)
return None | [
"def",
"speed",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"_device",
".",
"state",
":",
"if",
"self",
".",
"_device",
".",
"state",
".",
"speed",
"==",
"FanSpeed",
".",
"FAN_SPEED_AUTO",
".",
"value",
":",
"return",
"self",
".",
"_device... | [
263,
4
] | [
269,
19
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolLinkDevice.current_direction | (self) | Return direction of the fan [forward, reverse]. | Return direction of the fan [forward, reverse]. | def current_direction(self):
"""Return direction of the fan [forward, reverse]."""
return None | [
"def",
"current_direction",
"(",
"self",
")",
":",
"return",
"None"
] | [
272,
4
] | [
274,
19
] | python | en | ['en', 'fy', 'en'] | True |
DysonPureCoolLinkDevice.night_mode | (self) | Return Night mode. | Return Night mode. | def night_mode(self):
"""Return Night mode."""
return self._device.state.night_mode == "ON" | [
"def",
"night_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"state",
".",
"night_mode",
"==",
"\"ON\""
] | [
277,
4
] | [
279,
52
] | python | en | ['en', 'sn', 'en'] | True |
DysonPureCoolLinkDevice.set_night_mode | (self, night_mode: bool) | Turn fan in night mode. | Turn fan in night mode. | def set_night_mode(self, night_mode: bool) -> None:
"""Turn fan in night mode."""
_LOGGER.debug("Set %s night mode %s", self.name, night_mode)
if night_mode:
self._device.set_configuration(night_mode=NightMode.NIGHT_MODE_ON)
else:
self._device.set_configuration(ni... | [
"def",
"set_night_mode",
"(",
"self",
",",
"night_mode",
":",
"bool",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Set %s night mode %s\"",
",",
"self",
".",
"name",
",",
"night_mode",
")",
"if",
"night_mode",
":",
"self",
".",
"_device",
".",
... | [
281,
4
] | [
287,
79
] | python | en | ['en', 'fy', 'en'] | True |
DysonPureCoolLinkDevice.auto_mode | (self) | Return auto mode. | Return auto mode. | def auto_mode(self):
"""Return auto mode."""
return self._device.state.fan_mode == "AUTO" | [
"def",
"auto_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"state",
".",
"fan_mode",
"==",
"\"AUTO\""
] | [
290,
4
] | [
292,
52
] | python | bs | ['de', 'bs', 'en'] | False |
DysonPureCoolLinkDevice.set_auto_mode | (self, auto_mode: bool) | Turn fan in auto mode. | Turn fan in auto mode. | def set_auto_mode(self, auto_mode: bool) -> None:
"""Turn fan in auto mode."""
_LOGGER.debug("Set %s auto mode %s", self.name, auto_mode)
if auto_mode:
self._device.set_configuration(fan_mode=FanMode.AUTO)
else:
self._device.set_configuration(fan_mode=FanMode.FAN) | [
"def",
"set_auto_mode",
"(",
"self",
",",
"auto_mode",
":",
"bool",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Set %s auto mode %s\"",
",",
"self",
".",
"name",
",",
"auto_mode",
")",
"if",
"auto_mode",
":",
"self",
".",
"_device",
".",
"se... | [
294,
4
] | [
300,
64
] | python | en | ['en', 'fy', 'nl'] | False |
DysonPureCoolLinkDevice.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."""
supported_speeds = [
FanSpeed.FAN_SPEED_AUTO.value,
int(FanSpeed.FAN_SPEED_1.value),
int(FanSpeed.FAN_SPEED_2.value),
int(FanSpeed.FAN_SPEED_3.value),
int(FanSpeed.FAN_SPEED_... | [
"def",
"speed_list",
"(",
"self",
")",
"->",
"list",
":",
"supported_speeds",
"=",
"[",
"FanSpeed",
".",
"FAN_SPEED_AUTO",
".",
"value",
",",
"int",
"(",
"FanSpeed",
".",
"FAN_SPEED_1",
".",
"value",
")",
",",
"int",
"(",
"FanSpeed",
".",
"FAN_SPEED_2",
... | [
303,
4
] | [
319,
31
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolLinkDevice.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self) -> int:
"""Flag supported features."""
return SUPPORT_OSCILLATE | SUPPORT_SET_SPEED | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"SUPPORT_OSCILLATE",
"|",
"SUPPORT_SET_SPEED"
] | [
322,
4
] | [
324,
52
] | python | en | ['da', 'en', 'en'] | True |
DysonPureCoolLinkDevice.device_state_attributes | (self) | Return optional state attributes. | Return optional state attributes. | def device_state_attributes(self) -> dict:
"""Return optional state attributes."""
return {ATTR_NIGHT_MODE: self.night_mode, ATTR_AUTO_MODE: self.auto_mode} | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"{",
"ATTR_NIGHT_MODE",
":",
"self",
".",
"night_mode",
",",
"ATTR_AUTO_MODE",
":",
"self",
".",
"auto_mode",
"}"
] | [
327,
4
] | [
329,
81
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.__init__ | (self, device) | Initialize the fan. | Initialize the fan. | def __init__(self, device):
"""Initialize the fan."""
self._device = device | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"self",
".",
"_device",
"=",
"device"
] | [
335,
4
] | [
337,
29
] | python | en | ['en', 'fy', 'en'] | True |
DysonPureCoolDevice.async_added_to_hass | (self) | Call when entity is added to hass. | Call when entity is added to hass. | async def async_added_to_hass(self):
"""Call when entity is added to hass."""
self._device.add_message_listener(self.on_message) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"_device",
".",
"add_message_listener",
"(",
"self",
".",
"on_message",
")"
] | [
339,
4
] | [
341,
58
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.on_message | (self, message) | Call when new messages received from the fan. | Call when new messages received from the fan. | def on_message(self, message):
"""Call when new messages received from the fan."""
if isinstance(message, DysonPureCoolV2State):
_LOGGER.debug("Message received for fan device %s: %s", self.name, message)
self.schedule_update_ha_state() | [
"def",
"on_message",
"(",
"self",
",",
"message",
")",
":",
"if",
"isinstance",
"(",
"message",
",",
"DysonPureCoolV2State",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Message received for fan device %s: %s\"",
",",
"self",
".",
"name",
",",
"message",
")",
"s... | [
343,
4
] | [
347,
43
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self):
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
350,
4
] | [
352,
20
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.name | (self) | Return the display name of this fan. | Return the display name of this fan. | def name(self):
"""Return the display name of this fan."""
return self._device.name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"name"
] | [
355,
4
] | [
357,
32
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.turn_on | (self, speed: str = None, **kwargs) | Turn on the fan. | Turn on the fan. | def turn_on(self, speed: str = None, **kwargs) -> None:
"""Turn on the fan."""
_LOGGER.debug("Turn on fan %s", self.name)
if speed is not None:
self.set_speed(speed)
else:
self._device.turn_on() | [
"def",
"turn_on",
"(",
"self",
",",
"speed",
":",
"str",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turn on fan %s\"",
",",
"self",
".",
"name",
")",
"if",
"speed",
"is",
"not",
"None",
":",
"self... | [
359,
4
] | [
366,
34
] | python | en | ['en', 'fy', 'en'] | True |
DysonPureCoolDevice.set_speed | (self, speed: str) | Set the speed of the fan. | Set the speed of the fan. | def set_speed(self, speed: str) -> None:
"""Set the speed of the fan."""
if speed == SPEED_LOW:
self._device.set_fan_speed(FanSpeed.FAN_SPEED_4)
elif speed == SPEED_MEDIUM:
self._device.set_fan_speed(FanSpeed.FAN_SPEED_7)
elif speed == SPEED_HIGH:
self... | [
"def",
"set_speed",
"(",
"self",
",",
"speed",
":",
"str",
")",
"->",
"None",
":",
"if",
"speed",
"==",
"SPEED_LOW",
":",
"self",
".",
"_device",
".",
"set_fan_speed",
"(",
"FanSpeed",
".",
"FAN_SPEED_4",
")",
"elif",
"speed",
"==",
"SPEED_MEDIUM",
":",
... | [
368,
4
] | [
375,
61
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.turn_off | (self, **kwargs) | Turn off the fan. | Turn off the fan. | def turn_off(self, **kwargs):
"""Turn off the fan."""
_LOGGER.debug("Turn off fan %s", self.name)
self._device.turn_off() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turn off fan %s\"",
",",
"self",
".",
"name",
")",
"self",
".",
"_device",
".",
"turn_off",
"(",
")"
] | [
377,
4
] | [
380,
31
] | python | en | ['en', 'fy', 'en'] | True |
DysonPureCoolDevice.set_dyson_speed | (self, speed: str = None) | Set the exact speed of the purecool fan. | Set the exact speed of the purecool fan. | def set_dyson_speed(self, speed: str = None) -> None:
"""Set the exact speed of the purecool fan."""
_LOGGER.debug("Set exact speed for fan %s", self.name)
fan_speed = FanSpeed(f"{int(speed):04d}")
self._device.set_fan_speed(fan_speed) | [
"def",
"set_dyson_speed",
"(",
"self",
",",
"speed",
":",
"str",
"=",
"None",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Set exact speed for fan %s\"",
",",
"self",
".",
"name",
")",
"fan_speed",
"=",
"FanSpeed",
"(",
"f\"{int(speed):04d}\"",
"... | [
382,
4
] | [
387,
45
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.oscillate | (self, oscillating: bool) | Turn on/off oscillating. | Turn on/off oscillating. | def oscillate(self, oscillating: bool) -> None:
"""Turn on/off oscillating."""
_LOGGER.debug("Turn oscillation %s for device %s", oscillating, self.name)
if oscillating:
self._device.enable_oscillation()
else:
self._device.disable_oscillation() | [
"def",
"oscillate",
"(",
"self",
",",
"oscillating",
":",
"bool",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turn oscillation %s for device %s\"",
",",
"oscillating",
",",
"self",
".",
"name",
")",
"if",
"oscillating",
":",
"self",
".",
"_devic... | [
389,
4
] | [
396,
46
] | python | en | ['it', 'ja', 'en'] | False |
DysonPureCoolDevice.set_night_mode | (self, night_mode: bool) | Turn on/off night mode. | Turn on/off night mode. | def set_night_mode(self, night_mode: bool) -> None:
"""Turn on/off night mode."""
_LOGGER.debug("Turn night mode %s for device %s", night_mode, self.name)
if night_mode:
self._device.enable_night_mode()
else:
self._device.disable_night_mode() | [
"def",
"set_night_mode",
"(",
"self",
",",
"night_mode",
":",
"bool",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turn night mode %s for device %s\"",
",",
"night_mode",
",",
"self",
".",
"name",
")",
"if",
"night_mode",
":",
"self",
".",
"_devi... | [
398,
4
] | [
405,
45
] | python | en | ['en', 'yo', 'en'] | True |
DysonPureCoolDevice.set_auto_mode | (self, auto_mode: bool) | Turn auto mode on/off. | Turn auto mode on/off. | def set_auto_mode(self, auto_mode: bool) -> None:
"""Turn auto mode on/off."""
_LOGGER.debug("Turn auto mode %s for device %s", auto_mode, self.name)
if auto_mode:
self._device.enable_auto_mode()
else:
self._device.disable_auto_mode() | [
"def",
"set_auto_mode",
"(",
"self",
",",
"auto_mode",
":",
"bool",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turn auto mode %s for device %s\"",
",",
"auto_mode",
",",
"self",
".",
"name",
")",
"if",
"auto_mode",
":",
"self",
".",
"_device",
... | [
407,
4
] | [
413,
44
] | python | de | ['de', 'fi', 'en'] | False |
DysonPureCoolDevice.set_angle | (self, angle_low: int, angle_high: int) | Set device angle. | Set device angle. | def set_angle(self, angle_low: int, angle_high: int) -> None:
"""Set device angle."""
_LOGGER.debug(
"set low %s and high angle %s for device %s",
angle_low,
angle_high,
self.name,
)
self._device.enable_oscillation(angle_low, angle_high) | [
"def",
"set_angle",
"(",
"self",
",",
"angle_low",
":",
"int",
",",
"angle_high",
":",
"int",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"set low %s and high angle %s for device %s\"",
",",
"angle_low",
",",
"angle_high",
",",
"self",
".",
"name",... | [
415,
4
] | [
423,
62
] | python | en | ['fr', 'haw', 'en'] | False |
DysonPureCoolDevice.set_flow_direction_front | (self, flow_direction_front: bool) | Set frontal airflow direction. | Set frontal airflow direction. | def set_flow_direction_front(self, flow_direction_front: bool) -> None:
"""Set frontal airflow direction."""
_LOGGER.debug(
"Set frontal flow direction to %s for device %s",
flow_direction_front,
self.name,
)
if flow_direction_front:
self.... | [
"def",
"set_flow_direction_front",
"(",
"self",
",",
"flow_direction_front",
":",
"bool",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Set frontal flow direction to %s for device %s\"",
",",
"flow_direction_front",
",",
"self",
".",
"name",
",",
")",
"if... | [
425,
4
] | [
436,
52
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.oscillating | (self) | Return the oscillation state. | Return the oscillation state. | def oscillating(self):
"""Return the oscillation state."""
return self._device.state and self._device.state.oscillation == "OION" | [
"def",
"oscillating",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"state",
"and",
"self",
".",
"_device",
".",
"state",
".",
"oscillation",
"==",
"\"OION\""
] | [
448,
4
] | [
450,
78
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.is_on | (self) | Return true if the entity is on. | Return true if the entity is on. | def is_on(self):
"""Return true if the entity is on."""
if self._device.state:
return self._device.state.fan_power == "ON" | [
"def",
"is_on",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device",
".",
"state",
":",
"return",
"self",
".",
"_device",
".",
"state",
".",
"fan_power",
"==",
"\"ON\""
] | [
453,
4
] | [
456,
55
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.speed | (self) | Return the current speed. | Return the current speed. | def speed(self):
"""Return the current speed."""
speed_map = {
FanSpeed.FAN_SPEED_1.value: SPEED_LOW,
FanSpeed.FAN_SPEED_2.value: SPEED_LOW,
FanSpeed.FAN_SPEED_3.value: SPEED_LOW,
FanSpeed.FAN_SPEED_4.value: SPEED_LOW,
FanSpeed.FAN_SPEED_AUTO.v... | [
"def",
"speed",
"(",
"self",
")",
":",
"speed_map",
"=",
"{",
"FanSpeed",
".",
"FAN_SPEED_1",
".",
"value",
":",
"SPEED_LOW",
",",
"FanSpeed",
".",
"FAN_SPEED_2",
".",
"value",
":",
"SPEED_LOW",
",",
"FanSpeed",
".",
"FAN_SPEED_3",
".",
"value",
":",
"SP... | [
459,
4
] | [
475,
50
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.dyson_speed | (self) | Return the current speed. | Return the current speed. | def dyson_speed(self):
"""Return the current speed."""
if self._device.state:
if self._device.state.speed == FanSpeed.FAN_SPEED_AUTO.value:
return self._device.state.speed
return int(self._device.state.speed) | [
"def",
"dyson_speed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device",
".",
"state",
":",
"if",
"self",
".",
"_device",
".",
"state",
".",
"speed",
"==",
"FanSpeed",
".",
"FAN_SPEED_AUTO",
".",
"value",
":",
"return",
"self",
".",
"_device",
".",
... | [
478,
4
] | [
483,
48
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.night_mode | (self) | Return Night mode. | Return Night mode. | def night_mode(self):
"""Return Night mode."""
return self._device.state.night_mode == "ON" | [
"def",
"night_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"state",
".",
"night_mode",
"==",
"\"ON\""
] | [
486,
4
] | [
488,
52
] | python | en | ['en', 'sn', 'en'] | True |
DysonPureCoolDevice.auto_mode | (self) | Return Auto mode. | Return Auto mode. | def auto_mode(self):
"""Return Auto mode."""
return self._device.state.auto_mode == "ON" | [
"def",
"auto_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"state",
".",
"auto_mode",
"==",
"\"ON\""
] | [
491,
4
] | [
493,
51
] | python | en | ['en', 'bs', 'en'] | True |
DysonPureCoolDevice.angle_low | (self) | Return angle high. | Return angle high. | def angle_low(self):
"""Return angle high."""
return int(self._device.state.oscillation_angle_low) | [
"def",
"angle_low",
"(",
"self",
")",
":",
"return",
"int",
"(",
"self",
".",
"_device",
".",
"state",
".",
"oscillation_angle_low",
")"
] | [
496,
4
] | [
498,
60
] | python | ceb | ['tl', 'ceb', 'en'] | False |
DysonPureCoolDevice.angle_high | (self) | Return angle low. | Return angle low. | def angle_high(self):
"""Return angle low."""
return int(self._device.state.oscillation_angle_high) | [
"def",
"angle_high",
"(",
"self",
")",
":",
"return",
"int",
"(",
"self",
".",
"_device",
".",
"state",
".",
"oscillation_angle_high",
")"
] | [
501,
4
] | [
503,
61
] | python | en | ['en', 'tg', 'en'] | True |
DysonPureCoolDevice.flow_direction_front | (self) | Return frontal flow direction. | Return frontal flow direction. | def flow_direction_front(self):
"""Return frontal flow direction."""
return self._device.state.front_direction == "ON" | [
"def",
"flow_direction_front",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"state",
".",
"front_direction",
"==",
"\"ON\""
] | [
506,
4
] | [
508,
57
] | python | en | ['en', 'da', 'en'] | True |
DysonPureCoolDevice.timer | (self) | Return timer. | Return timer. | def timer(self):
"""Return timer."""
return self._device.state.sleep_timer | [
"def",
"timer",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"state",
".",
"sleep_timer"
] | [
511,
4
] | [
513,
45
] | python | en | ['en', 'no', 'en'] | False |
DysonPureCoolDevice.hepa_filter | (self) | Return the HEPA filter state. | Return the HEPA filter state. | def hepa_filter(self):
"""Return the HEPA filter state."""
return int(self._device.state.hepa_filter_state) | [
"def",
"hepa_filter",
"(",
"self",
")",
":",
"return",
"int",
"(",
"self",
".",
"_device",
".",
"state",
".",
"hepa_filter_state",
")"
] | [
516,
4
] | [
518,
56
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.carbon_filter | (self) | Return the carbon filter state. | Return the carbon filter state. | def carbon_filter(self):
"""Return the carbon filter state."""
if self._device.state.carbon_filter_state == "INV":
return self._device.state.carbon_filter_state
return int(self._device.state.carbon_filter_state) | [
"def",
"carbon_filter",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device",
".",
"state",
".",
"carbon_filter_state",
"==",
"\"INV\"",
":",
"return",
"self",
".",
"_device",
".",
"state",
".",
"carbon_filter_state",
"return",
"int",
"(",
"self",
".",
"_de... | [
521,
4
] | [
525,
58
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.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 [SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH] | [
"def",
"speed_list",
"(",
"self",
")",
"->",
"list",
":",
"return",
"[",
"SPEED_LOW",
",",
"SPEED_MEDIUM",
",",
"SPEED_HIGH",
"]"
] | [
528,
4
] | [
530,
52
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.dyson_speed_list | (self) | Get the list of available dyson speeds. | Get the list of available dyson speeds. | def dyson_speed_list(self) -> list:
"""Get the list of available dyson speeds."""
return [
int(FanSpeed.FAN_SPEED_1.value),
int(FanSpeed.FAN_SPEED_2.value),
int(FanSpeed.FAN_SPEED_3.value),
int(FanSpeed.FAN_SPEED_4.value),
int(FanSpeed.FAN_SPEE... | [
"def",
"dyson_speed_list",
"(",
"self",
")",
"->",
"list",
":",
"return",
"[",
"int",
"(",
"FanSpeed",
".",
"FAN_SPEED_1",
".",
"value",
")",
",",
"int",
"(",
"FanSpeed",
".",
"FAN_SPEED_2",
".",
"value",
")",
",",
"int",
"(",
"FanSpeed",
".",
"FAN_SPE... | [
533,
4
] | [
546,
9
] | python | en | ['en', 'en', 'en'] | True |
DysonPureCoolDevice.device_serial | (self) | Return fan's serial number. | Return fan's serial number. | def device_serial(self):
"""Return fan's serial number."""
return self._device.serial | [
"def",
"device_serial",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"serial"
] | [
549,
4
] | [
551,
34
] | python | en | ['en', 'af', 'en'] | True |
DysonPureCoolDevice.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self) -> int:
"""Flag supported features."""
return SUPPORT_OSCILLATE | SUPPORT_SET_SPEED | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"SUPPORT_OSCILLATE",
"|",
"SUPPORT_SET_SPEED"
] | [
554,
4
] | [
556,
52
] | python | en | ['da', 'en', 'en'] | True |
DysonPureCoolDevice.device_state_attributes | (self) | Return optional state attributes. | Return optional state attributes. | def device_state_attributes(self) -> dict:
"""Return optional state attributes."""
return {
ATTR_NIGHT_MODE: self.night_mode,
ATTR_AUTO_MODE: self.auto_mode,
ATTR_ANGLE_LOW: self.angle_low,
ATTR_ANGLE_HIGH: self.angle_high,
ATTR_FLOW_DIRECTION_... | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"{",
"ATTR_NIGHT_MODE",
":",
"self",
".",
"night_mode",
",",
"ATTR_AUTO_MODE",
":",
"self",
".",
"auto_mode",
",",
"ATTR_ANGLE_LOW",
":",
"self",
".",
"angle_low",
",",
"ATTR_ANGL... | [
559,
4
] | [
572,
9
] | python | en | ['en', 'en', 'en'] | True |
get_scanner | (hass, config) | Validate the configuration and return FritzBoxScanner. | Validate the configuration and return FritzBoxScanner. | def get_scanner(hass, config):
"""Validate the configuration and return FritzBoxScanner."""
scanner = FritzBoxScanner(config[DOMAIN])
return scanner if scanner.success_init else None | [
"def",
"get_scanner",
"(",
"hass",
",",
"config",
")",
":",
"scanner",
"=",
"FritzBoxScanner",
"(",
"config",
"[",
"DOMAIN",
"]",
")",
"return",
"scanner",
"if",
"scanner",
".",
"success_init",
"else",
"None"
] | [
29,
0
] | [
32,
52
] | python | en | ['en', 'en', 'en'] | True |
FritzBoxScanner.__init__ | (self, config) | Initialize the scanner. | Initialize the scanner. | def __init__(self, config):
"""Initialize the scanner."""
self.last_results = []
self.host = config[CONF_HOST]
self.username = config[CONF_USERNAME]
self.password = config.get(CONF_PASSWORD)
self.success_init = True
# Establish a connection to the FRITZ!Box.
... | [
"def",
"__init__",
"(",
"self",
",",
"config",
")",
":",
"self",
".",
"last_results",
"=",
"[",
"]",
"self",
".",
"host",
"=",
"config",
"[",
"CONF_HOST",
"]",
"self",
".",
"username",
"=",
"config",
"[",
"CONF_USERNAME",
"]",
"self",
".",
"password",
... | [
38,
4
] | [
65,
13
] | python | en | ['en', 'en', 'en'] | True |
FritzBoxScanner.scan_devices | (self) | Scan for new devices and return a list of found device ids. | Scan for new devices and return a list of found device ids. | def scan_devices(self):
"""Scan for new devices and return a list of found device ids."""
self._update_info()
active_hosts = []
for known_host in self.last_results:
if known_host["status"] and known_host.get("mac"):
active_hosts.append(known_host["mac"])
... | [
"def",
"scan_devices",
"(",
"self",
")",
":",
"self",
".",
"_update_info",
"(",
")",
"active_hosts",
"=",
"[",
"]",
"for",
"known_host",
"in",
"self",
".",
"last_results",
":",
"if",
"known_host",
"[",
"\"status\"",
"]",
"and",
"known_host",
".",
"get",
... | [
67,
4
] | [
74,
27
] | python | en | ['en', 'en', 'en'] | True |
FritzBoxScanner.get_device_name | (self, device) | Return the name of the given device or None if is not known. | Return the name of the given device or None if is not known. | def get_device_name(self, device):
"""Return the name of the given device or None if is not known."""
ret = self.fritz_box.get_specific_host_entry(device).get("NewHostName")
if ret == {}:
return None
return ret | [
"def",
"get_device_name",
"(",
"self",
",",
"device",
")",
":",
"ret",
"=",
"self",
".",
"fritz_box",
".",
"get_specific_host_entry",
"(",
"device",
")",
".",
"get",
"(",
"\"NewHostName\"",
")",
"if",
"ret",
"==",
"{",
"}",
":",
"return",
"None",
"return... | [
76,
4
] | [
81,
18
] | python | en | ['en', 'en', 'en'] | True |
FritzBoxScanner.get_extra_attributes | (self, device) | Return the attributes (ip, mac) of the given device or None if is not known. | Return the attributes (ip, mac) of the given device or None if is not known. | def get_extra_attributes(self, device):
"""Return the attributes (ip, mac) of the given device or None if is not known."""
ip_device = None
try:
ip_device = self.fritz_box.get_specific_host_entry(device).get(
"NewIPAddress"
)
except fritzexceptions... | [
"def",
"get_extra_attributes",
"(",
"self",
",",
"device",
")",
":",
"ip_device",
"=",
"None",
"try",
":",
"ip_device",
"=",
"self",
".",
"fritz_box",
".",
"get_specific_host_entry",
"(",
"device",
")",
".",
"get",
"(",
"\"NewIPAddress\"",
")",
"except",
"fr... | [
83,
4
] | [
97,
47
] | python | en | ['en', 'en', 'en'] | True |
FritzBoxScanner._update_info | (self) | Retrieve latest information from the FRITZ!Box. | Retrieve latest information from the FRITZ!Box. | def _update_info(self):
"""Retrieve latest information from the FRITZ!Box."""
if not self.success_init:
return False
_LOGGER.debug("Scanning")
self.last_results = self.fritz_box.get_hosts_info()
return True | [
"def",
"_update_info",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"success_init",
":",
"return",
"False",
"_LOGGER",
".",
"debug",
"(",
"\"Scanning\"",
")",
"self",
".",
"last_results",
"=",
"self",
".",
"fritz_box",
".",
"get_hosts_info",
"(",
")",
... | [
99,
4
] | [
106,
19
] | python | en | ['en', 'en', 'en'] | True |
test_delete_script | (hass, hass_client) | Test deleting a script. | Test deleting a script. | async def test_delete_script(hass, hass_client):
"""Test deleting a script."""
with patch.object(config, "SECTIONS", ["script"]):
await async_setup_component(hass, "config", {})
client = await hass_client()
orig_data = {"one": {}, "two": {}}
def mock_read(path):
"""Mock reading da... | [
"async",
"def",
"test_delete_script",
"(",
"hass",
",",
"hass_client",
")",
":",
"with",
"patch",
".",
"object",
"(",
"config",
",",
"\"SECTIONS\"",
",",
"[",
"\"script\"",
"]",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"config\"",
",",... | [
7,
0
] | [
36,
36
] | python | ca | ['ca', 'en', 'pt'] | False |
async_setup | (hass, config) | Set up the Kodi integration. | Set up the Kodi integration. | async def async_setup(hass, config):
"""Set up the Kodi integration."""
hass.data.setdefault(DOMAIN, {})
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"return",
"True"
] | [
31,
0
] | [
34,
15
] | python | en | ['en', 'cs', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up Kodi from a config entry. | Set up Kodi from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Kodi from a config entry."""
conn = get_kodi_connection(
entry.data[CONF_HOST],
entry.data[CONF_PORT],
entry.data[CONF_WS_PORT],
entry.data[CONF_USERNAME],
entry.data[CONF_PASSWORD],
e... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"conn",
"=",
"get_kodi_connection",
"(",
"entry",
".",
"data",
"[",
"CONF_HOST",
"]",
",",
"entry",
".",
"data",
"[",
"CONF_PORT",
"]",
",",... | [
37,
0
] | [
79,
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 = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
]
)
... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"unload_ok",
"=",
"all",
"(",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload... | [
82,
0
] | [
97,
20
] | python | en | ['en', 'es', 'en'] | True |
AlexaDirective.__init__ | (self, request) | Initialize a directive. | Initialize a directive. | def __init__(self, request):
"""Initialize a directive."""
self._directive = request[API_DIRECTIVE]
self.namespace = self._directive[API_HEADER]["namespace"]
self.name = self._directive[API_HEADER]["name"]
self.payload = self._directive[API_PAYLOAD]
self.has_endpoint = AP... | [
"def",
"__init__",
"(",
"self",
",",
"request",
")",
":",
"self",
".",
"_directive",
"=",
"request",
"[",
"API_DIRECTIVE",
"]",
"self",
".",
"namespace",
"=",
"self",
".",
"_directive",
"[",
"API_HEADER",
"]",
"[",
"\"namespace\"",
"]",
"self",
".",
"nam... | [
22,
4
] | [
30,
75
] | python | it | ['it', 'en', 'it'] | True |
AlexaDirective.load_entity | (self, hass, config) | Set attributes related to the entity for this request.
Sets these attributes when self.has_endpoint is True:
- entity
- entity_id
- endpoint
- instance (when header includes instance property)
Behavior when self.has_endpoint is False is undefined.
Will raise A... | Set attributes related to the entity for this request. | def load_entity(self, hass, config):
"""Set attributes related to the entity for this request.
Sets these attributes when self.has_endpoint is True:
- entity
- entity_id
- endpoint
- instance (when header includes instance property)
Behavior when self.has_endpo... | [
"def",
"load_entity",
"(",
"self",
",",
"hass",
",",
"config",
")",
":",
"_endpoint_id",
"=",
"self",
".",
"_directive",
"[",
"API_ENDPOINT",
"]",
"[",
"\"endpointId\"",
"]",
"self",
".",
"entity_id",
"=",
"_endpoint_id",
".",
"replace",
"(",
"\"#\"",
",",... | [
32,
4
] | [
56,
67
] | python | en | ['en', 'en', 'en'] | True |
AlexaDirective.response | (self, name="Response", namespace="Alexa", payload=None) | Create an API formatted response.
Async friendly.
| Create an API formatted response. | def response(self, name="Response", namespace="Alexa", payload=None):
"""Create an API formatted response.
Async friendly.
"""
response = AlexaResponse(name, namespace, payload)
token = self._directive[API_HEADER].get("correlationToken")
if token:
response.s... | [
"def",
"response",
"(",
"self",
",",
"name",
"=",
"\"Response\"",
",",
"namespace",
"=",
"\"Alexa\"",
",",
"payload",
"=",
"None",
")",
":",
"response",
"=",
"AlexaResponse",
"(",
"name",
",",
"namespace",
",",
"payload",
")",
"token",
"=",
"self",
".",
... | [
58,
4
] | [
72,
23
] | python | en | ['en', 'en', 'en'] | True |
AlexaDirective.error | (
self,
namespace="Alexa",
error_type="INTERNAL_ERROR",
error_message="",
payload=None,
) | Create a API formatted error response.
Async friendly.
| Create a API formatted error response. | def error(
self,
namespace="Alexa",
error_type="INTERNAL_ERROR",
error_message="",
payload=None,
):
"""Create a API formatted error response.
Async friendly.
"""
payload = payload or {}
payload["type"] = error_type
payload["mes... | [
"def",
"error",
"(",
"self",
",",
"namespace",
"=",
"\"Alexa\"",
",",
"error_type",
"=",
"\"INTERNAL_ERROR\"",
",",
"error_message",
"=",
"\"\"",
",",
"payload",
"=",
"None",
",",
")",
":",
"payload",
"=",
"payload",
"or",
"{",
"}",
"payload",
"[",
"\"ty... | [
74,
4
] | [
97,
88
] | python | en | ['en', 'en', 'en'] | True |
AlexaResponse.__init__ | (self, name, namespace, payload=None) | Initialize the response. | Initialize the response. | def __init__(self, name, namespace, payload=None):
"""Initialize the response."""
payload = payload or {}
self._response = {
API_EVENT: {
API_HEADER: {
"namespace": namespace,
"name": name,
"messageId": str(u... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"namespace",
",",
"payload",
"=",
"None",
")",
":",
"payload",
"=",
"payload",
"or",
"{",
"}",
"self",
".",
"_response",
"=",
"{",
"API_EVENT",
":",
"{",
"API_HEADER",
":",
"{",
"\"namespace\"",
":",
... | [
103,
4
] | [
116,
9
] | python | en | ['en', 'en', 'en'] | True |
AlexaResponse.name | (self) | Return the name of this response. | Return the name of this response. | def name(self):
"""Return the name of this response."""
return self._response[API_EVENT][API_HEADER]["name"] | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_response",
"[",
"API_EVENT",
"]",
"[",
"API_HEADER",
"]",
"[",
"\"name\"",
"]"
] | [
119,
4
] | [
121,
60
] | python | en | ['en', 'en', 'en'] | True |
AlexaResponse.namespace | (self) | Return the namespace of this response. | Return the namespace of this response. | def namespace(self):
"""Return the namespace of this response."""
return self._response[API_EVENT][API_HEADER]["namespace"] | [
"def",
"namespace",
"(",
"self",
")",
":",
"return",
"self",
".",
"_response",
"[",
"API_EVENT",
"]",
"[",
"API_HEADER",
"]",
"[",
"\"namespace\"",
"]"
] | [
124,
4
] | [
126,
65
] | python | en | ['en', 'en', 'en'] | True |
AlexaResponse.set_correlation_token | (self, token) | Set the correlationToken.
This should normally mirror the value from a request, and is set by
AlexaDirective.response() usually.
| Set the correlationToken. | def set_correlation_token(self, token):
"""Set the correlationToken.
This should normally mirror the value from a request, and is set by
AlexaDirective.response() usually.
"""
self._response[API_EVENT][API_HEADER]["correlationToken"] = token | [
"def",
"set_correlation_token",
"(",
"self",
",",
"token",
")",
":",
"self",
".",
"_response",
"[",
"API_EVENT",
"]",
"[",
"API_HEADER",
"]",
"[",
"\"correlationToken\"",
"]",
"=",
"token"
] | [
128,
4
] | [
134,
73
] | python | en | ['en', 'sr', 'en'] | True |
AlexaResponse.set_endpoint_full | (self, bearer_token, endpoint_id, cookie=None) | Set the endpoint dictionary.
This is used to send proactive messages to Alexa.
| Set the endpoint dictionary. | def set_endpoint_full(self, bearer_token, endpoint_id, cookie=None):
"""Set the endpoint dictionary.
This is used to send proactive messages to Alexa.
"""
self._response[API_EVENT][API_ENDPOINT] = {
API_SCOPE: {"type": "BearerToken", "token": bearer_token}
}
... | [
"def",
"set_endpoint_full",
"(",
"self",
",",
"bearer_token",
",",
"endpoint_id",
",",
"cookie",
"=",
"None",
")",
":",
"self",
".",
"_response",
"[",
"API_EVENT",
"]",
"[",
"API_ENDPOINT",
"]",
"=",
"{",
"API_SCOPE",
":",
"{",
"\"type\"",
":",
"\"BearerTo... | [
136,
4
] | [
149,
70
] | python | en | ['en', 'en', 'en'] | True |
AlexaResponse.set_endpoint | (self, endpoint) | Set the endpoint.
This should normally mirror the value from a request, and is set by
AlexaDirective.response() usually.
| Set the endpoint. | def set_endpoint(self, endpoint):
"""Set the endpoint.
This should normally mirror the value from a request, and is set by
AlexaDirective.response() usually.
"""
self._response[API_EVENT][API_ENDPOINT] = endpoint | [
"def",
"set_endpoint",
"(",
"self",
",",
"endpoint",
")",
":",
"self",
".",
"_response",
"[",
"API_EVENT",
"]",
"[",
"API_ENDPOINT",
"]",
"=",
"endpoint"
] | [
151,
4
] | [
157,
58
] | python | en | ['en', 'en', 'en'] | True |
AlexaResponse.add_context_property | (self, prop) | Add a property to the response context.
The Alexa response includes a list of properties which provides
feedback on how states have changed. For example if a user asks,
"Alexa, set thermostat to 20 degrees", the API expects a response with
the new value of the property, and Alexa will r... | Add a property to the response context. | def add_context_property(self, prop):
"""Add a property to the response context.
The Alexa response includes a list of properties which provides
feedback on how states have changed. For example if a user asks,
"Alexa, set thermostat to 20 degrees", the API expects a response with
... | [
"def",
"add_context_property",
"(",
"self",
",",
"prop",
")",
":",
"self",
".",
"_properties",
"(",
")",
".",
"append",
"(",
"prop",
")"
] | [
163,
4
] | [
178,
39
] | python | en | ['en', 'en', 'en'] | True |
AlexaResponse.merge_context_properties | (self, endpoint) | Add all properties from given endpoint if not already set.
Handlers should be using .add_context_property().
| Add all properties from given endpoint if not already set. | def merge_context_properties(self, endpoint):
"""Add all properties from given endpoint if not already set.
Handlers should be using .add_context_property().
"""
properties = self._properties()
already_set = {(p["namespace"], p["name"]) for p in properties}
for prop in ... | [
"def",
"merge_context_properties",
"(",
"self",
",",
"endpoint",
")",
":",
"properties",
"=",
"self",
".",
"_properties",
"(",
")",
"already_set",
"=",
"{",
"(",
"p",
"[",
"\"namespace\"",
"]",
",",
"p",
"[",
"\"name\"",
"]",
")",
"for",
"p",
"in",
"pr... | [
180,
4
] | [
190,
47
] | python | en | ['en', 'en', 'en'] | True |
AlexaResponse.serialize | (self) | Return response as a JSON-able data structure. | Return response as a JSON-able data structure. | def serialize(self):
"""Return response as a JSON-able data structure."""
return self._response | [
"def",
"serialize",
"(",
"self",
")",
":",
"return",
"self",
".",
"_response"
] | [
192,
4
] | [
194,
29
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistantType,
config_entry: ConfigEntry,
async_add_entities: Callable[[List[Entity], bool], None],
) | Set up from config entry. | Set up from config entry. | async def async_setup_entry(
hass: HomeAssistantType,
config_entry: ConfigEntry,
async_add_entities: Callable[[List[Entity], bool], None],
) -> None:
"""Set up from config entry."""
router = hass.data[DOMAIN].routers[config_entry.data[CONF_URL]]
switches: List[Entity] = []
if router.data.ge... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config_entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"Callable",
"[",
"[",
"List",
"[",
"Entity",
"]",
",",
"bool",
"]",
",",
"None",
"]",
",",
")",
"->",
"None... | [
23,
0
] | [
35,
38
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the Cast component. | Set up the Cast component. | async def async_setup(hass, config):
"""Set up the Cast component."""
conf = config.get(DOMAIN)
hass.data[DOMAIN] = conf or {}
if conf is not None:
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}
... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
")",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"conf",
"or",
"{",
"}",
"if",
"conf",
"is",
"not",
"None",
":",
"hass",
".",... | [
7,
0
] | [
20,
15
] | python | en | ['en', 'fr', 'en'] | True |
async_setup_entry | (hass, entry: config_entries.ConfigEntry) | Set up Cast from a config entry. | Set up Cast from a config entry. | async def async_setup_entry(hass, entry: config_entries.ConfigEntry):
"""Set up Cast from a config entry."""
await home_assistant_cast.async_setup_ha_cast(hass, entry)
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, "media_player")
)
return True | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
":",
"config_entries",
".",
"ConfigEntry",
")",
":",
"await",
"home_assistant_cast",
".",
"async_setup_ha_cast",
"(",
"hass",
",",
"entry",
")",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
... | [
23,
0
] | [
30,
15
] | python | en | ['en', 'en', 'en'] | True |
async_add_entities | (
_async_add_entities: Callable,
entities: List[
Tuple[
zha_typing.ZhaEntityType,
Tuple[str, zha_typing.ZhaDeviceType, List[zha_typing.ChannelType]],
]
],
update_before_add: bool = True,
) | Add entities helper. | Add entities helper. | async def async_add_entities(
_async_add_entities: Callable,
entities: List[
Tuple[
zha_typing.ZhaEntityType,
Tuple[str, zha_typing.ZhaDeviceType, List[zha_typing.ChannelType]],
]
],
update_before_add: bool = True,
) -> None:
"""Add entities helper."""
if ... | [
"async",
"def",
"async_add_entities",
"(",
"_async_add_entities",
":",
"Callable",
",",
"entities",
":",
"List",
"[",
"Tuple",
"[",
"zha_typing",
".",
"ZhaEntityType",
",",
"Tuple",
"[",
"str",
",",
"zha_typing",
".",
"ZhaDeviceType",
",",
"List",
"[",
"zha_ty... | [
33,
0
] | [
48,
20
] | python | en | ['en', 'fy', 'en'] | True |
ProbeEndpoint.__init__ | (self) | Initialize instance. | Initialize instance. | def __init__(self):
"""Initialize instance."""
self._device_configs = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_device_configs",
"=",
"{",
"}"
] | [
54,
4
] | [
56,
33
] | python | en | ['en', 'en', 'it'] | False |
ProbeEndpoint.discover_entities | (self, channel_pool: zha_typing.ChannelPoolType) | Process an endpoint on a zigpy device. | Process an endpoint on a zigpy device. | def discover_entities(self, channel_pool: zha_typing.ChannelPoolType) -> None:
"""Process an endpoint on a zigpy device."""
self.discover_by_device_type(channel_pool)
self.discover_by_cluster_id(channel_pool) | [
"def",
"discover_entities",
"(",
"self",
",",
"channel_pool",
":",
"zha_typing",
".",
"ChannelPoolType",
")",
"->",
"None",
":",
"self",
".",
"discover_by_device_type",
"(",
"channel_pool",
")",
"self",
".",
"discover_by_cluster_id",
"(",
"channel_pool",
")"
] | [
59,
4
] | [
62,
49
] | python | en | ['en', 'en', 'en'] | True |
ProbeEndpoint.discover_by_device_type | (self, channel_pool: zha_typing.ChannelPoolType) | Process an endpoint on a zigpy device. | Process an endpoint on a zigpy device. | def discover_by_device_type(self, channel_pool: zha_typing.ChannelPoolType) -> None:
"""Process an endpoint on a zigpy device."""
unique_id = channel_pool.unique_id
component = self._device_configs.get(unique_id, {}).get(ha_const.CONF_TYPE)
if component is None:
ep_profile_... | [
"def",
"discover_by_device_type",
"(",
"self",
",",
"channel_pool",
":",
"zha_typing",
".",
"ChannelPoolType",
")",
"->",
"None",
":",
"unique_id",
"=",
"channel_pool",
".",
"unique_id",
"component",
"=",
"self",
".",
"_device_configs",
".",
"get",
"(",
"unique_... | [
65,
4
] | [
84,
86
] | python | en | ['en', 'en', 'en'] | True |
ProbeEndpoint.discover_by_cluster_id | (self, channel_pool: zha_typing.ChannelPoolType) | Process an endpoint on a zigpy device. | Process an endpoint on a zigpy device. | def discover_by_cluster_id(self, channel_pool: zha_typing.ChannelPoolType) -> None:
"""Process an endpoint on a zigpy device."""
items = zha_regs.SINGLE_INPUT_CLUSTER_DEVICE_CLASS.items()
single_input_clusters = {
cluster_class: match
for cluster_class, match in items
... | [
"def",
"discover_by_cluster_id",
"(",
"self",
",",
"channel_pool",
":",
"zha_typing",
".",
"ChannelPoolType",
")",
"->",
"None",
":",
"items",
"=",
"zha_regs",
".",
"SINGLE_INPUT_CLUSTER_DEVICE_CLASS",
".",
"items",
"(",
")",
"single_input_clusters",
"=",
"{",
"cl... | [
87,
4
] | [
114,
65
] | python | en | ['en', 'en', 'en'] | True |
ProbeEndpoint.probe_single_cluster | (
component: str,
channel: zha_typing.ChannelType,
ep_channels: zha_typing.ChannelPoolType,
) | Probe specified cluster for specific component. | Probe specified cluster for specific component. | def probe_single_cluster(
component: str,
channel: zha_typing.ChannelType,
ep_channels: zha_typing.ChannelPoolType,
) -> None:
"""Probe specified cluster for specific component."""
if component is None or component not in zha_const.COMPONENTS:
return
chann... | [
"def",
"probe_single_cluster",
"(",
"component",
":",
"str",
",",
"channel",
":",
"zha_typing",
".",
"ChannelType",
",",
"ep_channels",
":",
"zha_typing",
".",
"ChannelPoolType",
",",
")",
"->",
"None",
":",
"if",
"component",
"is",
"None",
"or",
"component",
... | [
117,
4
] | [
134,
81
] | python | en | ['en', 'en', 'en'] | True |
ProbeEndpoint.handle_on_off_output_cluster_exception | (
self, ep_channels: zha_typing.ChannelPoolType
) | Process output clusters of the endpoint. | Process output clusters of the endpoint. | def handle_on_off_output_cluster_exception(
self, ep_channels: zha_typing.ChannelPoolType
) -> None:
"""Process output clusters of the endpoint."""
profile_id = ep_channels.endpoint.profile_id
device_type = ep_channels.endpoint.device_type
if device_type in zha_regs.REMOTE_D... | [
"def",
"handle_on_off_output_cluster_exception",
"(",
"self",
",",
"ep_channels",
":",
"zha_typing",
".",
"ChannelPoolType",
")",
"->",
"None",
":",
"profile_id",
"=",
"ep_channels",
".",
"endpoint",
".",
"profile_id",
"device_type",
"=",
"ep_channels",
".",
"endpoi... | [
136,
4
] | [
157,
70
] | python | en | ['en', 'en', 'en'] | True |
ProbeEndpoint.initialize | (self, hass: HomeAssistantType) | Update device overrides config. | Update device overrides config. | def initialize(self, hass: HomeAssistantType) -> None:
"""Update device overrides config."""
zha_config = hass.data[zha_const.DATA_ZHA].get(zha_const.DATA_ZHA_CONFIG, {})
overrides = zha_config.get(zha_const.CONF_DEVICE_CONFIG)
if overrides:
self._device_configs.update(overri... | [
"def",
"initialize",
"(",
"self",
",",
"hass",
":",
"HomeAssistantType",
")",
"->",
"None",
":",
"zha_config",
"=",
"hass",
".",
"data",
"[",
"zha_const",
".",
"DATA_ZHA",
"]",
".",
"get",
"(",
"zha_const",
".",
"DATA_ZHA_CONFIG",
",",
"{",
"}",
")",
"... | [
159,
4
] | [
164,
50
] | python | en | ['fr', 'en', 'en'] | True |
GroupProbe.__init__ | (self) | Initialize instance. | Initialize instance. | def __init__(self):
"""Initialize instance."""
self._hass = None
self._unsubs = [] | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_hass",
"=",
"None",
"self",
".",
"_unsubs",
"=",
"[",
"]"
] | [
170,
4
] | [
173,
25
] | python | en | ['en', 'en', 'it'] | False |
GroupProbe.initialize | (self, hass: HomeAssistantType) | Initialize the group probe. | Initialize the group probe. | def initialize(self, hass: HomeAssistantType) -> None:
"""Initialize the group probe."""
self._hass = hass
self._unsubs.append(
async_dispatcher_connect(
hass, zha_const.SIGNAL_GROUP_ENTITY_REMOVED, self._reprobe_group
)
) | [
"def",
"initialize",
"(",
"self",
",",
"hass",
":",
"HomeAssistantType",
")",
"->",
"None",
":",
"self",
".",
"_hass",
"=",
"hass",
"self",
".",
"_unsubs",
".",
"append",
"(",
"async_dispatcher_connect",
"(",
"hass",
",",
"zha_const",
".",
"SIGNAL_GROUP_ENTI... | [
175,
4
] | [
182,
9
] | python | en | ['en', 'en', 'en'] | True |
GroupProbe.cleanup | (self) | Clean up on when zha shuts down. | Clean up on when zha shuts down. | def cleanup(self):
"""Clean up on when zha shuts down."""
for unsub in self._unsubs[:]:
unsub()
self._unsubs.remove(unsub) | [
"def",
"cleanup",
"(",
"self",
")",
":",
"for",
"unsub",
"in",
"self",
".",
"_unsubs",
"[",
":",
"]",
":",
"unsub",
"(",
")",
"self",
".",
"_unsubs",
".",
"remove",
"(",
"unsub",
")"
] | [
184,
4
] | [
188,
38
] | python | en | ['en', 'en', 'en'] | True |
GroupProbe._reprobe_group | (self, group_id: int) | Reprobe a group for entities after its members change. | Reprobe a group for entities after its members change. | def _reprobe_group(self, group_id: int) -> None:
"""Reprobe a group for entities after its members change."""
zha_gateway = self._hass.data[zha_const.DATA_ZHA][zha_const.DATA_ZHA_GATEWAY]
zha_group = zha_gateway.groups.get(group_id)
if zha_group is None:
return
self.d... | [
"def",
"_reprobe_group",
"(",
"self",
",",
"group_id",
":",
"int",
")",
"->",
"None",
":",
"zha_gateway",
"=",
"self",
".",
"_hass",
".",
"data",
"[",
"zha_const",
".",
"DATA_ZHA",
"]",
"[",
"zha_const",
".",
"DATA_ZHA_GATEWAY",
"]",
"zha_group",
"=",
"z... | [
190,
4
] | [
196,
47
] | python | en | ['en', 'en', 'en'] | True |
GroupProbe.discover_group_entities | (self, group: zha_typing.ZhaGroupType) | Process a group and create any entities that are needed. | Process a group and create any entities that are needed. | def discover_group_entities(self, group: zha_typing.ZhaGroupType) -> None:
"""Process a group and create any entities that are needed."""
# only create a group entity if there are 2 or more members in a group
if len(group.members) < 2:
_LOGGER.debug(
"Group: %s:0x%04x... | [
"def",
"discover_group_entities",
"(",
"self",
",",
"group",
":",
"zha_typing",
".",
"ZhaGroupType",
")",
"->",
"None",
":",
"# only create a group entity if there are 2 or more members in a group",
"if",
"len",
"(",
"group",
".",
"members",
")",
"<",
"2",
":",
"_LO... | [
199,
4
] | [
231,
72
] | python | en | ['en', 'en', 'en'] | True |
GroupProbe.determine_entity_domains | (
hass: HomeAssistantType, group: zha_typing.ZhaGroupType
) | Determine the entity domains for this group. | Determine the entity domains for this group. | def determine_entity_domains(
hass: HomeAssistantType, group: zha_typing.ZhaGroupType
) -> List[str]:
"""Determine the entity domains for this group."""
entity_domains: List[str] = []
zha_gateway = hass.data[zha_const.DATA_ZHA][zha_const.DATA_ZHA_GATEWAY]
all_domain_occurrenc... | [
"def",
"determine_entity_domains",
"(",
"hass",
":",
"HomeAssistantType",
",",
"group",
":",
"zha_typing",
".",
"ZhaGroupType",
")",
"->",
"List",
"[",
"str",
"]",
":",
"entity_domains",
":",
"List",
"[",
"str",
"]",
"=",
"[",
"]",
"zha_gateway",
"=",
"has... | [
234,
4
] | [
265,
29
] | python | en | ['en', 'en', 'en'] | True |
mock_successful_connection | (*args, **kwargs) | Return a successful connection. | Return a successful connection. | async def mock_successful_connection(*args, **kwargs):
"""Return a successful connection."""
return True | [
"async",
"def",
"mock_successful_connection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"True"
] | [
56,
0
] | [
58,
15
] | python | en | ['en', 'en', 'en'] | True |
mock_failed_connection | (*args, **kwargs) | Return a failed connection. | Return a failed connection. | async def mock_failed_connection(*args, **kwargs):
"""Return a failed connection."""
raise ConnectionError("Connection failed") | [
"async",
"def",
"mock_failed_connection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"ConnectionError",
"(",
"\"Connection failed\"",
")"
] | [
61,
0
] | [
63,
46
] | python | en | ['en', 'ga', 'en'] | True |
_init_form | (hass, modem_type) | Run the user form. | Run the user form. | async def _init_form(hass, modem_type):
"""Run the user form."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["errors"] == {}
result2 = await hass.conf... | [
"async",
"def",
"_init_form",
"(",
"hass",
",",
"modem_type",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
... | [
66,
0
] | [
78,
18
] | python | en | ['en', 'en', 'en'] | True |
_device_form | (hass, flow_id, connection, user_input) | Test the PLM, Hub v1 or Hub v2 form. | Test the PLM, Hub v1 or Hub v2 form. | async def _device_form(hass, flow_id, connection, user_input):
"""Test the PLM, Hub v1 or Hub v2 form."""
with patch(PATCH_CONNECTION, new=connection,), patch(
PATCH_ASYNC_SETUP, return_value=True
) as mock_setup, patch(
PATCH_ASYNC_SETUP_ENTRY,
return_value=True,
) as mock_setup... | [
"async",
"def",
"_device_form",
"(",
"hass",
",",
"flow_id",
",",
"connection",
",",
"user_input",
")",
":",
"with",
"patch",
"(",
"PATCH_CONNECTION",
",",
"new",
"=",
"connection",
",",
")",
",",
"patch",
"(",
"PATCH_ASYNC_SETUP",
",",
"return_value",
"=",
... | [
81,
0
] | [
91,
47
] | python | en | ['en', 'da', 'en'] | True |
test_form_select_modem | (hass: HomeAssistantType) | Test we get a modem form. | Test we get a modem form. | async def test_form_select_modem(hass: HomeAssistantType):
"""Test we get a modem form."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await _init_form(hass, HUB2)
assert result["step_id"] == STEP_HUB_V2
assert result["type"] == "form" | [
"async",
"def",
"test_form_select_modem",
"(",
"hass",
":",
"HomeAssistantType",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"_init_form",
"(",
"hass",
","... | [
94,
0
] | [
99,
35
] | python | da | ['de', 'da', 'en'] | False |
test_fail_on_existing | (hass: HomeAssistantType) | Test we fail if the integration is already configured. | Test we fail if the integration is already configured. | async def test_fail_on_existing(hass: HomeAssistantType):
"""Test we fail if the integration is already configured."""
config_entry = MockConfigEntry(
domain=DOMAIN,
entry_id="abcde12345",
data={**MOCK_USER_INPUT_HUB_V2, CONF_HUB_VERSION: 2},
options={},
)
config_entry.ad... | [
"async",
"def",
"test_fail_on_existing",
"(",
"hass",
":",
"HomeAssistantType",
")",
":",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"entry_id",
"=",
"\"abcde12345\"",
",",
"data",
"=",
"{",
"*",
"*",
"MOCK_USER_INPUT_HUB_V2",
","... | [
102,
0
] | [
119,
56
] | python | en | ['en', 'en', 'en'] | True |
test_form_select_plm | (hass: HomeAssistantType) | Test we set up the PLM correctly. | Test we set up the PLM correctly. | async def test_form_select_plm(hass: HomeAssistantType):
"""Test we set up the PLM correctly."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await _init_form(hass, PLM)
result2, mock_setup, mock_setup_entry = await _device_form(
hass, result["flow_id"], mock_... | [
"async",
"def",
"test_form_select_plm",
"(",
"hass",
":",
"HomeAssistantType",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"_init_form",
"(",
"hass",
",",
... | [
122,
0
] | [
134,
48
] | python | en | ['en', 'zu', 'en'] | True |
test_form_select_hub_v1 | (hass: HomeAssistantType) | Test we set up the Hub v1 correctly. | Test we set up the Hub v1 correctly. | async def test_form_select_hub_v1(hass: HomeAssistantType):
"""Test we set up the Hub v1 correctly."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await _init_form(hass, HUB1)
result2, mock_setup, mock_setup_entry = await _device_form(
hass, result["flow_id"]... | [
"async",
"def",
"test_form_select_hub_v1",
"(",
"hass",
":",
"HomeAssistantType",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"_init_form",
"(",
"hass",
",... | [
137,
0
] | [
152,
48
] | python | en | ['en', 'zu', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.