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
FluxSwitch.find_start_time
(self, now)
Return sunrise or start_time if given.
Return sunrise or start_time if given.
def find_start_time(self, now): """Return sunrise or start_time if given.""" if self._start_time: sunrise = now.replace( hour=self._start_time.hour, minute=self._start_time.minute, second=0 ) else: sunrise = get_astral_event_date(self.hass, SUN...
[ "def", "find_start_time", "(", "self", ",", "now", ")", ":", "if", "self", ".", "_start_time", ":", "sunrise", "=", "now", ".", "replace", "(", "hour", "=", "self", ".", "_start_time", ".", "hour", ",", "minute", "=", "self", ".", "_start_time", ".", ...
[ 343, 4 ]
[ 351, 22 ]
python
en
['en', 'en', 'en']
True
FluxSwitch.find_stop_time
(self, now)
Return dusk or stop_time if given.
Return dusk or stop_time if given.
def find_stop_time(self, now): """Return dusk or stop_time if given.""" if self._stop_time: dusk = now.replace( hour=self._stop_time.hour, minute=self._stop_time.minute, second=0 ) else: dusk = get_astral_event_date(self.hass, "dusk", now.date(...
[ "def", "find_stop_time", "(", "self", ",", "now", ")", ":", "if", "self", ".", "_stop_time", ":", "dusk", "=", "now", ".", "replace", "(", "hour", "=", "self", ".", "_stop_time", ".", "hour", ",", "minute", "=", "self", ".", "_stop_time", ".", "minut...
[ 353, 4 ]
[ 361, 19 ]
python
en
['en', 'en', 'en']
True
get_controller
( hass, host, username, password, port, site, verify_ssl, async_callback=None )
Create a controller object and verify authentication.
Create a controller object and verify authentication.
async def get_controller( hass, host, username, password, port, site, verify_ssl, async_callback=None ): """Create a controller object and verify authentication.""" sslcontext = None if verify_ssl: session = aiohttp_client.async_get_clientsession(hass) if isinstance(verify_ssl, str): ...
[ "async", "def", "get_controller", "(", "hass", ",", "host", ",", "username", ",", "password", ",", "port", ",", "site", ",", "verify_ssl", ",", "async_callback", "=", "None", ")", ":", "sslcontext", "=", "None", "if", "verify_ssl", ":", "session", "=", "...
[ 430, 0 ]
[ 472, 45 ]
python
en
['en', 'en', 'en']
True
UniFiController.__init__
(self, hass, config_entry)
Initialize the system.
Initialize the system.
def __init__(self, hass, config_entry): """Initialize the system.""" self.hass = hass self.config_entry = config_entry self.available = True self.api = None self.progress = None self.wireless_clients = None self.listeners = [] self._site_name = No...
[ "def", "__init__", "(", "self", ",", "hass", ",", "config_entry", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "config_entry", "=", "config_entry", "self", ".", "available", "=", "True", "self", ".", "api", "=", "None", "self", ".", "progre...
[ 83, 4 ]
[ 96, 26 ]
python
en
['en', 'en', 'en']
True
UniFiController.controller_id
(self)
Return the controller ID.
Return the controller ID.
def controller_id(self): """Return the controller ID.""" return CONTROLLER_ID.format(host=self.host, site=self.site)
[ "def", "controller_id", "(", "self", ")", ":", "return", "CONTROLLER_ID", ".", "format", "(", "host", "=", "self", ".", "host", ",", "site", "=", "self", ".", "site", ")" ]
[ 99, 4 ]
[ 101, 67 ]
python
en
['en', 'en', 'en']
True
UniFiController.host
(self)
Return the host of this controller.
Return the host of this controller.
def host(self): """Return the host of this controller.""" return self.config_entry.data[CONF_CONTROLLER][CONF_HOST]
[ "def", "host", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "data", "[", "CONF_CONTROLLER", "]", "[", "CONF_HOST", "]" ]
[ 104, 4 ]
[ 106, 65 ]
python
en
['en', 'en', 'en']
True
UniFiController.site
(self)
Return the site of this config entry.
Return the site of this config entry.
def site(self): """Return the site of this config entry.""" return self.config_entry.data[CONF_CONTROLLER][CONF_SITE_ID]
[ "def", "site", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "data", "[", "CONF_CONTROLLER", "]", "[", "CONF_SITE_ID", "]" ]
[ 109, 4 ]
[ 111, 68 ]
python
en
['en', 'en', 'en']
True
UniFiController.site_name
(self)
Return the nice name of site.
Return the nice name of site.
def site_name(self): """Return the nice name of site.""" return self._site_name
[ "def", "site_name", "(", "self", ")", ":", "return", "self", ".", "_site_name" ]
[ 114, 4 ]
[ 116, 30 ]
python
en
['en', 'en', 'en']
True
UniFiController.site_role
(self)
Return the site user role of this controller.
Return the site user role of this controller.
def site_role(self): """Return the site user role of this controller.""" return self._site_role
[ "def", "site_role", "(", "self", ")", ":", "return", "self", ".", "_site_role" ]
[ 119, 4 ]
[ 121, 30 ]
python
en
['en', 'en', 'en']
True
UniFiController.mac
(self)
Return the mac address of this controller.
Return the mac address of this controller.
def mac(self): """Return the mac address of this controller.""" for client in self.api.clients.values(): if self.host == client.ip: return client.mac return None
[ "def", "mac", "(", "self", ")", ":", "for", "client", "in", "self", ".", "api", ".", "clients", ".", "values", "(", ")", ":", "if", "self", ".", "host", "==", "client", ".", "ip", ":", "return", "client", ".", "mac", "return", "None" ]
[ 124, 4 ]
[ 129, 19 ]
python
en
['en', 'en', 'en']
True
UniFiController.option_track_clients
(self)
Config entry option to not track clients.
Config entry option to not track clients.
def option_track_clients(self): """Config entry option to not track clients.""" return self.config_entry.options.get(CONF_TRACK_CLIENTS, DEFAULT_TRACK_CLIENTS)
[ "def", "option_track_clients", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "options", ".", "get", "(", "CONF_TRACK_CLIENTS", ",", "DEFAULT_TRACK_CLIENTS", ")" ]
[ 134, 4 ]
[ 136, 87 ]
python
en
['en', 'en', 'en']
True
UniFiController.option_track_wired_clients
(self)
Config entry option to not track wired clients.
Config entry option to not track wired clients.
def option_track_wired_clients(self): """Config entry option to not track wired clients.""" return self.config_entry.options.get( CONF_TRACK_WIRED_CLIENTS, DEFAULT_TRACK_WIRED_CLIENTS )
[ "def", "option_track_wired_clients", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "options", ".", "get", "(", "CONF_TRACK_WIRED_CLIENTS", ",", "DEFAULT_TRACK_WIRED_CLIENTS", ")" ]
[ 139, 4 ]
[ 143, 9 ]
python
en
['en', 'en', 'en']
True
UniFiController.option_track_devices
(self)
Config entry option to not track devices.
Config entry option to not track devices.
def option_track_devices(self): """Config entry option to not track devices.""" return self.config_entry.options.get(CONF_TRACK_DEVICES, DEFAULT_TRACK_DEVICES)
[ "def", "option_track_devices", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "options", ".", "get", "(", "CONF_TRACK_DEVICES", ",", "DEFAULT_TRACK_DEVICES", ")" ]
[ 146, 4 ]
[ 148, 87 ]
python
en
['en', 'en', 'en']
True
UniFiController.option_ssid_filter
(self)
Config entry option listing what SSIDs are being used to track clients.
Config entry option listing what SSIDs are being used to track clients.
def option_ssid_filter(self): """Config entry option listing what SSIDs are being used to track clients.""" return self.config_entry.options.get(CONF_SSID_FILTER, [])
[ "def", "option_ssid_filter", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "options", ".", "get", "(", "CONF_SSID_FILTER", ",", "[", "]", ")" ]
[ 151, 4 ]
[ 153, 66 ]
python
en
['en', 'en', 'en']
True
UniFiController.option_detection_time
(self)
Config entry option defining number of seconds from last seen to away.
Config entry option defining number of seconds from last seen to away.
def option_detection_time(self): """Config entry option defining number of seconds from last seen to away.""" return timedelta( seconds=self.config_entry.options.get( CONF_DETECTION_TIME, DEFAULT_DETECTION_TIME ) )
[ "def", "option_detection_time", "(", "self", ")", ":", "return", "timedelta", "(", "seconds", "=", "self", ".", "config_entry", ".", "options", ".", "get", "(", "CONF_DETECTION_TIME", ",", "DEFAULT_DETECTION_TIME", ")", ")" ]
[ 156, 4 ]
[ 162, 9 ]
python
en
['en', 'en', 'en']
True
UniFiController.option_ignore_wired_bug
(self)
Config entry option to ignore wired bug.
Config entry option to ignore wired bug.
def option_ignore_wired_bug(self): """Config entry option to ignore wired bug.""" return self.config_entry.options.get( CONF_IGNORE_WIRED_BUG, DEFAULT_IGNORE_WIRED_BUG )
[ "def", "option_ignore_wired_bug", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "options", ".", "get", "(", "CONF_IGNORE_WIRED_BUG", ",", "DEFAULT_IGNORE_WIRED_BUG", ")" ]
[ 165, 4 ]
[ 169, 9 ]
python
en
['en', 'en', 'en']
True
UniFiController.option_poe_clients
(self)
Config entry option to control poe clients.
Config entry option to control poe clients.
def option_poe_clients(self): """Config entry option to control poe clients.""" return self.config_entry.options.get(CONF_POE_CLIENTS, DEFAULT_POE_CLIENTS)
[ "def", "option_poe_clients", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "options", ".", "get", "(", "CONF_POE_CLIENTS", ",", "DEFAULT_POE_CLIENTS", ")" ]
[ 174, 4 ]
[ 176, 83 ]
python
en
['en', 'en', 'en']
True
UniFiController.option_block_clients
(self)
Config entry option with list of clients to control network access.
Config entry option with list of clients to control network access.
def option_block_clients(self): """Config entry option with list of clients to control network access.""" return self.config_entry.options.get(CONF_BLOCK_CLIENT, [])
[ "def", "option_block_clients", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "options", ".", "get", "(", "CONF_BLOCK_CLIENT", ",", "[", "]", ")" ]
[ 179, 4 ]
[ 181, 67 ]
python
en
['en', 'en', 'en']
True
UniFiController.option_dpi_restrictions
(self)
Config entry option to control DPI restriction groups.
Config entry option to control DPI restriction groups.
def option_dpi_restrictions(self): """Config entry option to control DPI restriction groups.""" return self.config_entry.options.get( CONF_DPI_RESTRICTIONS, DEFAULT_DPI_RESTRICTIONS )
[ "def", "option_dpi_restrictions", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "options", ".", "get", "(", "CONF_DPI_RESTRICTIONS", ",", "DEFAULT_DPI_RESTRICTIONS", ")" ]
[ 184, 4 ]
[ 188, 9 ]
python
en
['en', 'en', 'en']
True
UniFiController.option_allow_bandwidth_sensors
(self)
Config entry option to allow bandwidth sensors.
Config entry option to allow bandwidth sensors.
def option_allow_bandwidth_sensors(self): """Config entry option to allow bandwidth sensors.""" return self.config_entry.options.get( CONF_ALLOW_BANDWIDTH_SENSORS, DEFAULT_ALLOW_BANDWIDTH_SENSORS )
[ "def", "option_allow_bandwidth_sensors", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "options", ".", "get", "(", "CONF_ALLOW_BANDWIDTH_SENSORS", ",", "DEFAULT_ALLOW_BANDWIDTH_SENSORS", ")" ]
[ 193, 4 ]
[ 197, 9 ]
python
en
['en', 'en', 'en']
True
UniFiController.option_allow_uptime_sensors
(self)
Config entry option to allow uptime sensors.
Config entry option to allow uptime sensors.
def option_allow_uptime_sensors(self): """Config entry option to allow uptime sensors.""" return self.config_entry.options.get( CONF_ALLOW_UPTIME_SENSORS, DEFAULT_ALLOW_UPTIME_SENSORS )
[ "def", "option_allow_uptime_sensors", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "options", ".", "get", "(", "CONF_ALLOW_UPTIME_SENSORS", ",", "DEFAULT_ALLOW_UPTIME_SENSORS", ")" ]
[ 200, 4 ]
[ 204, 9 ]
python
en
['en', 'en', 'en']
True
UniFiController.async_unifi_signalling_callback
(self, signal, data)
Handle messages back from UniFi library.
Handle messages back from UniFi library.
def async_unifi_signalling_callback(self, signal, data): """Handle messages back from UniFi library.""" if signal == SIGNAL_CONNECTION_STATE: if data == STATE_DISCONNECTED and self.available: LOGGER.warning("Lost connection to UniFi controller") if (data == STAT...
[ "def", "async_unifi_signalling_callback", "(", "self", ",", "signal", ",", "data", ")", ":", "if", "signal", "==", "SIGNAL_CONNECTION_STATE", ":", "if", "data", "==", "STATE_DISCONNECTED", "and", "self", ".", "available", ":", "LOGGER", ".", "warning", "(", "\...
[ 207, 4 ]
[ 271, 17 ]
python
en
['en', 'en', 'en']
True
UniFiController.signal_reachable
(self)
Integration specific event to signal a change in connection status.
Integration specific event to signal a change in connection status.
def signal_reachable(self) -> str: """Integration specific event to signal a change in connection status.""" return f"unifi-reachable-{self.controller_id}"
[ "def", "signal_reachable", "(", "self", ")", "->", "str", ":", "return", "f\"unifi-reachable-{self.controller_id}\"" ]
[ 274, 4 ]
[ 276, 54 ]
python
en
['en', 'en', 'en']
True
UniFiController.signal_update
(self)
Event specific per UniFi entry to signal new data.
Event specific per UniFi entry to signal new data.
def signal_update(self): """Event specific per UniFi entry to signal new data.""" return f"unifi-update-{self.controller_id}"
[ "def", "signal_update", "(", "self", ")", ":", "return", "f\"unifi-update-{self.controller_id}\"" ]
[ 279, 4 ]
[ 281, 51 ]
python
en
['en', 'en', 'it']
True
UniFiController.signal_remove
(self)
Event specific per UniFi entry to signal removal of entities.
Event specific per UniFi entry to signal removal of entities.
def signal_remove(self): """Event specific per UniFi entry to signal removal of entities.""" return f"unifi-remove-{self.controller_id}"
[ "def", "signal_remove", "(", "self", ")", ":", "return", "f\"unifi-remove-{self.controller_id}\"" ]
[ 284, 4 ]
[ 286, 51 ]
python
en
['en', 'en', 'en']
True
UniFiController.signal_options_update
(self)
Event specific per UniFi entry to signal new options.
Event specific per UniFi entry to signal new options.
def signal_options_update(self): """Event specific per UniFi entry to signal new options.""" return f"unifi-options-{self.controller_id}"
[ "def", "signal_options_update", "(", "self", ")", ":", "return", "f\"unifi-options-{self.controller_id}\"" ]
[ 289, 4 ]
[ 291, 52 ]
python
en
['en', 'en', 'en']
True
UniFiController.update_wireless_clients
(self)
Update set of known to be wireless clients.
Update set of known to be wireless clients.
def update_wireless_clients(self): """Update set of known to be wireless clients.""" new_wireless_clients = set() for client_id in self.api.clients: if ( client_id not in self.wireless_clients and not self.api.clients[client_id].is_wired )...
[ "def", "update_wireless_clients", "(", "self", ")", ":", "new_wireless_clients", "=", "set", "(", ")", "for", "client_id", "in", "self", ".", "api", ".", "clients", ":", "if", "(", "client_id", "not", "in", "self", ".", "wireless_clients", "and", "not", "s...
[ 293, 4 ]
[ 307, 88 ]
python
en
['en', 'en', 'en']
True
UniFiController.async_setup
(self)
Set up a UniFi controller.
Set up a UniFi controller.
async def async_setup(self): """Set up a UniFi controller.""" try: self.api = await get_controller( self.hass, **self.config_entry.data[CONF_CONTROLLER], async_callback=self.async_unifi_signalling_callback, ) await self....
[ "async", "def", "async_setup", "(", "self", ")", ":", "try", ":", "self", ".", "api", "=", "await", "get_controller", "(", "self", ".", "hass", ",", "*", "*", "self", ".", "config_entry", ".", "data", "[", "CONF_CONTROLLER", "]", ",", "async_callback", ...
[ 309, 4 ]
[ 377, 19 ]
python
en
['en', 'su', 'en']
True
UniFiController.async_config_entry_updated
(hass, config_entry)
Handle signals of config entry being updated.
Handle signals of config entry being updated.
async def async_config_entry_updated(hass, config_entry) -> None: """Handle signals of config entry being updated.""" controller = hass.data[UNIFI_DOMAIN][config_entry.entry_id] async_dispatcher_send(hass, controller.signal_options_update)
[ "async", "def", "async_config_entry_updated", "(", "hass", ",", "config_entry", ")", "->", "None", ":", "controller", "=", "hass", ".", "data", "[", "UNIFI_DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "async_dispatcher_send", "(", "hass", ",", "con...
[ 380, 4 ]
[ 383, 69 ]
python
en
['en', 'en', 'en']
True
UniFiController.reconnect
(self, log=False)
Prepare to reconnect UniFi session.
Prepare to reconnect UniFi session.
def reconnect(self, log=False) -> None: """Prepare to reconnect UniFi session.""" if log: LOGGER.info("Will try to reconnect to UniFi controller") self.hass.loop.create_task(self.async_reconnect())
[ "def", "reconnect", "(", "self", ",", "log", "=", "False", ")", "->", "None", ":", "if", "log", ":", "LOGGER", ".", "info", "(", "\"Will try to reconnect to UniFi controller\"", ")", "self", ".", "hass", ".", "loop", ".", "create_task", "(", "self", ".", ...
[ 386, 4 ]
[ 390, 58 ]
python
en
['en', 'it', 'en']
True
UniFiController.async_reconnect
(self)
Try to reconnect UniFi session.
Try to reconnect UniFi session.
async def async_reconnect(self) -> None: """Try to reconnect UniFi session.""" try: with async_timeout.timeout(5): await self.api.login() self.api.start_websocket() except (asyncio.TimeoutError, aiounifi.AiounifiException): self.hass.loop....
[ "async", "def", "async_reconnect", "(", "self", ")", "->", "None", ":", "try", ":", "with", "async_timeout", ".", "timeout", "(", "5", ")", ":", "await", "self", ".", "api", ".", "login", "(", ")", "self", ".", "api", ".", "start_websocket", "(", ")"...
[ 392, 4 ]
[ 400, 66 ]
python
en
['en', 'en', 'en']
True
UniFiController.shutdown
(self, event)
Wrap the call to unifi.close. Used as an argument to EventBus.async_listen_once.
Wrap the call to unifi.close.
def shutdown(self, event) -> None: """Wrap the call to unifi.close. Used as an argument to EventBus.async_listen_once. """ self.api.stop_websocket()
[ "def", "shutdown", "(", "self", ",", "event", ")", "->", "None", ":", "self", ".", "api", ".", "stop_websocket", "(", ")" ]
[ 403, 4 ]
[ 408, 33 ]
python
en
['en', 'pt', 'en']
True
UniFiController.async_reset
(self)
Reset this controller to default state. Will cancel any scheduled setup retry and will unload the config entry.
Reset this controller to default state.
async def async_reset(self): """Reset this controller to default state. Will cancel any scheduled setup retry and will unload the config entry. """ self.api.stop_websocket() for platform in SUPPORTED_PLATFORMS: await self.hass.config_entries.async_forward_en...
[ "async", "def", "async_reset", "(", "self", ")", ":", "self", ".", "api", ".", "stop_websocket", "(", ")", "for", "platform", "in", "SUPPORTED_PLATFORMS", ":", "await", "self", ".", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "self",...
[ 410, 4 ]
[ 427, 19 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Monoprice 6-zone amplifier platform.
Set up the Monoprice 6-zone amplifier platform.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Monoprice 6-zone amplifier platform.""" port = config_entry.data[CONF_PORT] monoprice = hass.data[DOMAIN][config_entry.entry_id][MONOPRICE_OBJECT] sources = _get_sources(config_entry) entities = [] for i in ran...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "port", "=", "config_entry", ".", "data", "[", "CONF_PORT", "]", "monoprice", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", ...
[ 63, 0 ]
[ 115, 5 ]
python
en
['en', 'cs', 'en']
True
MonopriceZone.__init__
(self, monoprice, sources, namespace, zone_id)
Initialize new zone.
Initialize new zone.
def __init__(self, monoprice, sources, namespace, zone_id): """Initialize new zone.""" self._monoprice = monoprice # dict source_id -> source name self._source_id_name = sources[0] # dict source name -> source_id self._source_name_id = sources[1] # ordered list of...
[ "def", "__init__", "(", "self", ",", "monoprice", ",", "sources", ",", "namespace", ",", "zone_id", ")", ":", "self", ".", "_monoprice", "=", "monoprice", "# dict source_id -> source name", "self", ".", "_source_id_name", "=", "sources", "[", "0", "]", "# dict...
[ 121, 4 ]
[ 139, 35 ]
python
pl
['pl', 'pl', 'en']
True
MonopriceZone.update
(self)
Retrieve latest state.
Retrieve latest state.
def update(self): """Retrieve latest state.""" try: state = self._monoprice.zone_status(self._zone_id) except SerialException: self._update_success = False _LOGGER.warning("Could not update zone %d", self._zone_id) return if not state: ...
[ "def", "update", "(", "self", ")", ":", "try", ":", "state", "=", "self", ".", "_monoprice", ".", "zone_status", "(", "self", ".", "_zone_id", ")", "except", "SerialException", ":", "self", ".", "_update_success", "=", "False", "_LOGGER", ".", "warning", ...
[ 141, 4 ]
[ 161, 31 ]
python
en
['es', 'sk', 'en']
False
MonopriceZone.entity_registry_enabled_default
(self)
Return if the entity should be enabled when first added to the entity registry.
Return if the entity should be enabled when first added to the entity registry.
def entity_registry_enabled_default(self): """Return if the entity should be enabled when first added to the entity registry.""" return self._zone_id < 20 or self._update_success
[ "def", "entity_registry_enabled_default", "(", "self", ")", ":", "return", "self", ".", "_zone_id", "<", "20", "or", "self", ".", "_update_success" ]
[ 164, 4 ]
[ 166, 57 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.device_info
(self)
Return device info for this device.
Return device info for this device.
def device_info(self): """Return device info for this device.""" return { "identifiers": {(DOMAIN, self.unique_id)}, "name": self.name, "manufacturer": "Monoprice", "model": "6-Zone Amplifier", }
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "unique_id", ")", "}", ",", "\"name\"", ":", "self", ".", "name", ",", "\"manufacturer\"", ":", "\"Monoprice\"", ",", "\"model\"", "...
[ 169, 4 ]
[ 176, 9 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.unique_id
(self)
Return unique ID for this device.
Return unique ID for this device.
def unique_id(self): """Return unique ID for this device.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 179, 4 ]
[ 181, 30 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.name
(self)
Return the name of the zone.
Return the name of the zone.
def name(self): """Return the name of the zone.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 184, 4 ]
[ 186, 25 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.state
(self)
Return the state of the zone.
Return the state of the zone.
def state(self): """Return the state of the zone.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 189, 4 ]
[ 191, 26 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.volume_level
(self)
Volume level of the media player (0..1).
Volume level of the media player (0..1).
def volume_level(self): """Volume level of the media player (0..1).""" if self._volume is None: return None return self._volume / 38.0
[ "def", "volume_level", "(", "self", ")", ":", "if", "self", ".", "_volume", "is", "None", ":", "return", "None", "return", "self", ".", "_volume", "/", "38.0" ]
[ 194, 4 ]
[ 198, 34 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.is_volume_muted
(self)
Boolean if volume is currently muted.
Boolean if volume is currently muted.
def is_volume_muted(self): """Boolean if volume is currently muted.""" return self._mute
[ "def", "is_volume_muted", "(", "self", ")", ":", "return", "self", ".", "_mute" ]
[ 201, 4 ]
[ 203, 25 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.supported_features
(self)
Return flag of media commands that are supported.
Return flag of media commands that are supported.
def supported_features(self): """Return flag of media commands that are supported.""" return SUPPORT_MONOPRICE
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_MONOPRICE" ]
[ 206, 4 ]
[ 208, 32 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.media_title
(self)
Return the current source as medial title.
Return the current source as medial title.
def media_title(self): """Return the current source as medial title.""" return self._source
[ "def", "media_title", "(", "self", ")", ":", "return", "self", ".", "_source" ]
[ 211, 4 ]
[ 213, 27 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.source
(self)
Return the current input source of the device.
Return the current input source of the device.
def source(self): """Return the current input source of the device.""" return self._source
[ "def", "source", "(", "self", ")", ":", "return", "self", ".", "_source" ]
[ 216, 4 ]
[ 218, 27 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.source_list
(self)
List of available input sources.
List of available input sources.
def source_list(self): """List of available input sources.""" return self._source_names
[ "def", "source_list", "(", "self", ")", ":", "return", "self", ".", "_source_names" ]
[ 221, 4 ]
[ 223, 33 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.snapshot
(self)
Save zone's current state.
Save zone's current state.
def snapshot(self): """Save zone's current state.""" self._snapshot = self._monoprice.zone_status(self._zone_id)
[ "def", "snapshot", "(", "self", ")", ":", "self", ".", "_snapshot", "=", "self", ".", "_monoprice", ".", "zone_status", "(", "self", ".", "_zone_id", ")" ]
[ 225, 4 ]
[ 227, 67 ]
python
en
['nl', 'en', 'en']
True
MonopriceZone.restore
(self)
Restore saved state.
Restore saved state.
def restore(self): """Restore saved state.""" if self._snapshot: self._monoprice.restore_zone(self._snapshot) self.schedule_update_ha_state(True)
[ "def", "restore", "(", "self", ")", ":", "if", "self", ".", "_snapshot", ":", "self", ".", "_monoprice", ".", "restore_zone", "(", "self", ".", "_snapshot", ")", "self", ".", "schedule_update_ha_state", "(", "True", ")" ]
[ 229, 4 ]
[ 233, 47 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.select_source
(self, source)
Set input source.
Set input source.
def select_source(self, source): """Set input source.""" if source not in self._source_name_id: return idx = self._source_name_id[source] self._monoprice.set_source(self._zone_id, idx)
[ "def", "select_source", "(", "self", ",", "source", ")", ":", "if", "source", "not", "in", "self", ".", "_source_name_id", ":", "return", "idx", "=", "self", ".", "_source_name_id", "[", "source", "]", "self", ".", "_monoprice", ".", "set_source", "(", "...
[ 235, 4 ]
[ 240, 54 ]
python
en
['fr', 'su', 'en']
False
MonopriceZone.turn_on
(self)
Turn the media player on.
Turn the media player on.
def turn_on(self): """Turn the media player on.""" self._monoprice.set_power(self._zone_id, True)
[ "def", "turn_on", "(", "self", ")", ":", "self", ".", "_monoprice", ".", "set_power", "(", "self", ".", "_zone_id", ",", "True", ")" ]
[ 242, 4 ]
[ 244, 54 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.turn_off
(self)
Turn the media player off.
Turn the media player off.
def turn_off(self): """Turn the media player off.""" self._monoprice.set_power(self._zone_id, False)
[ "def", "turn_off", "(", "self", ")", ":", "self", ".", "_monoprice", ".", "set_power", "(", "self", ".", "_zone_id", ",", "False", ")" ]
[ 246, 4 ]
[ 248, 55 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.mute_volume
(self, mute)
Mute (true) or unmute (false) media player.
Mute (true) or unmute (false) media player.
def mute_volume(self, mute): """Mute (true) or unmute (false) media player.""" self._monoprice.set_mute(self._zone_id, mute)
[ "def", "mute_volume", "(", "self", ",", "mute", ")", ":", "self", ".", "_monoprice", ".", "set_mute", "(", "self", ".", "_zone_id", ",", "mute", ")" ]
[ 250, 4 ]
[ 252, 53 ]
python
en
['en', 'la', 'it']
False
MonopriceZone.set_volume_level
(self, volume)
Set volume level, range 0..1.
Set volume level, range 0..1.
def set_volume_level(self, volume): """Set volume level, range 0..1.""" self._monoprice.set_volume(self._zone_id, int(volume * 38))
[ "def", "set_volume_level", "(", "self", ",", "volume", ")", ":", "self", ".", "_monoprice", ".", "set_volume", "(", "self", ".", "_zone_id", ",", "int", "(", "volume", "*", "38", ")", ")" ]
[ 254, 4 ]
[ 256, 67 ]
python
en
['fr', 'zu', 'en']
False
MonopriceZone.volume_up
(self)
Volume up the media player.
Volume up the media player.
def volume_up(self): """Volume up the media player.""" if self._volume is None: return self._monoprice.set_volume(self._zone_id, min(self._volume + 1, 38))
[ "def", "volume_up", "(", "self", ")", ":", "if", "self", ".", "_volume", "is", "None", ":", "return", "self", ".", "_monoprice", ".", "set_volume", "(", "self", ".", "_zone_id", ",", "min", "(", "self", ".", "_volume", "+", "1", ",", "38", ")", ")"...
[ 258, 4 ]
[ 262, 76 ]
python
en
['en', 'en', 'en']
True
MonopriceZone.volume_down
(self)
Volume down media player.
Volume down media player.
def volume_down(self): """Volume down media player.""" if self._volume is None: return self._monoprice.set_volume(self._zone_id, max(self._volume - 1, 0))
[ "def", "volume_down", "(", "self", ")", ":", "if", "self", ".", "_volume", "is", "None", ":", "return", "self", ".", "_monoprice", ".", "set_volume", "(", "self", ".", "_zone_id", ",", "max", "(", "self", ".", "_volume", "-", "1", ",", "0", ")", ")...
[ 264, 4 ]
[ 268, 75 ]
python
en
['en', 'sl', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Discogs sensor.
Set up the Discogs sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Discogs sensor.""" token = config[CONF_TOKEN] name = config[CONF_NAME] try: _discogs_client = discogs_client.Client(SERVER_SOFTWARE, user_token=token) discogs_data = { "user": _discogs_client...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "token", "=", "config", "[", "CONF_TOKEN", "]", "name", "=", "config", "[", "CONF_NAME", "]", "try", ":", "_discogs_client", "=", "disco...
[ 66, 0 ]
[ 88, 31 ]
python
en
['en', 'pt', 'en']
True
DiscogsSensor.__init__
(self, discogs_data, name, sensor_type)
Initialize the Discogs sensor.
Initialize the Discogs sensor.
def __init__(self, discogs_data, name, sensor_type): """Initialize the Discogs sensor.""" self._discogs_data = discogs_data self._name = name self._type = sensor_type self._state = None self._attrs = {}
[ "def", "__init__", "(", "self", ",", "discogs_data", ",", "name", ",", "sensor_type", ")", ":", "self", ".", "_discogs_data", "=", "discogs_data", "self", ".", "_name", "=", "name", "self", ".", "_type", "=", "sensor_type", "self", ".", "_state", "=", "N...
[ 94, 4 ]
[ 100, 24 ]
python
en
['en', 'en', 'en']
True
DiscogsSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return f"{self._name} {SENSORS[self._type]['name']}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self._name} {SENSORS[self._type]['name']}\"" ]
[ 103, 4 ]
[ 105, 60 ]
python
en
['en', 'mi', 'en']
True
DiscogsSensor.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" ]
[ 108, 4 ]
[ 110, 26 ]
python
en
['en', 'en', 'en']
True
DiscogsSensor.icon
(self)
Return the icon to use in the frontend, if any.
Return the icon to use in the frontend, if any.
def icon(self): """Return the icon to use in the frontend, if any.""" return SENSORS[self._type]["icon"]
[ "def", "icon", "(", "self", ")", ":", "return", "SENSORS", "[", "self", ".", "_type", "]", "[", "\"icon\"", "]" ]
[ 113, 4 ]
[ 115, 42 ]
python
en
['en', 'en', 'en']
True
DiscogsSensor.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): """Return the unit this state is expressed in.""" return SENSORS[self._type]["unit_of_measurement"]
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "SENSORS", "[", "self", ".", "_type", "]", "[", "\"unit_of_measurement\"", "]" ]
[ 118, 4 ]
[ 120, 57 ]
python
en
['en', 'en', 'en']
True
DiscogsSensor.device_state_attributes
(self)
Return the device state attributes of the sensor.
Return the device state attributes of the sensor.
def device_state_attributes(self): """Return the device state attributes of the sensor.""" if self._state is None or self._attrs is None: return None if self._type == SENSOR_RANDOM_RECORD_TYPE and self._state is not None: return { "cat_no": self._attrs["l...
[ "def", "device_state_attributes", "(", "self", ")", ":", "if", "self", ".", "_state", "is", "None", "or", "self", ".", "_attrs", "is", "None", ":", "return", "None", "if", "self", ".", "_type", "==", "SENSOR_RANDOM_RECORD_TYPE", "and", "self", ".", "_state...
[ 123, 4 ]
[ 142, 9 ]
python
en
['en', 'en', 'en']
True
DiscogsSensor.get_random_record
(self)
Get a random record suggestion from the user's collection.
Get a random record suggestion from the user's collection.
def get_random_record(self): """Get a random record suggestion from the user's collection.""" # Index 0 in the folders is the 'All' folder collection = self._discogs_data["folders"][0] if collection.count > 0: random_index = random.randrange(collection.count) rand...
[ "def", "get_random_record", "(", "self", ")", ":", "# Index 0 in the folders is the 'All' folder", "collection", "=", "self", ".", "_discogs_data", "[", "\"folders\"", "]", "[", "0", "]", "if", "collection", ".", "count", ">", "0", ":", "random_index", "=", "ran...
[ 144, 4 ]
[ 155, 19 ]
python
en
['en', 'en', 'en']
True
DiscogsSensor.update
(self)
Set state to the amount of records in user's collection.
Set state to the amount of records in user's collection.
def update(self): """Set state to the amount of records in user's collection.""" if self._type == SENSOR_COLLECTION_TYPE: self._state = self._discogs_data["collection_count"] elif self._type == SENSOR_WANTLIST_TYPE: self._state = self._discogs_data["wantlist_count"] ...
[ "def", "update", "(", "self", ")", ":", "if", "self", ".", "_type", "==", "SENSOR_COLLECTION_TYPE", ":", "self", ".", "_state", "=", "self", ".", "_discogs_data", "[", "\"collection_count\"", "]", "elif", "self", ".", "_type", "==", "SENSOR_WANTLIST_TYPE", "...
[ 157, 4 ]
[ 164, 50 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, entry, async_add_entities)
Set up Neato camera with config entry.
Set up Neato camera with config entry.
async def async_setup_entry(hass, entry, async_add_entities): """Set up Neato camera with config entry.""" dev = [] neato = hass.data.get(NEATO_LOGIN) mapdata = hass.data.get(NEATO_MAP_DATA) for robot in hass.data[NEATO_ROBOTS]: if "maps" in robot.traits: dev.append(NeatoCleaning...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ",", "async_add_entities", ")", ":", "dev", "=", "[", "]", "neato", "=", "hass", ".", "data", ".", "get", "(", "NEATO_LOGIN", ")", "mapdata", "=", "hass", ".", "data", ".", "get", "(", "...
[ 22, 0 ]
[ 35, 33 ]
python
en
['en', 'en', 'en']
True
NeatoCleaningMap.__init__
(self, neato, robot, mapdata)
Initialize Neato cleaning map.
Initialize Neato cleaning map.
def __init__(self, neato, robot, mapdata): """Initialize Neato cleaning map.""" super().__init__() self.robot = robot self.neato = neato self._mapdata = mapdata self._available = self.neato.logged_in if self.neato is not None else False self._robot_name = f"{self....
[ "def", "__init__", "(", "self", ",", "neato", ",", "robot", ",", "mapdata", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "robot", "=", "robot", "self", ".", "neato", "=", "neato", "self", ".", "_mapdata", "=", "mapdata", "se...
[ 41, 4 ]
[ 52, 26 ]
python
en
['it', 'en', 'en']
True
NeatoCleaningMap.camera_image
(self)
Return image response.
Return image response.
def camera_image(self): """Return image response.""" self.update() return self._image
[ "def", "camera_image", "(", "self", ")", ":", "self", ".", "update", "(", ")", "return", "self", ".", "_image" ]
[ 54, 4 ]
[ 57, 26 ]
python
en
['en', 'jv', 'en']
True
NeatoCleaningMap.update
(self)
Check the contents of the map list.
Check the contents of the map list.
def update(self): """Check the contents of the map list.""" if self.neato is None: _LOGGER.error("Error while updating '%s'", self.entity_id) self._image = None self._image_url = None self._available = False return _LOGGER.debug("Runni...
[ "def", "update", "(", "self", ")", ":", "if", "self", ".", "neato", "is", "None", ":", "_LOGGER", ".", "error", "(", "\"Error while updating '%s'\"", ",", "self", ".", "entity_id", ")", "self", ".", "_image", "=", "None", "self", ".", "_image_url", "=", ...
[ 59, 4 ]
[ 105, 30 ]
python
en
['en', 'en', 'en']
True
NeatoCleaningMap.name
(self)
Return the name of this camera.
Return the name of this camera.
def name(self): """Return the name of this camera.""" return self._robot_name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_robot_name" ]
[ 108, 4 ]
[ 110, 31 ]
python
en
['en', 'en', 'en']
True
NeatoCleaningMap.unique_id
(self)
Return unique ID.
Return unique ID.
def unique_id(self): """Return unique ID.""" return self._robot_serial
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_robot_serial" ]
[ 113, 4 ]
[ 115, 33 ]
python
en
['fr', 'la', 'en']
False
NeatoCleaningMap.available
(self)
Return if the robot is available.
Return if the robot is available.
def available(self): """Return if the robot is available.""" return self._available
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_available" ]
[ 118, 4 ]
[ 120, 30 ]
python
en
['en', 'en', 'en']
True
NeatoCleaningMap.device_info
(self)
Device info for neato robot.
Device info for neato robot.
def device_info(self): """Device info for neato robot.""" return {"identifiers": {(NEATO_DOMAIN, self._robot_serial)}}
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "NEATO_DOMAIN", ",", "self", ".", "_robot_serial", ")", "}", "}" ]
[ 123, 4 ]
[ 125, 68 ]
python
it
['it', 'en', 'it']
True
NeatoCleaningMap.device_state_attributes
(self)
Return the state attributes of the vacuum cleaner.
Return the state attributes of the vacuum cleaner.
def device_state_attributes(self): """Return the state attributes of the vacuum cleaner.""" data = {} if self._generated_at is not None: data[ATTR_GENERATED_AT] = self._generated_at return data
[ "def", "device_state_attributes", "(", "self", ")", ":", "data", "=", "{", "}", "if", "self", ".", "_generated_at", "is", "not", "None", ":", "data", "[", "ATTR_GENERATED_AT", "]", "=", "self", ".", "_generated_at", "return", "data" ]
[ 128, 4 ]
[ 135, 19 ]
python
en
['en', 'en', 'en']
True
test_controlling_state_via_topic
(hass, mqtt_mock)
Test the controlling state via topic.
Test the controlling state via topic.
async def test_controlling_state_via_topic(hass, mqtt_mock): """Test the controlling state via topic.""" assert await async_setup_component( hass, switch.DOMAIN, { switch.DOMAIN: { "platform": "mqtt", "name": "test", "state_topi...
[ "async", "def", "test_controlling_state_via_topic", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "switch", ".", "DOMAIN", ",", "{", "switch", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ",...
[ 44, 0 ]
[ 74, 35 ]
python
en
['en', 'en', 'en']
True
test_sending_mqtt_commands_and_optimistic
(hass, mqtt_mock)
Test the sending MQTT commands in optimistic mode.
Test the sending MQTT commands in optimistic mode.
async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock): """Test the sending MQTT commands in optimistic mode.""" fake_state = ha.State("switch.test", "on") with patch( "homeassistant.helpers.restore_state.RestoreEntity.async_get_last_state", return_value=fake_state, ): ...
[ "async", "def", "test_sending_mqtt_commands_and_optimistic", "(", "hass", ",", "mqtt_mock", ")", ":", "fake_state", "=", "ha", ".", "State", "(", "\"switch.test\"", ",", "\"on\"", ")", "with", "patch", "(", "\"homeassistant.helpers.restore_state.RestoreEntity.async_get_la...
[ 77, 0 ]
[ 120, 35 ]
python
en
['en', 'no', 'en']
True
test_controlling_state_via_topic_and_json_message
(hass, mqtt_mock)
Test the controlling state via topic and JSON message.
Test the controlling state via topic and JSON message.
async def test_controlling_state_via_topic_and_json_message(hass, mqtt_mock): """Test the controlling state via topic and JSON message.""" assert await async_setup_component( hass, switch.DOMAIN, { switch.DOMAIN: { "platform": "mqtt", "name": "...
[ "async", "def", "test_controlling_state_via_topic_and_json_message", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "switch", ".", "DOMAIN", ",", "{", "switch", ".", "DOMAIN", ":", "{", "\"platform\"", ":", ...
[ 123, 0 ]
[ 153, 35 ]
python
en
['en', 'en', 'en']
True
test_availability_when_connection_lost
(hass, mqtt_mock)
Test availability after MQTT disconnection.
Test availability after MQTT disconnection.
async def test_availability_when_connection_lost(hass, mqtt_mock): """Test availability after MQTT disconnection.""" await help_test_availability_when_connection_lost( hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_availability_when_connection_lost", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_availability_when_connection_lost", "(", "hass", ",", "mqtt_mock", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 156, 0 ]
[ 160, 5 ]
python
en
['en', 'en', 'en']
True
test_availability_without_topic
(hass, mqtt_mock)
Test availability without defined availability topic.
Test availability without defined availability topic.
async def test_availability_without_topic(hass, mqtt_mock): """Test availability without defined availability topic.""" await help_test_availability_without_topic( hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_availability_without_topic", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_availability_without_topic", "(", "hass", ",", "mqtt_mock", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 163, 0 ]
[ 167, 5 ]
python
en
['en', 'en', 'en']
True
test_default_availability_payload
(hass, mqtt_mock)
Test availability by default payload with defined topic.
Test availability by default payload with defined topic.
async def test_default_availability_payload(hass, mqtt_mock): """Test availability by default payload with defined topic.""" config = { switch.DOMAIN: { "platform": "mqtt", "name": "test", "state_topic": "state-topic", "command_topic": "command-topic", ...
[ "async", "def", "test_default_availability_payload", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "{", "switch", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"name\"", ":", "\"test\"", ",", "\"state_topic\"", ":", "\"state-topic\""...
[ 170, 0 ]
[ 185, 5 ]
python
en
['en', 'en', 'en']
True
test_custom_availability_payload
(hass, mqtt_mock)
Test availability by custom payload with defined topic.
Test availability by custom payload with defined topic.
async def test_custom_availability_payload(hass, mqtt_mock): """Test availability by custom payload with defined topic.""" config = { switch.DOMAIN: { "platform": "mqtt", "name": "test", "state_topic": "state-topic", "command_topic": "command-topic", ...
[ "async", "def", "test_custom_availability_payload", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "{", "switch", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"name\"", ":", "\"test\"", ",", "\"state_topic\"", ":", "\"state-topic\"",...
[ 188, 0 ]
[ 203, 5 ]
python
en
['en', 'en', 'en']
True
test_custom_state_payload
(hass, mqtt_mock)
Test the state payload.
Test the state payload.
async def test_custom_state_payload(hass, mqtt_mock): """Test the state payload.""" assert await async_setup_component( hass, switch.DOMAIN, { switch.DOMAIN: { "platform": "mqtt", "name": "test", "state_topic": "state-topic", ...
[ "async", "def", "test_custom_state_payload", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "switch", ".", "DOMAIN", ",", "{", "switch", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\...
[ 206, 0 ]
[ 238, 35 ]
python
en
['en', 'en', 'en']
True
test_setting_attribute_via_mqtt_json_message
(hass, mqtt_mock)
Test the setting of attribute via MQTT with JSON payload.
Test the setting of attribute via MQTT with JSON payload.
async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock): """Test the setting of attribute via MQTT with JSON payload.""" await help_test_setting_attribute_via_mqtt_json_message( hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_setting_attribute_via_mqtt_json_message", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_setting_attribute_via_mqtt_json_message", "(", "hass", ",", "mqtt_mock", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 241, 0 ]
[ 245, 5 ]
python
en
['en', 'en', 'en']
True
test_setting_attribute_with_template
(hass, mqtt_mock)
Test the setting of attribute via MQTT with JSON payload.
Test the setting of attribute via MQTT with JSON payload.
async def test_setting_attribute_with_template(hass, mqtt_mock): """Test the setting of attribute via MQTT with JSON payload.""" await help_test_setting_attribute_with_template( hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_setting_attribute_with_template", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_setting_attribute_with_template", "(", "hass", ",", "mqtt_mock", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 248, 0 ]
[ 252, 5 ]
python
en
['en', 'en', 'en']
True
test_update_with_json_attrs_not_dict
(hass, mqtt_mock, caplog)
Test attributes get extracted from a JSON result.
Test attributes get extracted from a JSON result.
async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog): """Test attributes get extracted from a JSON result.""" await help_test_update_with_json_attrs_not_dict( hass, mqtt_mock, caplog, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_update_with_json_attrs_not_dict", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "await", "help_test_update_with_json_attrs_not_dict", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", "...
[ 255, 0 ]
[ 259, 5 ]
python
en
['en', 'en', 'en']
True
test_update_with_json_attrs_bad_JSON
(hass, mqtt_mock, caplog)
Test attributes get extracted from a JSON result.
Test attributes get extracted from a JSON result.
async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog): """Test attributes get extracted from a JSON result.""" await help_test_update_with_json_attrs_bad_JSON( hass, mqtt_mock, caplog, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_update_with_json_attrs_bad_JSON", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "await", "help_test_update_with_json_attrs_bad_JSON", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", "...
[ 262, 0 ]
[ 266, 5 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_attr
(hass, mqtt_mock, caplog)
Test update of discovered MQTTAttributes.
Test update of discovered MQTTAttributes.
async def test_discovery_update_attr(hass, mqtt_mock, caplog): """Test update of discovered MQTTAttributes.""" await help_test_discovery_update_attr( hass, mqtt_mock, caplog, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_discovery_update_attr", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "await", "help_test_discovery_update_attr", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 269, 0 ]
[ 273, 5 ]
python
en
['en', 'en', 'en']
True
test_unique_id
(hass, mqtt_mock)
Test unique id option only creates one switch per unique_id.
Test unique id option only creates one switch per unique_id.
async def test_unique_id(hass, mqtt_mock): """Test unique id option only creates one switch per unique_id.""" config = { switch.DOMAIN: [ { "platform": "mqtt", "name": "Test 1", "state_topic": "test-topic", "command_topic": "com...
[ "async", "def", "test_unique_id", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "{", "switch", ".", "DOMAIN", ":", "[", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"name\"", ":", "\"Test 1\"", ",", "\"state_topic\"", ":", "\"test-topic\"", ",", ...
[ 276, 0 ]
[ 296, 69 ]
python
en
['en', 'en', 'en']
True
test_discovery_removal_switch
(hass, mqtt_mock, caplog)
Test removal of discovered switch.
Test removal of discovered switch.
async def test_discovery_removal_switch(hass, mqtt_mock, caplog): """Test removal of discovered switch.""" data = ( '{ "name": "test",' ' "state_topic": "test_topic",' ' "command_topic": "test_topic" }' ) await help_test_discovery_removal(hass, mqtt_mock, caplog, switch.DOMAIN,...
[ "async", "def", "test_discovery_removal_switch", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "data", "=", "(", "'{ \"name\": \"test\",'", "' \"state_topic\": \"test_topic\",'", "' \"command_topic\": \"test_topic\" }'", ")", "await", "help_test_discovery_removal", ...
[ 299, 0 ]
[ 306, 83 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_switch_topic_template
(hass, mqtt_mock, caplog)
Test update of discovered switch.
Test update of discovered switch.
async def test_discovery_update_switch_topic_template(hass, mqtt_mock, caplog): """Test update of discovered switch.""" config1 = copy.deepcopy(DEFAULT_CONFIG[switch.DOMAIN]) config2 = copy.deepcopy(DEFAULT_CONFIG[switch.DOMAIN]) config1["name"] = "Beer" config2["name"] = "Milk" config1["state_t...
[ "async", "def", "test_discovery_update_switch_topic_template", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "config1", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", "[", "switch", ".", "DOMAIN", "]", ")", "config2", "=", "copy", ".", "deepcop...
[ 309, 0 ]
[ 343, 5 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_switch_template
(hass, mqtt_mock, caplog)
Test update of discovered switch.
Test update of discovered switch.
async def test_discovery_update_switch_template(hass, mqtt_mock, caplog): """Test update of discovered switch.""" config1 = copy.deepcopy(DEFAULT_CONFIG[switch.DOMAIN]) config2 = copy.deepcopy(DEFAULT_CONFIG[switch.DOMAIN]) config1["name"] = "Beer" config2["name"] = "Milk" config1["state_topic"]...
[ "async", "def", "test_discovery_update_switch_template", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "config1", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", "[", "switch", ".", "DOMAIN", "]", ")", "config2", "=", "copy", ".", "deepcopy", ...
[ 346, 0 ]
[ 378, 5 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_unchanged_switch
(hass, mqtt_mock, caplog)
Test update of discovered switch.
Test update of discovered switch.
async def test_discovery_update_unchanged_switch(hass, mqtt_mock, caplog): """Test update of discovered switch.""" data1 = ( '{ "name": "Beer",' ' "state_topic": "test_topic",' ' "command_topic": "test_topic" }' ) with patch( "homeassistant.components.mqtt.switch.MqttSw...
[ "async", "def", "test_discovery_update_unchanged_switch", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "data1", "=", "(", "'{ \"name\": \"Beer\",'", "' \"state_topic\": \"test_topic\",'", "' \"command_topic\": \"test_topic\" }'", ")", "with", "patch", "(", "\"h...
[ 381, 0 ]
[ 393, 9 ]
python
en
['en', 'en', 'en']
True
test_discovery_broken
(hass, mqtt_mock, caplog)
Test handling of bad discovery message.
Test handling of bad discovery message.
async def test_discovery_broken(hass, mqtt_mock, caplog): """Test handling of bad discovery message.""" data1 = '{ "name": "Beer" }' data2 = ( '{ "name": "Milk",' ' "state_topic": "test_topic",' ' "command_topic": "test_topic" }' ) await help_test_discovery_broken( ...
[ "async", "def", "test_discovery_broken", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "data1", "=", "'{ \"name\": \"Beer\" }'", "data2", "=", "(", "'{ \"name\": \"Milk\",'", "' \"state_topic\": \"test_topic\",'", "' \"command_topic\": \"test_topic\" }'", ")", "...
[ 397, 0 ]
[ 407, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_device_info_with_connection
(hass, mqtt_mock)
Test MQTT switch device registry integration.
Test MQTT switch device registry integration.
async def test_entity_device_info_with_connection(hass, mqtt_mock): """Test MQTT switch device registry integration.""" await help_test_entity_device_info_with_connection( hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_with_connection", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_with_connection", "(", "hass", ",", "mqtt_mock", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 410, 0 ]
[ 414, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_device_info_with_identifier
(hass, mqtt_mock)
Test MQTT switch device registry integration.
Test MQTT switch device registry integration.
async def test_entity_device_info_with_identifier(hass, mqtt_mock): """Test MQTT switch device registry integration.""" await help_test_entity_device_info_with_identifier( hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_with_identifier", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_with_identifier", "(", "hass", ",", "mqtt_mock", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 417, 0 ]
[ 421, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_device_info_update
(hass, mqtt_mock)
Test device registry update.
Test device registry update.
async def test_entity_device_info_update(hass, mqtt_mock): """Test device registry update.""" await help_test_entity_device_info_update( hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_update", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_update", "(", "hass", ",", "mqtt_mock", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 424, 0 ]
[ 428, 5 ]
python
en
['fr', 'fy', 'en']
False
test_entity_device_info_remove
(hass, mqtt_mock)
Test device registry remove.
Test device registry remove.
async def test_entity_device_info_remove(hass, mqtt_mock): """Test device registry remove.""" await help_test_entity_device_info_remove( hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_remove", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_remove", "(", "hass", ",", "mqtt_mock", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 431, 0 ]
[ 435, 5 ]
python
en
['fr', 'en', 'en']
True
test_entity_id_update_subscriptions
(hass, mqtt_mock)
Test MQTT subscriptions are managed when entity_id is updated.
Test MQTT subscriptions are managed when entity_id is updated.
async def test_entity_id_update_subscriptions(hass, mqtt_mock): """Test MQTT subscriptions are managed when entity_id is updated.""" await help_test_entity_id_update_subscriptions( hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_id_update_subscriptions", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_id_update_subscriptions", "(", "hass", ",", "mqtt_mock", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 438, 0 ]
[ 442, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_id_update_discovery_update
(hass, mqtt_mock)
Test MQTT discovery update when entity_id is updated.
Test MQTT discovery update when entity_id is updated.
async def test_entity_id_update_discovery_update(hass, mqtt_mock): """Test MQTT discovery update when entity_id is updated.""" await help_test_entity_id_update_discovery_update( hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_id_update_discovery_update", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_id_update_discovery_update", "(", "hass", ",", "mqtt_mock", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 445, 0 ]
[ 449, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_debug_info_message
(hass, mqtt_mock)
Test MQTT debug info.
Test MQTT debug info.
async def test_entity_debug_info_message(hass, mqtt_mock): """Test MQTT debug info.""" await help_test_entity_debug_info_message( hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_debug_info_message", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_debug_info_message", "(", "hass", ",", "mqtt_mock", ",", "switch", ".", "DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 452, 0 ]
[ 456, 5 ]
python
es
['es', 'mt', 'it']
False