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
async_get_triggers
(hass: HomeAssistant, device_id: str)
List device triggers for Vacuum devices.
List device triggers for Vacuum devices.
async def async_get_triggers(hass: HomeAssistant, device_id: str) -> List[dict]: """List device triggers for Vacuum devices.""" registry = await entity_registry.async_get_registry(hass) triggers = [] # Get all the integrations entities for this device for entry in entity_registry.async_entries_for_...
[ "async", "def", "async_get_triggers", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ")", "->", "List", "[", "dict", "]", ":", "registry", "=", "await", "entity_registry", ".", "async_get_registry", "(", "hass", ")", "triggers", "=", "[", ...
[ 31, 0 ]
[ 60, 19 ]
python
en
['de', 'en', 'en']
True
async_attach_trigger
( hass: HomeAssistant, config: ConfigType, action: AutomationActionType, automation_info: dict, )
Attach a trigger.
Attach a trigger.
async def async_attach_trigger( hass: HomeAssistant, config: ConfigType, action: AutomationActionType, automation_info: dict, ) -> CALLBACK_TYPE: """Attach a trigger.""" config = TRIGGER_SCHEMA(config) if config[CONF_TYPE] == "cleaning": from_state = [state for state in STATES if st...
[ "async", "def", "async_attach_trigger", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ",", "action", ":", "AutomationActionType", ",", "automation_info", ":", "dict", ",", ")", "->", "CALLBACK_TYPE", ":", "config", "=", "TRIGGER_SCHEMA", "...
[ 63, 0 ]
[ 88, 5 ]
python
en
['en', 'lb', 'en']
True
async_setup_platform
( hass: HomeAssistantType, config: dict, async_add_entities, discovery_info=None )
Set up from legacy configuration file. Obsolete.
Set up from legacy configuration file. Obsolete.
async def async_setup_platform( hass: HomeAssistantType, config: dict, async_add_entities, discovery_info=None ) -> None: """Set up from legacy configuration file. Obsolete.""" _LOGGER.error( "Configuring Songpal through media_player platform is no longer supported. Convert to songpal platform or UI...
[ "async", "def", "async_setup_platform", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "dict", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", "->", "None", ":", "_LOGGER", ".", "error", "(", "\"Configuring Songpal through media_playe...
[ 54, 0 ]
[ 60, 5 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities )
Set up songpal media player.
Set up songpal media player.
async def async_setup_entry( hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities ) -> None: """Set up songpal media player.""" name = config_entry.data[CONF_NAME] endpoint = config_entry.data[CONF_ENDPOINT] device = Device(endpoint) try: async with async_timeout.timeo...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "config_entry", ":", "ConfigEntry", ",", "async_add_entities", ")", "->", "None", ":", "name", "=", "config_entry", ".", "data", "[", "CONF_NAME", "]", "endpoint", "=", "config_entr...
[ 63, 0 ]
[ 89, 5 ]
python
en
['en', 'fil', 'en']
True
SongpalEntity.should_poll
(self)
Return True if the device should be polled.
Return True if the device should be polled.
def should_poll(self): """Return True if the device should be polled.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 116, 4 ]
[ 118, 20 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.async_added_to_hass
(self)
Run when entity is added to hass.
Run when entity is added to hass.
async def async_added_to_hass(self): """Run when entity is added to hass.""" await self.async_activate_websocket()
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "self", ".", "async_activate_websocket", "(", ")" ]
[ 120, 4 ]
[ 122, 45 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.async_will_remove_from_hass
(self)
Run when entity will be removed from hass.
Run when entity will be removed from hass.
async def async_will_remove_from_hass(self): """Run when entity will be removed from hass.""" await self._dev.stop_listen_notifications()
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", ":", "await", "self", ".", "_dev", ".", "stop_listen_notifications", "(", ")" ]
[ 124, 4 ]
[ 126, 51 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.async_activate_websocket
(self)
Activate websocket for listening if wanted.
Activate websocket for listening if wanted.
async def async_activate_websocket(self): """Activate websocket for listening if wanted.""" _LOGGER.info("Activating websocket connection") async def _volume_changed(volume: VolumeChange): _LOGGER.debug("Volume changed: %s", volume) self._volume = volume.volume ...
[ "async", "def", "async_activate_websocket", "(", "self", ")", ":", "_LOGGER", ".", "info", "(", "\"Activating websocket connection\"", ")", "async", "def", "_volume_changed", "(", "volume", ":", "VolumeChange", ")", ":", "_LOGGER", ".", "debug", "(", "\"Volume cha...
[ 128, 4 ]
[ 194, 68 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.name
(self)
Return name of the device.
Return name of the device.
def name(self): """Return name of the device.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 197, 4 ]
[ 199, 25 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self): """Return a unique ID.""" return self._sysinfo.macAddr
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_sysinfo", ".", "macAddr" ]
[ 202, 4 ]
[ 204, 36 ]
python
ca
['fr', 'ca', 'en']
False
SongpalEntity.device_info
(self)
Return the device info.
Return the device info.
def device_info(self): """Return the device info.""" return { "connections": {(dr.CONNECTION_NETWORK_MAC, self._sysinfo.macAddr)}, "identifiers": {(DOMAIN, self.unique_id)}, "manufacturer": "Sony Corporation", "name": self.name, "sw_version": s...
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"connections\"", ":", "{", "(", "dr", ".", "CONNECTION_NETWORK_MAC", ",", "self", ".", "_sysinfo", ".", "macAddr", ")", "}", ",", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", ...
[ 207, 4 ]
[ 216, 9 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.available
(self)
Return availability of the device.
Return availability of the device.
def available(self): """Return availability of the device.""" return self._available
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_available" ]
[ 219, 4 ]
[ 221, 30 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.async_set_sound_setting
(self, name, value)
Change a setting on the device.
Change a setting on the device.
async def async_set_sound_setting(self, name, value): """Change a setting on the device.""" _LOGGER.debug("Calling set_sound_setting with %s: %s", name, value) await self._dev.set_sound_settings(name, value)
[ "async", "def", "async_set_sound_setting", "(", "self", ",", "name", ",", "value", ")", ":", "_LOGGER", ".", "debug", "(", "\"Calling set_sound_setting with %s: %s\"", ",", "name", ",", "value", ")", "await", "self", ".", "_dev", ".", "set_sound_settings", "(", ...
[ 223, 4 ]
[ 226, 55 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.async_update
(self)
Fetch updates from the device.
Fetch updates from the device.
async def async_update(self): """Fetch updates from the device.""" try: if self._sysinfo is None: self._sysinfo = await self._dev.get_system_info() if self._model is None: interface_info = await self._dev.get_interface_information() ...
[ "async", "def", "async_update", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_sysinfo", "is", "None", ":", "self", ".", "_sysinfo", "=", "await", "self", ".", "_dev", ".", "get_system_info", "(", ")", "if", "self", ".", "_model", "is", "Non...
[ 228, 4 ]
[ 275, 35 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.async_select_source
(self, source)
Select source.
Select source.
async def async_select_source(self, source): """Select source.""" for out in self._sources.values(): if out.title == source: await out.activate() return _LOGGER.error("Unable to find output: %s", source)
[ "async", "def", "async_select_source", "(", "self", ",", "source", ")", ":", "for", "out", "in", "self", ".", "_sources", ".", "values", "(", ")", ":", "if", "out", ".", "title", "==", "source", ":", "await", "out", ".", "activate", "(", ")", "return...
[ 277, 4 ]
[ 284, 58 ]
python
ceb
['fr', 'ceb', 'en']
False
SongpalEntity.source_list
(self)
Return list of available sources.
Return list of available sources.
def source_list(self): """Return list of available sources.""" return [src.title for src in self._sources.values()]
[ "def", "source_list", "(", "self", ")", ":", "return", "[", "src", ".", "title", "for", "src", "in", "self", ".", "_sources", ".", "values", "(", ")", "]" ]
[ 287, 4 ]
[ 289, 60 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.state
(self)
Return current state.
Return current state.
def state(self): """Return current state.""" if self._state: return STATE_ON return STATE_OFF
[ "def", "state", "(", "self", ")", ":", "if", "self", ".", "_state", ":", "return", "STATE_ON", "return", "STATE_OFF" ]
[ 292, 4 ]
[ 296, 24 ]
python
en
['en', 'co', 'en']
True
SongpalEntity.source
(self)
Return currently active source.
Return currently active source.
def source(self): """Return currently active source.""" # Avoid a KeyError when _active_source is not (yet) populated return getattr(self._active_source, "title", None)
[ "def", "source", "(", "self", ")", ":", "# Avoid a KeyError when _active_source is not (yet) populated", "return", "getattr", "(", "self", ".", "_active_source", ",", "\"title\"", ",", "None", ")" ]
[ 299, 4 ]
[ 302, 58 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.volume_level
(self)
Return volume level.
Return volume level.
def volume_level(self): """Return volume level.""" volume = self._volume / self._volume_max return volume
[ "def", "volume_level", "(", "self", ")", ":", "volume", "=", "self", ".", "_volume", "/", "self", ".", "_volume_max", "return", "volume" ]
[ 305, 4 ]
[ 308, 21 ]
python
en
['nl', 'no', 'en']
False
SongpalEntity.async_set_volume_level
(self, volume)
Set volume level.
Set volume level.
async def async_set_volume_level(self, volume): """Set volume level.""" volume = int(volume * self._volume_max) _LOGGER.debug("Setting volume to %s", volume) return await self._volume_control.set_volume(volume)
[ "async", "def", "async_set_volume_level", "(", "self", ",", "volume", ")", ":", "volume", "=", "int", "(", "volume", "*", "self", ".", "_volume_max", ")", "_LOGGER", ".", "debug", "(", "\"Setting volume to %s\"", ",", "volume", ")", "return", "await", "self"...
[ 310, 4 ]
[ 314, 60 ]
python
en
['fr', 'sr', 'en']
False
SongpalEntity.async_volume_up
(self)
Set volume up.
Set volume up.
async def async_volume_up(self): """Set volume up.""" return await self._volume_control.set_volume(self._volume + 1)
[ "async", "def", "async_volume_up", "(", "self", ")", ":", "return", "await", "self", ".", "_volume_control", ".", "set_volume", "(", "self", ".", "_volume", "+", "1", ")" ]
[ 316, 4 ]
[ 318, 70 ]
python
da
['nl', 'da', 'en']
False
SongpalEntity.async_volume_down
(self)
Set volume down.
Set volume down.
async def async_volume_down(self): """Set volume down.""" return await self._volume_control.set_volume(self._volume - 1)
[ "async", "def", "async_volume_down", "(", "self", ")", ":", "return", "await", "self", ".", "_volume_control", ".", "set_volume", "(", "self", ".", "_volume", "-", "1", ")" ]
[ 320, 4 ]
[ 322, 70 ]
python
de
['nl', 'de', 'en']
False
SongpalEntity.async_turn_on
(self)
Turn the device on.
Turn the device on.
async def async_turn_on(self): """Turn the device on.""" return await self._dev.set_power(True)
[ "async", "def", "async_turn_on", "(", "self", ")", ":", "return", "await", "self", ".", "_dev", ".", "set_power", "(", "True", ")" ]
[ 324, 4 ]
[ 326, 46 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.async_turn_off
(self)
Turn the device off.
Turn the device off.
async def async_turn_off(self): """Turn the device off.""" return await self._dev.set_power(False)
[ "async", "def", "async_turn_off", "(", "self", ")", ":", "return", "await", "self", ".", "_dev", ".", "set_power", "(", "False", ")" ]
[ 328, 4 ]
[ 330, 47 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.async_mute_volume
(self, mute)
Mute or unmute the device.
Mute or unmute the device.
async def async_mute_volume(self, mute): """Mute or unmute the device.""" _LOGGER.debug("Set mute: %s", mute) return await self._volume_control.set_mute(mute)
[ "async", "def", "async_mute_volume", "(", "self", ",", "mute", ")", ":", "_LOGGER", ".", "debug", "(", "\"Set mute: %s\"", ",", "mute", ")", "return", "await", "self", ".", "_volume_control", ".", "set_mute", "(", "mute", ")" ]
[ 332, 4 ]
[ 335, 56 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.is_volume_muted
(self)
Return whether the device is muted.
Return whether the device is muted.
def is_volume_muted(self): """Return whether the device is muted.""" return self._is_muted
[ "def", "is_volume_muted", "(", "self", ")", ":", "return", "self", ".", "_is_muted" ]
[ 338, 4 ]
[ 340, 29 ]
python
en
['en', 'en', 'en']
True
SongpalEntity.supported_features
(self)
Return supported features.
Return supported features.
def supported_features(self): """Return supported features.""" return SUPPORT_SONGPAL
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_SONGPAL" ]
[ 343, 4 ]
[ 345, 30 ]
python
en
['en', 'en', 'en']
True
device_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def device_reg(hass): """Return an empty, loaded, registry.""" return mock_device_registry(hass)
[ "def", "device_reg", "(", "hass", ")", ":", "return", "mock_device_registry", "(", "hass", ")" ]
[ 18, 0 ]
[ 20, 37 ]
python
en
['en', 'fy', 'en']
True
entity_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def entity_reg(hass): """Return an empty, loaded, registry.""" return mock_registry(hass)
[ "def", "entity_reg", "(", "hass", ")", ":", "return", "mock_registry", "(", "hass", ")" ]
[ 24, 0 ]
[ 26, 30 ]
python
en
['en', 'fy', 'en']
True
calls
(hass)
Track calls to a mock service.
Track calls to a mock service.
def calls(hass): """Track calls to a mock service.""" return async_mock_service(hass, "test", "automation")
[ "def", "calls", "(", "hass", ")", ":", "return", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")" ]
[ 30, 0 ]
[ 32, 57 ]
python
en
['en', 'en', 'en']
True
test_get_triggers
(hass, device_reg, entity_reg)
Test we get the expected triggers from a arcam_fmj.
Test we get the expected triggers from a arcam_fmj.
async def test_get_triggers(hass, device_reg, entity_reg): """Test we get the expected triggers from a arcam_fmj.""" config_entry = MockConfigEntry(domain=DOMAIN, data={}) config_entry.add_to_hass(hass) device_entry = device_reg.async_get_or_create( config_entry_id=config_entry.entry_id, ...
[ "async", "def", "test_get_triggers", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "}", ")", "config_entry", ".", "add_to_hass", "(", "hass", ")", "...
[ 35, 0 ]
[ 56, 50 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_turn_on_request
(hass, calls, player_setup, state)
Test for turn_on and turn_off triggers firing.
Test for turn_on and turn_off triggers firing.
async def test_if_fires_on_turn_on_request(hass, calls, player_setup, state): """Test for turn_on and turn_off triggers firing.""" state.get_power.return_value = None assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: [ { ...
[ "async", "def", "test_if_fires_on_turn_on_request", "(", "hass", ",", "calls", ",", "player_setup", ",", "state", ")", ":", "state", ".", "get_power", ".", "return_value", "=", "None", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", "...
[ 59, 0 ]
[ 94, 48 ]
python
en
['en', 'en', 'en']
True
_async_reproduce_state
( hass: HomeAssistantType, state: State, *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, )
Reproduce a single state.
Reproduce a single state.
async def _async_reproduce_state( hass: HomeAssistantType, state: State, *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, ) -> None: """Reproduce a single state.""" cur_state = hass.states.get(state.entity_id) if cur_state is None: _LOGGE...
[ "async", "def", "_async_reproduce_state", "(", "hass", ":", "HomeAssistantType", ",", "state", ":", "State", ",", "*", ",", "context", ":", "Optional", "[", "Context", "]", "=", "None", ",", "reproduce_options", ":", "Optional", "[", "Dict", "[", "str", ",...
[ 34, 0 ]
[ 112, 9 ]
python
en
['en', 'en', 'en']
True
async_reproduce_states
( hass: HomeAssistantType, states: Iterable[State], *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, )
Reproduce Cover states.
Reproduce Cover states.
async def async_reproduce_states( hass: HomeAssistantType, states: Iterable[State], *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, ) -> None: """Reproduce Cover states.""" # Reproduce states in parallel. await asyncio.gather( *( ...
[ "async", "def", "async_reproduce_states", "(", "hass", ":", "HomeAssistantType", ",", "states", ":", "Iterable", "[", "State", "]", ",", "*", ",", "context", ":", "Optional", "[", "Context", "]", "=", "None", ",", "reproduce_options", ":", "Optional", "[", ...
[ 115, 0 ]
[ 131, 5 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up the ComfoConnect bridge.
Set up the ComfoConnect bridge.
def setup(hass, config): """Set up the ComfoConnect bridge.""" conf = config[DOMAIN] host = conf[CONF_HOST] name = conf[CONF_NAME] token = conf[CONF_TOKEN] user_agent = conf[CONF_USER_AGENT] pin = conf[CONF_PIN] # Run discovery on the configured ip bridges = Bridge.discover(host) ...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "host", "=", "conf", "[", "CONF_HOST", "]", "name", "=", "conf", "[", "CONF_NAME", "]", "token", "=", "conf", "[", "CONF_TOKEN", "]", "user_agent", "=", ...
[ 50, 0 ]
[ 84, 15 ]
python
en
['en', 'fr', 'en']
True
ComfoConnectBridge.__init__
(self, hass, bridge, name, token, friendly_name, pin)
Initialize the ComfoConnect bridge.
Initialize the ComfoConnect bridge.
def __init__(self, hass, bridge, name, token, friendly_name, pin): """Initialize the ComfoConnect bridge.""" self.data = {} self.name = name self.hass = hass self.unique_id = bridge.uuid.hex() self.comfoconnect = ComfoConnect( bridge=bridge, local...
[ "def", "__init__", "(", "self", ",", "hass", ",", "bridge", ",", "name", ",", "token", ",", "friendly_name", ",", "pin", ")", ":", "self", ".", "data", "=", "{", "}", "self", ".", "name", "=", "name", "self", ".", "hass", "=", "hass", "self", "."...
[ 90, 4 ]
[ 103, 64 ]
python
en
['en', 'fr', 'en']
True
ComfoConnectBridge.connect
(self)
Connect with the bridge.
Connect with the bridge.
def connect(self): """Connect with the bridge.""" _LOGGER.debug("Connecting with bridge") self.comfoconnect.connect(True)
[ "def", "connect", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Connecting with bridge\"", ")", "self", ".", "comfoconnect", ".", "connect", "(", "True", ")" ]
[ 105, 4 ]
[ 108, 39 ]
python
en
['en', 'en', 'en']
True
ComfoConnectBridge.disconnect
(self)
Disconnect from the bridge.
Disconnect from the bridge.
def disconnect(self): """Disconnect from the bridge.""" _LOGGER.debug("Disconnecting from bridge") self.comfoconnect.disconnect()
[ "def", "disconnect", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Disconnecting from bridge\"", ")", "self", ".", "comfoconnect", ".", "disconnect", "(", ")" ]
[ 110, 4 ]
[ 113, 38 ]
python
en
['en', 'en', 'en']
True
ComfoConnectBridge.sensor_callback
(self, var, value)
Notify listeners that we have received an update.
Notify listeners that we have received an update.
def sensor_callback(self, var, value): """Notify listeners that we have received an update.""" _LOGGER.debug("Received update for %s: %s", var, value) dispatcher_send( self.hass, SIGNAL_COMFOCONNECT_UPDATE_RECEIVED.format(var), value )
[ "def", "sensor_callback", "(", "self", ",", "var", ",", "value", ")", ":", "_LOGGER", ".", "debug", "(", "\"Received update for %s: %s\"", ",", "var", ",", "value", ")", "dispatcher_send", "(", "self", ".", "hass", ",", "SIGNAL_COMFOCONNECT_UPDATE_RECEIVED", "."...
[ 115, 4 ]
[ 120, 9 ]
python
en
['en', 'en', 'en']
True
CloudClient.__init__
( self, hass: HomeAssistantType, prefs: CloudPreferences, websession: aiohttp.ClientSession, alexa_user_config: Dict[str, Any], google_user_config: Dict[str, Any], )
Initialize client interface to Cloud.
Initialize client interface to Cloud.
def __init__( self, hass: HomeAssistantType, prefs: CloudPreferences, websession: aiohttp.ClientSession, alexa_user_config: Dict[str, Any], google_user_config: Dict[str, Any], ): """Initialize client interface to Cloud.""" self._hass = hass sel...
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistantType", ",", "prefs", ":", "CloudPreferences", ",", "websession", ":", "aiohttp", ".", "ClientSession", ",", "alexa_user_config", ":", "Dict", "[", "str", ",", "Any", "]", ",", "google_user_config"...
[ 29, 4 ]
[ 44, 34 ]
python
en
['en', 'en', 'en']
True
CloudClient.base_path
(self)
Return path to base dir.
Return path to base dir.
def base_path(self) -> Path: """Return path to base dir.""" return Path(self._hass.config.config_dir)
[ "def", "base_path", "(", "self", ")", "->", "Path", ":", "return", "Path", "(", "self", ".", "_hass", ".", "config", ".", "config_dir", ")" ]
[ 47, 4 ]
[ 49, 49 ]
python
en
['en', 'gd', 'en']
True
CloudClient.prefs
(self)
Return Cloud preferences.
Return Cloud preferences.
def prefs(self) -> CloudPreferences: """Return Cloud preferences.""" return self._prefs
[ "def", "prefs", "(", "self", ")", "->", "CloudPreferences", ":", "return", "self", ".", "_prefs" ]
[ 52, 4 ]
[ 54, 26 ]
python
en
['nl', 'fr', 'en']
False
CloudClient.loop
(self)
Return client loop.
Return client loop.
def loop(self) -> asyncio.BaseEventLoop: """Return client loop.""" return self._hass.loop
[ "def", "loop", "(", "self", ")", "->", "asyncio", ".", "BaseEventLoop", ":", "return", "self", ".", "_hass", ".", "loop" ]
[ 57, 4 ]
[ 59, 30 ]
python
af
['fr', 'af', 'en']
False
CloudClient.websession
(self)
Return client session for aiohttp.
Return client session for aiohttp.
def websession(self) -> aiohttp.ClientSession: """Return client session for aiohttp.""" return self._websession
[ "def", "websession", "(", "self", ")", "->", "aiohttp", ".", "ClientSession", ":", "return", "self", ".", "_websession" ]
[ 62, 4 ]
[ 64, 31 ]
python
en
['en', 'en', 'en']
True
CloudClient.aiohttp_runner
(self)
Return client webinterface aiohttp application.
Return client webinterface aiohttp application.
def aiohttp_runner(self) -> aiohttp.web.AppRunner: """Return client webinterface aiohttp application.""" return self._hass.http.runner
[ "def", "aiohttp_runner", "(", "self", ")", "->", "aiohttp", ".", "web", ".", "AppRunner", ":", "return", "self", ".", "_hass", ".", "http", ".", "runner" ]
[ 67, 4 ]
[ 69, 37 ]
python
en
['en', 'lb', 'en']
True
CloudClient.cloudhooks
(self)
Return list of cloudhooks.
Return list of cloudhooks.
def cloudhooks(self) -> Dict[str, Dict[str, str]]: """Return list of cloudhooks.""" return self._prefs.cloudhooks
[ "def", "cloudhooks", "(", "self", ")", "->", "Dict", "[", "str", ",", "Dict", "[", "str", ",", "str", "]", "]", ":", "return", "self", ".", "_prefs", ".", "cloudhooks" ]
[ 72, 4 ]
[ 74, 37 ]
python
en
['en', 'et', 'en']
True
CloudClient.remote_autostart
(self)
Return true if we want start a remote connection.
Return true if we want start a remote connection.
def remote_autostart(self) -> bool: """Return true if we want start a remote connection.""" return self._prefs.remote_enabled
[ "def", "remote_autostart", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_prefs", ".", "remote_enabled" ]
[ 77, 4 ]
[ 79, 41 ]
python
en
['en', 'en', 'en']
True
CloudClient.alexa_config
(self)
Return Alexa config.
Return Alexa config.
def alexa_config(self) -> alexa_config.AlexaConfig: """Return Alexa config.""" if self._alexa_config is None: assert self.cloud is not None self._alexa_config = alexa_config.AlexaConfig( self._hass, self.alexa_user_config, self._prefs, self.cloud ) ...
[ "def", "alexa_config", "(", "self", ")", "->", "alexa_config", ".", "AlexaConfig", ":", "if", "self", ".", "_alexa_config", "is", "None", ":", "assert", "self", ".", "cloud", "is", "not", "None", "self", ".", "_alexa_config", "=", "alexa_config", ".", "Ale...
[ 82, 4 ]
[ 90, 33 ]
python
ca
['ro', 'ca', 'en']
False
CloudClient.get_google_config
(self)
Return Google config.
Return Google config.
async def get_google_config(self) -> google_config.CloudGoogleConfig: """Return Google config.""" if not self._google_config: assert self.cloud is not None cloud_user = await self._prefs.get_cloud_user() self._google_config = google_config.CloudGoogleConfig( ...
[ "async", "def", "get_google_config", "(", "self", ")", "->", "google_config", ".", "CloudGoogleConfig", ":", "if", "not", "self", ".", "_google_config", ":", "assert", "self", ".", "cloud", "is", "not", "None", "cloud_user", "=", "await", "self", ".", "_pref...
[ 92, 4 ]
[ 104, 34 ]
python
en
['en', 'da', 'en']
True
CloudClient.logged_in
(self)
When user logs in.
When user logs in.
async def logged_in(self) -> None: """When user logs in.""" await self.prefs.async_set_username(self.cloud.username) async def enable_alexa(_): """Enable Alexa.""" try: await self.alexa_config.async_enable_proactive_mode() except aiohttp.Clien...
[ "async", "def", "logged_in", "(", "self", ")", "->", "None", ":", "await", "self", ".", "prefs", ".", "async_set_username", "(", "self", ".", "cloud", ".", "username", ")", "async", "def", "enable_alexa", "(", "_", ")", ":", "\"\"\"Enable Alexa.\"\"\"", "t...
[ 106, 4 ]
[ 142, 65 ]
python
en
['en', 'fy', 'en']
True
CloudClient.cleanups
(self)
Cleanup some stuff after logout.
Cleanup some stuff after logout.
async def cleanups(self) -> None: """Cleanup some stuff after logout.""" await self.prefs.async_set_username(None) self._google_config = None
[ "async", "def", "cleanups", "(", "self", ")", "->", "None", ":", "await", "self", ".", "prefs", ".", "async_set_username", "(", "None", ")", "self", ".", "_google_config", "=", "None" ]
[ 144, 4 ]
[ 148, 34 ]
python
en
['en', 'en', 'en']
True
CloudClient.user_message
(self, identifier: str, title: str, message: str)
Create a message for user to UI.
Create a message for user to UI.
def user_message(self, identifier: str, title: str, message: str) -> None: """Create a message for user to UI.""" self._hass.components.persistent_notification.async_create( message, title, identifier )
[ "def", "user_message", "(", "self", ",", "identifier", ":", "str", ",", "title", ":", "str", ",", "message", ":", "str", ")", "->", "None", ":", "self", ".", "_hass", ".", "components", ".", "persistent_notification", ".", "async_create", "(", "message", ...
[ 151, 4 ]
[ 155, 9 ]
python
en
['en', 'en', 'en']
True
CloudClient.dispatcher_message
(self, identifier: str, data: Any = None)
Match cloud notification to dispatcher.
Match cloud notification to dispatcher.
def dispatcher_message(self, identifier: str, data: Any = None) -> None: """Match cloud notification to dispatcher.""" if identifier.startswith("remote_"): async_dispatcher_send(self._hass, DISPATCHER_REMOTE_UPDATE, data)
[ "def", "dispatcher_message", "(", "self", ",", "identifier", ":", "str", ",", "data", ":", "Any", "=", "None", ")", "->", "None", ":", "if", "identifier", ".", "startswith", "(", "\"remote_\"", ")", ":", "async_dispatcher_send", "(", "self", ".", "_hass", ...
[ 158, 4 ]
[ 161, 77 ]
python
en
['en', 'lb', 'en']
True
CloudClient.async_alexa_message
(self, payload: Dict[Any, Any])
Process cloud alexa message to client.
Process cloud alexa message to client.
async def async_alexa_message(self, payload: Dict[Any, Any]) -> Dict[Any, Any]: """Process cloud alexa message to client.""" cloud_user = await self._prefs.get_cloud_user() return await alexa_sh.async_handle_message( self._hass, self.alexa_config, payload, ...
[ "async", "def", "async_alexa_message", "(", "self", ",", "payload", ":", "Dict", "[", "Any", ",", "Any", "]", ")", "->", "Dict", "[", "Any", ",", "Any", "]", ":", "cloud_user", "=", "await", "self", ".", "_prefs", ".", "get_cloud_user", "(", ")", "re...
[ 163, 4 ]
[ 172, 9 ]
python
en
['en', 'en', 'en']
True
CloudClient.async_google_message
(self, payload: Dict[Any, Any])
Process cloud google message to client.
Process cloud google message to client.
async def async_google_message(self, payload: Dict[Any, Any]) -> Dict[Any, Any]: """Process cloud google message to client.""" if not self._prefs.google_enabled: return ga.turned_off_response(payload) gconf = await self.get_google_config() return await ga.async_handle_messa...
[ "async", "def", "async_google_message", "(", "self", ",", "payload", ":", "Dict", "[", "Any", ",", "Any", "]", ")", "->", "Dict", "[", "Any", ",", "Any", "]", ":", "if", "not", "self", ".", "_prefs", ".", "google_enabled", ":", "return", "ga", ".", ...
[ 174, 4 ]
[ 183, 9 ]
python
en
['en', 'fr', 'en']
True
CloudClient.async_webhook_message
(self, payload: Dict[Any, Any])
Process cloud webhook message to client.
Process cloud webhook message to client.
async def async_webhook_message(self, payload: Dict[Any, Any]) -> Dict[Any, Any]: """Process cloud webhook message to client.""" cloudhook_id = payload["cloudhook_id"] found = None for cloudhook in self._prefs.cloudhooks.values(): if cloudhook["cloudhook_id"] == cloudhook_id...
[ "async", "def", "async_webhook_message", "(", "self", ",", "payload", ":", "Dict", "[", "Any", ",", "Any", "]", ")", "->", "Dict", "[", "Any", ",", "Any", "]", ":", "cloudhook_id", "=", "payload", "[", "\"cloudhook_id\"", "]", "found", "=", "None", "fo...
[ 185, 4 ]
[ 217, 9 ]
python
en
['en', 'en', 'en']
True
CloudClient.async_cloudhooks_update
(self, data: Dict[str, Dict[str, str]])
Update local list of cloudhooks.
Update local list of cloudhooks.
async def async_cloudhooks_update(self, data: Dict[str, Dict[str, str]]) -> None: """Update local list of cloudhooks.""" await self._prefs.async_update(cloudhooks=data)
[ "async", "def", "async_cloudhooks_update", "(", "self", ",", "data", ":", "Dict", "[", "str", ",", "Dict", "[", "str", ",", "str", "]", "]", ")", "->", "None", ":", "await", "self", ".", "_prefs", ".", "async_update", "(", "cloudhooks", "=", "data", ...
[ 219, 4 ]
[ 221, 55 ]
python
en
['en', 'en', 'en']
True
zigpy_app_controller
()
Zigpy ApplicationController fixture.
Zigpy ApplicationController fixture.
def zigpy_app_controller(): """Zigpy ApplicationController fixture.""" app = MagicMock(spec_set=ControllerApplication) app.startup = AsyncMock() app.shutdown = AsyncMock() groups = zigpy.group.Groups(app) groups.add_group(FIXTURE_GRP_ID, FIXTURE_GRP_NAME, suppress_event=True) app.configure_m...
[ "def", "zigpy_app_controller", "(", ")", ":", "app", "=", "MagicMock", "(", "spec_set", "=", "ControllerApplication", ")", "app", ".", "startup", "=", "AsyncMock", "(", ")", "app", ".", "shutdown", "=", "AsyncMock", "(", ")", "groups", "=", "zigpy", ".", ...
[ 24, 0 ]
[ 36, 14 ]
python
de
['de', 'nl', 'en']
False
config_entry_fixture
(hass)
Fixture representing a config entry.
Fixture representing a config entry.
async def config_entry_fixture(hass): """Fixture representing a config entry.""" entry = MockConfigEntry( version=2, domain=zha_const.DOMAIN, data={ zigpy.config.CONF_DEVICE: {zigpy.config.CONF_DEVICE_PATH: "/dev/ttyUSB0"}, zha_const.CONF_RADIO_TYPE: "ezsp", ...
[ "async", "def", "config_entry_fixture", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "version", "=", "2", ",", "domain", "=", "zha_const", ".", "DOMAIN", ",", "data", "=", "{", "zigpy", ".", "config", ".", "CONF_DEVICE", ":", "{", "zigpy"...
[ 40, 0 ]
[ 51, 16 ]
python
en
['en', 'en', 'en']
True
setup_zha
(hass, config_entry, zigpy_app_controller)
Set up ZHA component.
Set up ZHA component.
def setup_zha(hass, config_entry, zigpy_app_controller): """Set up ZHA component.""" zha_config = {zha_const.CONF_ENABLE_QUIRKS: False} p1 = patch( "bellows.zigbee.application.ControllerApplication.new", return_value=zigpy_app_controller, ) async def _setup(config=None): co...
[ "def", "setup_zha", "(", "hass", ",", "config_entry", ",", "zigpy_app_controller", ")", ":", "zha_config", "=", "{", "zha_const", ".", "CONF_ENABLE_QUIRKS", ":", "False", "}", "p1", "=", "patch", "(", "\"bellows.zigbee.application.ControllerApplication.new\"", ",", ...
[ 55, 0 ]
[ 73, 17 ]
python
en
['en', 'fr', 'en']
True
channel
()
Channel mock factory fixture.
Channel mock factory fixture.
def channel(): """Channel mock factory fixture.""" def channel(name: str, cluster_id: int, endpoint_id: int = 1): ch = MagicMock() ch.name = name ch.generic_id = f"channel_0x{cluster_id:04x}" ch.id = f"{endpoint_id}:0x{cluster_id:04x}" ch.async_configure = AsyncMock() ...
[ "def", "channel", "(", ")", ":", "def", "channel", "(", "name", ":", "str", ",", "cluster_id", ":", "int", ",", "endpoint_id", ":", "int", "=", "1", ")", ":", "ch", "=", "MagicMock", "(", ")", "ch", ".", "name", "=", "name", "ch", ".", "generic_i...
[ 77, 0 ]
[ 89, 18 ]
python
en
['en', 'fy', 'en']
True
zigpy_device_mock
(zigpy_app_controller)
Make a fake device using the specified cluster classes.
Make a fake device using the specified cluster classes.
def zigpy_device_mock(zigpy_app_controller): """Make a fake device using the specified cluster classes.""" def _mock_dev( endpoints, ieee="00:0d:6f:00:0a:90:69:e7", manufacturer="FakeManufacturer", model="FakeModel", node_descriptor=b"\x02@\x807\x10\x7fd\x00\x00*d\x00\x0...
[ "def", "zigpy_device_mock", "(", "zigpy_app_controller", ")", ":", "def", "_mock_dev", "(", "endpoints", ",", "ieee", "=", "\"00:0d:6f:00:0a:90:69:e7\"", ",", "manufacturer", "=", "\"FakeManufacturer\"", ",", "model", "=", "\"FakeModel\"", ",", "node_descriptor", "=",...
[ 93, 0 ]
[ 126, 20 ]
python
en
['en', 'en', 'en']
True
zha_device_joined
(hass, setup_zha)
Return a newly joined ZHA device.
Return a newly joined ZHA device.
def zha_device_joined(hass, setup_zha): """Return a newly joined ZHA device.""" async def _zha_device(zigpy_dev): await setup_zha() zha_gateway = get_zha_gateway(hass) await zha_gateway.async_device_initialized(zigpy_dev) await hass.async_block_till_done() return zha_gat...
[ "def", "zha_device_joined", "(", "hass", ",", "setup_zha", ")", ":", "async", "def", "_zha_device", "(", "zigpy_dev", ")", ":", "await", "setup_zha", "(", ")", "zha_gateway", "=", "get_zha_gateway", "(", "hass", ")", "await", "zha_gateway", ".", "async_device_...
[ 130, 0 ]
[ 140, 22 ]
python
en
['en', 'en', 'en']
True
zha_device_restored
(hass, zigpy_app_controller, setup_zha, hass_storage)
Return a restored ZHA device.
Return a restored ZHA device.
def zha_device_restored(hass, zigpy_app_controller, setup_zha, hass_storage): """Return a restored ZHA device.""" async def _zha_device(zigpy_dev, last_seen=None): zigpy_app_controller.devices[zigpy_dev.ieee] = zigpy_dev if last_seen is not None: hass_storage[f"{DOMAIN}.storage"] =...
[ "def", "zha_device_restored", "(", "hass", ",", "zigpy_app_controller", ",", "setup_zha", ",", "hass_storage", ")", ":", "async", "def", "_zha_device", "(", "zigpy_dev", ",", "last_seen", "=", "None", ")", ":", "zigpy_app_controller", ".", "devices", "[", "zigpy...
[ 144, 0 ]
[ 169, 22 ]
python
en
['en', 'co', 'en']
True
zha_device_joined_restored
(request)
Join or restore ZHA device.
Join or restore ZHA device.
def zha_device_joined_restored(request): """Join or restore ZHA device.""" named_method = request.getfixturevalue(request.param) named_method.name = request.param return named_method
[ "def", "zha_device_joined_restored", "(", "request", ")", ":", "named_method", "=", "request", ".", "getfixturevalue", "(", "request", ".", "param", ")", "named_method", ".", "name", "=", "request", ".", "param", "return", "named_method" ]
[ 173, 0 ]
[ 177, 23 ]
python
en
['en', 'en', 'en']
True
zha_device_mock
(hass, zigpy_device_mock)
Return a zha Device factory.
Return a zha Device factory.
def zha_device_mock(hass, zigpy_device_mock): """Return a zha Device factory.""" def _zha_device( endpoints=None, ieee="00:11:22:33:44:55:66:77", manufacturer="mock manufacturer", model="mock model", node_desc=b"\x02@\x807\x10\x7fd\x00\x00*d\x00\x00", patch_clust...
[ "def", "zha_device_mock", "(", "hass", ",", "zigpy_device_mock", ")", ":", "def", "_zha_device", "(", "endpoints", "=", "None", ",", "ieee", "=", "\"00:11:22:33:44:55:66:77\"", ",", "manufacturer", "=", "\"mock manufacturer\"", ",", "model", "=", "\"mock model\"", ...
[ 181, 0 ]
[ 211, 22 ]
python
br
['br', 'zh-Latn', 'en']
False
hass_disable_services
(hass)
Mock service register.
Mock service register.
def hass_disable_services(hass): """Mock service register.""" with patch.object(hass.services, "async_register"), patch.object( hass.services, "has_service", return_value=True ): yield hass
[ "def", "hass_disable_services", "(", "hass", ")", ":", "with", "patch", ".", "object", "(", "hass", ".", "services", ",", "\"async_register\"", ")", ",", "patch", ".", "object", "(", "hass", ".", "services", ",", "\"has_service\"", ",", "return_value", "=", ...
[ 215, 0 ]
[ 220, 18 ]
python
en
['en', 'da', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Ombi sensor platform.
Set up the Ombi sensor platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Ombi sensor platform.""" if discovery_info is None: return sensors = [] ombi = hass.data[DOMAIN]["instance"] for sensor in SENSOR_TYPES: sensor_label = sensor sensor_type = SENSOR_TYPES[sens...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "sensors", "=", "[", "]", "ombi", "=", "hass", ".", "data", "[", "DOMAIN", "]", ...
[ 15, 0 ]
[ 30, 31 ]
python
en
['en', 'da', 'en']
True
OmbiSensor.__init__
(self, label, sensor_type, ombi, icon)
Initialize the sensor.
Initialize the sensor.
def __init__(self, label, sensor_type, ombi, icon): """Initialize the sensor.""" self._state = None self._label = label self._type = sensor_type self._ombi = ombi self._icon = icon
[ "def", "__init__", "(", "self", ",", "label", ",", "sensor_type", ",", "ombi", ",", "icon", ")", ":", "self", ".", "_state", "=", "None", "self", ".", "_label", "=", "label", "self", ".", "_type", "=", "sensor_type", "self", ".", "_ombi", "=", "ombi"...
[ 36, 4 ]
[ 42, 25 ]
python
en
['en', 'en', 'en']
True
OmbiSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return f"Ombi {self._type}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"Ombi {self._type}\"" ]
[ 45, 4 ]
[ 47, 35 ]
python
en
['en', 'mi', 'en']
True
OmbiSensor.icon
(self)
Return the icon to use in the frontend.
Return the icon to use in the frontend.
def icon(self): """Return the icon to use in the frontend.""" return self._icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_icon" ]
[ 50, 4 ]
[ 52, 25 ]
python
en
['en', 'en', 'en']
True
OmbiSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 55, 4 ]
[ 57, 26 ]
python
en
['en', 'en', 'en']
True
OmbiSensor.update
(self)
Update the sensor.
Update the sensor.
def update(self): """Update the sensor.""" try: if self._label == "movies": self._state = self._ombi.movie_requests elif self._label == "tv": self._state = self._ombi.tv_requests elif self._label == "music": self._state ...
[ "def", "update", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_label", "==", "\"movies\"", ":", "self", ".", "_state", "=", "self", ".", "_ombi", ".", "movie_requests", "elif", "self", ".", "_label", "==", "\"tv\"", ":", "self", ".", "_stat...
[ 59, 4 ]
[ 76, 30 ]
python
en
['en', 'nl', 'en']
True
device_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def device_reg(hass): """Return an empty, loaded, registry.""" return mock_device_registry(hass)
[ "def", "device_reg", "(", "hass", ")", ":", "return", "mock_device_registry", "(", "hass", ")" ]
[ 24, 0 ]
[ 26, 37 ]
python
en
['en', 'fy', 'en']
True
entity_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def entity_reg(hass): """Return an empty, loaded, registry.""" return mock_registry(hass)
[ "def", "entity_reg", "(", "hass", ")", ":", "return", "mock_registry", "(", "hass", ")" ]
[ 30, 0 ]
[ 32, 30 ]
python
en
['en', 'fy', 'en']
True
calls
(hass)
Track calls to a mock service.
Track calls to a mock service.
def calls(hass): """Track calls to a mock service.""" return async_mock_service(hass, "test", "automation")
[ "def", "calls", "(", "hass", ")", ":", "return", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")" ]
[ 36, 0 ]
[ 38, 57 ]
python
en
['en', 'en', 'en']
True
test_get_conditions
(hass, device_reg, entity_reg)
Test we get the expected conditions from a light.
Test we get the expected conditions from a light.
async def test_get_conditions(hass, device_reg, entity_reg): """Test we get the expected conditions from a light.""" config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_hass(hass) device_entry = device_reg.async_get_or_create( config_entry_id=config_entry.entry_id, ...
[ "async", "def", "test_get_conditions", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "}", ")", "config_entry", ".", "add_to_hass", "(", "hass", ")",...
[ 41, 0 ]
[ 67, 44 ]
python
en
['en', 'en', 'en']
True
test_get_condition_capabilities
(hass, device_reg, entity_reg)
Test we get the expected capabilities from a light condition.
Test we get the expected capabilities from a light condition.
async def test_get_condition_capabilities(hass, device_reg, entity_reg): """Test we get the expected capabilities from a light condition.""" config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_hass(hass) device_entry = device_reg.async_get_or_create( config_entry_id=config...
[ "async", "def", "test_get_condition_capabilities", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "}", ")", "config_entry", ".", "add_to_hass", "(", "h...
[ 70, 0 ]
[ 89, 52 ]
python
en
['en', 'en', 'en']
True
test_if_state
(hass, calls)
Test for turn_on and turn_off conditions.
Test for turn_on and turn_off conditions.
async def test_if_state(hass, calls): """Test for turn_on and turn_off conditions.""" platform = getattr(hass.components, f"test.{DOMAIN}") platform.init() assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}}) await hass.async_block_till_done() ent1, ent2, ent3 = ...
[ "async", "def", "test_if_state", "(", "hass", ",", "calls", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "f\"test.{DOMAIN}\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_component", "(", "hass", ",",...
[ 92, 0 ]
[ 163, 64 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_for_condition
(hass, calls)
Test for firing if condition is on with delay.
Test for firing if condition is on with delay.
async def test_if_fires_on_for_condition(hass, calls): """Test for firing if condition is on with delay.""" point1 = dt_util.utcnow() point2 = point1 + timedelta(seconds=10) point3 = point2 + timedelta(seconds=10) platform = getattr(hass.components, f"test.{DOMAIN}") platform.init() assert...
[ "async", "def", "test_if_fires_on_for_condition", "(", "hass", ",", "calls", ")", ":", "point1", "=", "dt_util", ".", "utcnow", "(", ")", "point2", "=", "point1", "+", "timedelta", "(", "seconds", "=", "10", ")", "point3", "=", "point2", "+", "timedelta", ...
[ 166, 0 ]
[ 234, 68 ]
python
en
['en', 'en', 'en']
True
test_auth_setup
(hass)
Test auth setup for client registration.
Test auth setup for client registration.
async def test_auth_setup(hass): """Test auth setup for client registration.""" config = {HMIPC_HAPID: "ABC123", HMIPC_PIN: "123", HMIPC_NAME: "hmip"} hmip_auth = HomematicipAuth(hass, config) with patch.object(hmip_auth, "get_auth"): assert await hmip_auth.async_setup()
[ "async", "def", "test_auth_setup", "(", "hass", ")", ":", "config", "=", "{", "HMIPC_HAPID", ":", "\"ABC123\"", ",", "HMIPC_PIN", ":", "\"123\"", ",", "HMIPC_NAME", ":", "\"hmip\"", "}", "hmip_auth", "=", "HomematicipAuth", "(", "hass", ",", "config", ")", ...
[ 26, 0 ]
[ 31, 44 ]
python
en
['en', 'fr', 'en']
True
test_auth_setup_connection_error
(hass)
Test auth setup connection error behaviour.
Test auth setup connection error behaviour.
async def test_auth_setup_connection_error(hass): """Test auth setup connection error behaviour.""" config = {HMIPC_HAPID: "ABC123", HMIPC_PIN: "123", HMIPC_NAME: "hmip"} hmip_auth = HomematicipAuth(hass, config) with patch.object(hmip_auth, "get_auth", side_effect=HmipcConnectionError): assert ...
[ "async", "def", "test_auth_setup_connection_error", "(", "hass", ")", ":", "config", "=", "{", "HMIPC_HAPID", ":", "\"ABC123\"", ",", "HMIPC_PIN", ":", "\"123\"", ",", "HMIPC_NAME", ":", "\"hmip\"", "}", "hmip_auth", "=", "HomematicipAuth", "(", "hass", ",", "...
[ 34, 0 ]
[ 39, 48 ]
python
en
['en', 'fr', 'en']
True
test_auth_auth_check_and_register
(hass)
Test auth client registration.
Test auth client registration.
async def test_auth_auth_check_and_register(hass): """Test auth client registration.""" config = {HMIPC_HAPID: "ABC123", HMIPC_PIN: "123", HMIPC_NAME: "hmip"} hmip_auth = HomematicipAuth(hass, config) hmip_auth.auth = Mock(spec=AsyncAuth) with patch.object( hmip_auth.auth, "isRequestAcknowl...
[ "async", "def", "test_auth_auth_check_and_register", "(", "hass", ")", ":", "config", "=", "{", "HMIPC_HAPID", ":", "\"ABC123\"", ",", "HMIPC_PIN", ":", "\"123\"", ",", "HMIPC_NAME", ":", "\"hmip\"", "}", "hmip_auth", "=", "HomematicipAuth", "(", "hass", ",", ...
[ 42, 0 ]
[ 56, 56 ]
python
de
['de', 'fr', 'en']
False
test_auth_auth_check_and_register_with_exception
(hass)
Test auth client registration.
Test auth client registration.
async def test_auth_auth_check_and_register_with_exception(hass): """Test auth client registration.""" config = {HMIPC_HAPID: "ABC123", HMIPC_PIN: "123", HMIPC_NAME: "hmip"} hmip_auth = HomematicipAuth(hass, config) hmip_auth.auth = Mock(spec=AsyncAuth) with patch.object( hmip_auth.auth, "is...
[ "async", "def", "test_auth_auth_check_and_register_with_exception", "(", "hass", ")", ":", "config", "=", "{", "HMIPC_HAPID", ":", "\"ABC123\"", ",", "HMIPC_PIN", ":", "\"123\"", ",", "HMIPC_NAME", ":", "\"hmip\"", "}", "hmip_auth", "=", "HomematicipAuth", "(", "h...
[ 59, 0 ]
[ 70, 56 ]
python
de
['de', 'fr', 'en']
False
test_hap_setup_works
()
Test a successful setup of a accesspoint.
Test a successful setup of a accesspoint.
async def test_hap_setup_works(): """Test a successful setup of a accesspoint.""" hass = Mock() entry = Mock() home = Mock() entry.data = {HMIPC_HAPID: "ABC123", HMIPC_AUTHTOKEN: "123", HMIPC_NAME: "hmip"} hap = HomematicipHAP(hass, entry) with patch.object(hap, "get_hap", return_value=home)...
[ "async", "def", "test_hap_setup_works", "(", ")", ":", "hass", "=", "Mock", "(", ")", "entry", "=", "Mock", "(", ")", "home", "=", "Mock", "(", ")", "entry", ".", "data", "=", "{", "HMIPC_HAPID", ":", "\"ABC123\"", ",", "HMIPC_AUTHTOKEN", ":", "\"123\"...
[ 73, 0 ]
[ 92, 5 ]
python
en
['en', 'en', 'en']
True
test_hap_setup_connection_error
()
Test a failed accesspoint setup.
Test a failed accesspoint setup.
async def test_hap_setup_connection_error(): """Test a failed accesspoint setup.""" hass = Mock() entry = Mock() entry.data = {HMIPC_HAPID: "ABC123", HMIPC_AUTHTOKEN: "123", HMIPC_NAME: "hmip"} hap = HomematicipHAP(hass, entry) with patch.object(hap, "get_hap", side_effect=HmipcConnectionError),...
[ "async", "def", "test_hap_setup_connection_error", "(", ")", ":", "hass", "=", "Mock", "(", ")", "entry", "=", "Mock", "(", ")", "entry", ".", "data", "=", "{", "HMIPC_HAPID", ":", "\"ABC123\"", ",", "HMIPC_AUTHTOKEN", ":", "\"123\"", ",", "HMIPC_NAME", ":...
[ 95, 0 ]
[ 107, 61 ]
python
en
['en', 'ga', 'en']
True
test_hap_reset_unloads_entry_if_setup
(hass, default_mock_hap_factory)
Test calling reset while the entry has been setup.
Test calling reset while the entry has been setup.
async def test_hap_reset_unloads_entry_if_setup(hass, default_mock_hap_factory): """Test calling reset while the entry has been setup.""" mock_hap = await default_mock_hap_factory.async_get_mock_hap() assert hass.data[HMIPC_DOMAIN][HAPID] == mock_hap config_entries = hass.config_entries.async_entries(HM...
[ "async", "def", "test_hap_reset_unloads_entry_if_setup", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "mock_hap", "=", "await", "default_mock_hap_factory", ".", "async_get_mock_hap", "(", ")", "assert", "hass", ".", "data", "[", "HMIPC_DOMAIN", "]", "[", ...
[ 110, 0 ]
[ 120, 40 ]
python
en
['en', 'en', 'en']
True
test_hap_create
(hass, hmip_config_entry, simple_mock_home)
Mock AsyncHome to execute get_hap.
Mock AsyncHome to execute get_hap.
async def test_hap_create(hass, hmip_config_entry, simple_mock_home): """Mock AsyncHome to execute get_hap.""" hass.config.components.add(HMIPC_DOMAIN) hap = HomematicipHAP(hass, hmip_config_entry) assert hap with patch.object(hap, "async_connect"): assert await hap.async_setup()
[ "async", "def", "test_hap_create", "(", "hass", ",", "hmip_config_entry", ",", "simple_mock_home", ")", ":", "hass", ".", "config", ".", "components", ".", "add", "(", "HMIPC_DOMAIN", ")", "hap", "=", "HomematicipHAP", "(", "hass", ",", "hmip_config_entry", ")...
[ 123, 0 ]
[ 129, 38 ]
python
en
['en', 'en', 'en']
True
test_hap_create_exception
(hass, hmip_config_entry, mock_connection_init)
Mock AsyncHome to execute get_hap.
Mock AsyncHome to execute get_hap.
async def test_hap_create_exception(hass, hmip_config_entry, mock_connection_init): """Mock AsyncHome to execute get_hap.""" hass.config.components.add(HMIPC_DOMAIN) hap = HomematicipHAP(hass, hmip_config_entry) assert hap with patch( "homeassistant.components.homematicip_cloud.hap.AsyncHo...
[ "async", "def", "test_hap_create_exception", "(", "hass", ",", "hmip_config_entry", ",", "mock_connection_init", ")", ":", "hass", ".", "config", ".", "components", ".", "add", "(", "HMIPC_DOMAIN", ")", "hap", "=", "HomematicipHAP", "(", "hass", ",", "hmip_confi...
[ 132, 0 ]
[ 149, 31 ]
python
en
['en', 'en', 'en']
True
test_auth_create
(hass, simple_mock_auth)
Mock AsyncAuth to execute get_auth.
Mock AsyncAuth to execute get_auth.
async def test_auth_create(hass, simple_mock_auth): """Mock AsyncAuth to execute get_auth.""" config = {HMIPC_HAPID: HAPID, HMIPC_PIN: HAPPIN, HMIPC_NAME: "hmip"} hmip_auth = HomematicipAuth(hass, config) assert hmip_auth with patch( "homeassistant.components.homematicip_cloud.hap.AsyncAuth...
[ "async", "def", "test_auth_create", "(", "hass", ",", "simple_mock_auth", ")", ":", "config", "=", "{", "HMIPC_HAPID", ":", "HAPID", ",", "HMIPC_PIN", ":", "HAPPIN", ",", "HMIPC_NAME", ":", "\"hmip\"", "}", "hmip_auth", "=", "HomematicipAuth", "(", "hass", "...
[ 152, 0 ]
[ 164, 43 ]
python
en
['en', 'en', 'en']
True
test_auth_create_exception
(hass, simple_mock_auth)
Mock AsyncAuth to execute get_auth.
Mock AsyncAuth to execute get_auth.
async def test_auth_create_exception(hass, simple_mock_auth): """Mock AsyncAuth to execute get_auth.""" config = {HMIPC_HAPID: HAPID, HMIPC_PIN: HAPPIN, HMIPC_NAME: "hmip"} hmip_auth = HomematicipAuth(hass, config) simple_mock_auth.connectionRequest.side_effect = HmipConnectionError assert hmip_auth...
[ "async", "def", "test_auth_create_exception", "(", "hass", ",", "simple_mock_auth", ")", ":", "config", "=", "{", "HMIPC_HAPID", ":", "HAPID", ",", "HMIPC_PIN", ":", "HAPPIN", ",", "HMIPC_NAME", ":", "\"hmip\"", "}", "hmip_auth", "=", "HomematicipAuth", "(", "...
[ 167, 0 ]
[ 183, 64 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up Abode lock devices.
Set up Abode lock devices.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up Abode lock devices.""" data = hass.data[DOMAIN] entities = [] for device in data.abode.get_devices(generic_type=CONST.TYPE_LOCK): entities.append(AbodeLock(data, device)) async_add_entities(entities)
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "entities", "=", "[", "]", "for", "device", "in", "data", ".", "abode", ".", "get_devices", ...
[ 9, 0 ]
[ 18, 32 ]
python
en
['es', 'en', 'en']
True
AbodeLock.lock
(self, **kwargs)
Lock the device.
Lock the device.
def lock(self, **kwargs): """Lock the device.""" self._device.lock()
[ "def", "lock", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_device", ".", "lock", "(", ")" ]
[ 24, 4 ]
[ 26, 27 ]
python
en
['en', 'en', 'en']
True
AbodeLock.unlock
(self, **kwargs)
Unlock the device.
Unlock the device.
def unlock(self, **kwargs): """Unlock the device.""" self._device.unlock()
[ "def", "unlock", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_device", ".", "unlock", "(", ")" ]
[ 28, 4 ]
[ 30, 29 ]
python
en
['en', 'zh', 'en']
True
AbodeLock.is_locked
(self)
Return true if device is on.
Return true if device is on.
def is_locked(self): """Return true if device is on.""" return self._device.is_locked
[ "def", "is_locked", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "is_locked" ]
[ 33, 4 ]
[ 35, 37 ]
python
en
['en', 'fy', 'en']
True
async_setup_entry
( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities )
Set up OVO Energy sensor based on a config entry.
Set up OVO Energy sensor based on a config entry.
async def async_setup_entry( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities ) -> None: """Set up OVO Energy sensor based on a config entry.""" coordinator: DataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][ DATA_COORDINATOR ] client: OVOEnergy = hass.data[DOMAIN][ent...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ")", "->", "None", ":", "coordinator", ":", "DataUpdateCoordinator", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "en...
[ 17, 0 ]
[ 55, 5 ]
python
en
['en', 'en', 'en']
True
OVOEnergySensor.__init__
( self, coordinator: DataUpdateCoordinator, client: OVOEnergy, key: str, name: str, icon: str, unit_of_measurement: str = "", )
Initialize OVO Energy sensor.
Initialize OVO Energy sensor.
def __init__( self, coordinator: DataUpdateCoordinator, client: OVOEnergy, key: str, name: str, icon: str, unit_of_measurement: str = "", ) -> None: """Initialize OVO Energy sensor.""" self._unit_of_measurement = unit_of_measurement su...
[ "def", "__init__", "(", "self", ",", "coordinator", ":", "DataUpdateCoordinator", ",", "client", ":", "OVOEnergy", ",", "key", ":", "str", ",", "name", ":", "str", ",", "icon", ":", "str", ",", "unit_of_measurement", ":", "str", "=", "\"\"", ",", ")", ...
[ 61, 4 ]
[ 73, 62 ]
python
hu
['hu', 'pt', 'it']
False
OVOEnergySensor.unit_of_measurement
(self)
Return the unit this state is expressed in.
Return the unit this state is expressed in.
def unit_of_measurement(self) -> str: """Return the unit this state is expressed in.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 76, 4 ]
[ 78, 40 ]
python
en
['en', 'en', 'en']
True
OVOEnergyLastElectricityReading.__init__
(self, coordinator: DataUpdateCoordinator, client: OVOEnergy)
Initialize OVO Energy sensor.
Initialize OVO Energy sensor.
def __init__(self, coordinator: DataUpdateCoordinator, client: OVOEnergy): """Initialize OVO Energy sensor.""" super().__init__( coordinator, client, f"{client.account_id}_last_electricity_reading", "OVO Last Electricity Reading", "mdi:flash",...
[ "def", "__init__", "(", "self", ",", "coordinator", ":", "DataUpdateCoordinator", ",", "client", ":", "OVOEnergy", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ",", "client", ",", "f\"{client.account_id}_last_electricity_reading\"", ",", "\"OV...
[ 84, 4 ]
[ 94, 9 ]
python
hu
['hu', 'pt', 'it']
False
OVOEnergyLastElectricityReading.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self) -> str: """Return the state of the sensor.""" usage: OVODailyUsage = self.coordinator.data if usage is None or not usage.electricity: return None return usage.electricity[-1].consumption
[ "def", "state", "(", "self", ")", "->", "str", ":", "usage", ":", "OVODailyUsage", "=", "self", ".", "coordinator", ".", "data", "if", "usage", "is", "None", "or", "not", "usage", ".", "electricity", ":", "return", "None", "return", "usage", ".", "elec...
[ 97, 4 ]
[ 102, 48 ]
python
en
['en', 'en', 'en']
True