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
YamahaDevice.source_list
(self, value)
Set source_list attribute.
Set source_list attribute.
def source_list(self, value): """Set source_list attribute.""" self._source_list = value
[ "def", "source_list", "(", "self", ",", "value", ")", ":", "self", ".", "_source_list", "=", "value" ]
[ 165, 4 ]
[ 167, 33 ]
python
en
['en', 'de', 'en']
True
YamahaDevice.media_content_type
(self)
Return the media content type.
Return the media content type.
def media_content_type(self): """Return the media content type.""" return MEDIA_TYPE_MUSIC
[ "def", "media_content_type", "(", "self", ")", ":", "return", "MEDIA_TYPE_MUSIC" ]
[ 170, 4 ]
[ 172, 31 ]
python
en
['en', 'la', 'en']
True
YamahaDevice.media_duration
(self)
Duration of current playing media in seconds.
Duration of current playing media in seconds.
def media_duration(self): """Duration of current playing media in seconds.""" return self.media_status.media_duration if self.media_status else None
[ "def", "media_duration", "(", "self", ")", ":", "return", "self", ".", "media_status", ".", "media_duration", "if", "self", ".", "media_status", "else", "None" ]
[ 175, 4 ]
[ 177, 78 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.media_image_url
(self)
Image url of current playing media.
Image url of current playing media.
def media_image_url(self): """Image url of current playing media.""" return self.media_status.media_image_url if self.media_status else None
[ "def", "media_image_url", "(", "self", ")", ":", "return", "self", ".", "media_status", ".", "media_image_url", "if", "self", ".", "media_status", "else", "None" ]
[ 180, 4 ]
[ 182, 79 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.media_artist
(self)
Artist of current playing media, music track only.
Artist of current playing media, music track only.
def media_artist(self): """Artist of current playing media, music track only.""" return self.media_status.media_artist if self.media_status else None
[ "def", "media_artist", "(", "self", ")", ":", "return", "self", ".", "media_status", ".", "media_artist", "if", "self", ".", "media_status", "else", "None" ]
[ 185, 4 ]
[ 187, 76 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.media_album
(self)
Album of current playing media, music track only.
Album of current playing media, music track only.
def media_album(self): """Album of current playing media, music track only.""" return self.media_status.media_album if self.media_status else None
[ "def", "media_album", "(", "self", ")", ":", "return", "self", ".", "media_status", ".", "media_album", "if", "self", ".", "media_status", "else", "None" ]
[ 190, 4 ]
[ 192, 75 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.media_track
(self)
Track number of current playing media, music track only.
Track number of current playing media, music track only.
def media_track(self): """Track number of current playing media, music track only.""" return self.media_status.media_track if self.media_status else None
[ "def", "media_track", "(", "self", ")", ":", "return", "self", ".", "media_status", ".", "media_track", "if", "self", ".", "media_status", "else", "None" ]
[ 195, 4 ]
[ 197, 75 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.media_title
(self)
Title of current playing media.
Title of current playing media.
def media_title(self): """Title of current playing media.""" return self.media_status.media_title if self.media_status else None
[ "def", "media_title", "(", "self", ")", ":", "return", "self", ".", "media_status", ".", "media_title", "if", "self", ".", "media_status", "else", "None" ]
[ 200, 4 ]
[ 202, 75 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.media_position
(self)
Position of current playing media in seconds.
Position of current playing media in seconds.
def media_position(self): """Position of current playing media in seconds.""" if self.media_status and self.state in [ STATE_PLAYING, STATE_PAUSED, STATE_IDLE, ]: return self.media_status.media_position
[ "def", "media_position", "(", "self", ")", ":", "if", "self", ".", "media_status", "and", "self", ".", "state", "in", "[", "STATE_PLAYING", ",", "STATE_PAUSED", ",", "STATE_IDLE", ",", "]", ":", "return", "self", ".", "media_status", ".", "media_position" ]
[ 205, 4 ]
[ 212, 51 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.media_position_updated_at
(self)
When was the position of the current playing media valid. Returns value from homeassistant.util.dt.utcnow().
When was the position of the current playing media valid.
def media_position_updated_at(self): """When was the position of the current playing media valid. Returns value from homeassistant.util.dt.utcnow(). """ return self.media_status_received if self.media_status else None
[ "def", "media_position_updated_at", "(", "self", ")", ":", "return", "self", ".", "media_status_received", "if", "self", ".", "media_status", "else", "None" ]
[ 215, 4 ]
[ 220, 72 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.update
(self)
Get the latest details from the device.
Get the latest details from the device.
def update(self): """Get the latest details from the device.""" _LOGGER.debug("update: %s", self.entity_id) self._recv.update_status() self._zone.update_status()
[ "def", "update", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"update: %s\"", ",", "self", ".", "entity_id", ")", "self", ".", "_recv", ".", "update_status", "(", ")", "self", ".", "_zone", ".", "update_status", "(", ")" ]
[ 222, 4 ]
[ 226, 34 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.update_hass
(self)
Push updates to Home Assistant.
Push updates to Home Assistant.
def update_hass(self): """Push updates to Home Assistant.""" if self.entity_id: _LOGGER.debug("update_hass: pushing updates") self.schedule_update_ha_state() return True
[ "def", "update_hass", "(", "self", ")", ":", "if", "self", ".", "entity_id", ":", "_LOGGER", ".", "debug", "(", "\"update_hass: pushing updates\"", ")", "self", ".", "schedule_update_ha_state", "(", ")", "return", "True" ]
[ 228, 4 ]
[ 233, 23 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.turn_on
(self)
Turn on specified media player or all.
Turn on specified media player or all.
def turn_on(self): """Turn on specified media player or all.""" _LOGGER.debug("Turn device: on") self._zone.set_power(True)
[ "def", "turn_on", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Turn device: on\"", ")", "self", ".", "_zone", ".", "set_power", "(", "True", ")" ]
[ 235, 4 ]
[ 238, 34 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.turn_off
(self)
Turn off specified media player or all.
Turn off specified media player or all.
def turn_off(self): """Turn off specified media player or all.""" _LOGGER.debug("Turn device: off") self._zone.set_power(False)
[ "def", "turn_off", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Turn device: off\"", ")", "self", ".", "_zone", ".", "set_power", "(", "False", ")" ]
[ 240, 4 ]
[ 243, 35 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.media_play
(self)
Send the media player the command for play/pause.
Send the media player the command for play/pause.
def media_play(self): """Send the media player the command for play/pause.""" _LOGGER.debug("Play") self._recv.set_playback("play")
[ "def", "media_play", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Play\"", ")", "self", ".", "_recv", ".", "set_playback", "(", "\"play\"", ")" ]
[ 245, 4 ]
[ 248, 39 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.media_pause
(self)
Send the media player the command for pause.
Send the media player the command for pause.
def media_pause(self): """Send the media player the command for pause.""" _LOGGER.debug("Pause") self._recv.set_playback("pause")
[ "def", "media_pause", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Pause\"", ")", "self", ".", "_recv", ".", "set_playback", "(", "\"pause\"", ")" ]
[ 250, 4 ]
[ 253, 40 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.media_stop
(self)
Send the media player the stop command.
Send the media player the stop command.
def media_stop(self): """Send the media player the stop command.""" _LOGGER.debug("Stop") self._recv.set_playback("stop")
[ "def", "media_stop", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Stop\"", ")", "self", ".", "_recv", ".", "set_playback", "(", "\"stop\"", ")" ]
[ 255, 4 ]
[ 258, 39 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.media_previous_track
(self)
Send the media player the command for prev track.
Send the media player the command for prev track.
def media_previous_track(self): """Send the media player the command for prev track.""" _LOGGER.debug("Previous") self._recv.set_playback("previous")
[ "def", "media_previous_track", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Previous\"", ")", "self", ".", "_recv", ".", "set_playback", "(", "\"previous\"", ")" ]
[ 260, 4 ]
[ 263, 43 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.media_next_track
(self)
Send the media player the command for next track.
Send the media player the command for next track.
def media_next_track(self): """Send the media player the command for next track.""" _LOGGER.debug("Next") self._recv.set_playback("next")
[ "def", "media_next_track", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Next\"", ")", "self", ".", "_recv", ".", "set_playback", "(", "\"next\"", ")" ]
[ 265, 4 ]
[ 268, 39 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.mute_volume
(self, mute)
Send mute command.
Send mute command.
def mute_volume(self, mute): """Send mute command.""" _LOGGER.debug("Mute volume: %s", mute) self._zone.set_mute(mute)
[ "def", "mute_volume", "(", "self", ",", "mute", ")", ":", "_LOGGER", ".", "debug", "(", "\"Mute volume: %s\"", ",", "mute", ")", "self", ".", "_zone", ".", "set_mute", "(", "mute", ")" ]
[ 270, 4 ]
[ 273, 33 ]
python
en
['en', 'co', 'en']
True
YamahaDevice.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.""" _LOGGER.debug("Volume level: %.2f / %d", volume, volume * self.volume_max) self._zone.set_volume(volume * self.volume_max)
[ "def", "set_volume_level", "(", "self", ",", "volume", ")", ":", "_LOGGER", ".", "debug", "(", "\"Volume level: %.2f / %d\"", ",", "volume", ",", "volume", "*", "self", ".", "volume_max", ")", "self", ".", "_zone", ".", "set_volume", "(", "volume", "*", "s...
[ 275, 4 ]
[ 278, 55 ]
python
en
['fr', 'zu', 'en']
False
YamahaDevice.select_source
(self, source)
Send the media player the command to select input source.
Send the media player the command to select input source.
def select_source(self, source): """Send the media player the command to select input source.""" _LOGGER.debug("select_source: %s", source) self.status = STATE_UNKNOWN self._zone.set_input(source)
[ "def", "select_source", "(", "self", ",", "source", ")", ":", "_LOGGER", ".", "debug", "(", "\"select_source: %s\"", ",", "source", ")", "self", ".", "status", "=", "STATE_UNKNOWN", "self", ".", "_zone", ".", "set_input", "(", "source", ")" ]
[ 280, 4 ]
[ 284, 36 ]
python
en
['en', 'en', 'en']
True
YamahaDevice.new_media_status
(self, status)
Handle updates of the media status.
Handle updates of the media status.
def new_media_status(self, status): """Handle updates of the media status.""" _LOGGER.debug("new media_status arrived") self.media_status = status self.media_status_received = dt_util.utcnow()
[ "def", "new_media_status", "(", "self", ",", "status", ")", ":", "_LOGGER", ".", "debug", "(", "\"new media_status arrived\"", ")", "self", ".", "media_status", "=", "status", "self", ".", "media_status_received", "=", "dt_util", ".", "utcnow", "(", ")" ]
[ 286, 4 ]
[ 290, 53 ]
python
en
['en', 'la', 'en']
True
validate_input
(hass: core.HomeAssistant, data)
Validate the user input allows us to connect. Data has the keys from DATA_SCHEMA with values provided by the user.
Validate the user input allows us to connect.
async def validate_input(hass: core.HomeAssistant, data): """Validate the user input allows us to connect. Data has the keys from DATA_SCHEMA with values provided by the user. """ roomba = Roomba( address=data[CONF_HOST], blid=data[CONF_BLID], password=data[CONF_PASSWORD], ...
[ "async", "def", "validate_input", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "data", ")", ":", "roomba", "=", "Roomba", "(", "address", "=", "data", "[", "CONF_HOST", "]", ",", "blid", "=", "data", "[", "CONF_BLID", "]", ",", "password", "=",...
[ 31, 0 ]
[ 50, 5 ]
python
en
['en', 'en', 'en']
True
RoombaConfigFlow.async_get_options_flow
(config_entry)
Get the options flow for this handler.
Get the options flow for this handler.
def async_get_options_flow(config_entry): """Get the options flow for this handler.""" return OptionsFlowHandler(config_entry)
[ "def", "async_get_options_flow", "(", "config_entry", ")", ":", "return", "OptionsFlowHandler", "(", "config_entry", ")" ]
[ 61, 4 ]
[ 63, 47 ]
python
en
['en', 'en', 'en']
True
RoombaConfigFlow.async_step_import
(self, import_info)
Set the config entry up from yaml.
Set the config entry up from yaml.
async def async_step_import(self, import_info): """Set the config entry up from yaml.""" return await self.async_step_user(import_info)
[ "async", "def", "async_step_import", "(", "self", ",", "import_info", ")", ":", "return", "await", "self", ".", "async_step_user", "(", "import_info", ")" ]
[ 65, 4 ]
[ 67, 54 ]
python
en
['en', 'en', 'en']
True
RoombaConfigFlow.async_step_user
(self, user_input=None)
Handle a flow initialized by the user.
Handle a flow initialized by the user.
async def async_step_user(self, user_input=None): """Handle a flow initialized by the user.""" errors = {} if user_input is not None: await self.async_set_unique_id(user_input[CONF_BLID]) self._abort_if_unique_id_configured() try: info = await...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "await", "self", ".", "async_set_unique_id", "(", "user_input", "[", "CONF_BLID", "]", ")", "...
[ 69, 4 ]
[ 87, 9 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler.__init__
(self, config_entry)
Initialize options flow.
Initialize options flow.
def __init__(self, config_entry): """Initialize options flow.""" self.config_entry = config_entry
[ "def", "__init__", "(", "self", ",", "config_entry", ")", ":", "self", ".", "config_entry", "=", "config_entry" ]
[ 93, 4 ]
[ 95, 40 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler.async_step_init
(self, user_input=None)
Manage the options.
Manage the options.
async def async_step_init(self, user_input=None): """Manage the options.""" if user_input is not None: return self.async_create_entry(title="", data=user_input) return self.async_show_form( step_id="init", data_schema=vol.Schema( { ...
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "return", "self", ".", "async_create_entry", "(", "title", "=", "\"\"", ",", "data", "=", "user_input", ")", "return", ...
[ 97, 4 ]
[ 120, 9 ]
python
en
['en', 'en', 'en']
True
test_unload_entry
(hass)
Test successful unload of entry.
Test successful unload of entry.
async def test_unload_entry(hass): """Test successful unload of entry.""" with patch( "homeassistant.components.kodi.media_player.async_setup_entry", return_value=True, ): entry = await init_integration(hass) assert len(hass.config_entries.async_entries(DOMAIN)) == 1 assert ...
[ "async", "def", "test_unload_entry", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.kodi.media_player.async_setup_entry\"", ",", "return_value", "=", "True", ",", ")", ":", "entry", "=", "await", "init_integration", "(", "hass", ")", "asser...
[ 9, 0 ]
[ 24, 36 ]
python
en
['en', 'en', 'en']
True
async_validate_trigger_config
(hass, config)
Validate config.
Validate config.
async def async_validate_trigger_config(hass, config): """Validate config.""" platform = await async_get_device_automation_platform( hass, config[CONF_DOMAIN], "trigger" ) if hasattr(platform, "async_validate_trigger_config"): return await getattr(platform, "async_validate_trigger_config...
[ "async", "def", "async_validate_trigger_config", "(", "hass", ",", "config", ")", ":", "platform", "=", "await", "async_get_device_automation_platform", "(", "hass", ",", "config", "[", "CONF_DOMAIN", "]", ",", "\"trigger\"", ")", "if", "hasattr", "(", "platform",...
[ 14, 0 ]
[ 22, 42 ]
python
en
['en', 'la', 'it']
False
async_attach_trigger
(hass, config, action, automation_info)
Listen for trigger.
Listen for trigger.
async def async_attach_trigger(hass, config, action, automation_info): """Listen for trigger.""" platform = await async_get_device_automation_platform( hass, config[CONF_DOMAIN], "trigger" ) return await platform.async_attach_trigger(hass, config, action, automation_info)
[ "async", "def", "async_attach_trigger", "(", "hass", ",", "config", ",", "action", ",", "automation_info", ")", ":", "platform", "=", "await", "async_get_device_automation_platform", "(", "hass", ",", "config", "[", "CONF_DOMAIN", "]", ",", "\"trigger\"", ")", "...
[ 25, 0 ]
[ 30, 85 ]
python
en
['en', 'no', 'en']
True
reload
(hass)
Reload the automation from config.
Reload the automation from config.
def reload(hass): """Reload the automation from config.""" hass.add_job(async_reload, hass)
[ "def", "reload", "(", "hass", ")", ":", "hass", ".", "add_job", "(", "async_reload", ",", "hass", ")" ]
[ 19, 0 ]
[ 21, 36 ]
python
en
['en', 'en', 'en']
True
async_reload
(hass)
Reload the automation from config.
Reload the automation from config.
def async_reload(hass): """Reload the automation from config.""" hass.async_add_job(hass.services.async_call(DOMAIN, SERVICE_RELOAD))
[ "def", "async_reload", "(", "hass", ")", ":", "hass", ".", "async_add_job", "(", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_RELOAD", ")", ")" ]
[ 26, 0 ]
[ 28, 72 ]
python
en
['en', 'en', 'en']
True
set_group
( hass, object_id, name=None, entity_ids=None, icon=None, add=None, )
Create/Update a group.
Create/Update a group.
def set_group( hass, object_id, name=None, entity_ids=None, icon=None, add=None, ): """Create/Update a group.""" hass.add_job( async_set_group, hass, object_id, name, entity_ids, icon, add, )
[ "def", "set_group", "(", "hass", ",", "object_id", ",", "name", "=", "None", ",", "entity_ids", "=", "None", ",", "icon", "=", "None", ",", "add", "=", "None", ",", ")", ":", "hass", ".", "add_job", "(", "async_set_group", ",", "hass", ",", "object_i...
[ 32, 0 ]
[ 49, 5 ]
python
en
['en', 'co', 'en']
True
async_set_group
( hass, object_id, name=None, entity_ids=None, icon=None, add=None, )
Create/Update a group.
Create/Update a group.
def async_set_group( hass, object_id, name=None, entity_ids=None, icon=None, add=None, ): """Create/Update a group.""" data = { key: value for key, value in [ (ATTR_OBJECT_ID, object_id), (ATTR_NAME, name), (ATTR_ENTITIES, entity_ids), ...
[ "def", "async_set_group", "(", "hass", ",", "object_id", ",", "name", "=", "None", ",", "entity_ids", "=", "None", ",", "icon", "=", "None", ",", "add", "=", "None", ",", ")", ":", "data", "=", "{", "key", ":", "value", "for", "key", ",", "value", ...
[ 54, 0 ]
[ 75, 75 ]
python
en
['en', 'co', 'en']
True
async_remove
(hass, object_id)
Remove a user group.
Remove a user group.
def async_remove(hass, object_id): """Remove a user group.""" data = {ATTR_OBJECT_ID: object_id} hass.async_add_job(hass.services.async_call(DOMAIN, SERVICE_REMOVE, data))
[ "def", "async_remove", "(", "hass", ",", "object_id", ")", ":", "data", "=", "{", "ATTR_OBJECT_ID", ":", "object_id", "}", "hass", ".", "async_add_job", "(", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_REMOVE", ",", "data", ")"...
[ 80, 0 ]
[ 83, 78 ]
python
en
['en', 'en', 'en']
True
has_all_unique_users
(value)
Validate that all API users are unique.
Validate that all API users are unique.
def has_all_unique_users(value): """Validate that all API users are unique.""" api_users = [user[CONF_API_USER] for user in value] has_unique_values(api_users) return value
[ "def", "has_all_unique_users", "(", "value", ")", ":", "api_users", "=", "[", "user", "[", "CONF_API_USER", "]", "for", "user", "in", "value", "]", "has_unique_values", "(", "api_users", ")", "return", "value" ]
[ 55, 0 ]
[ 59, 16 ]
python
en
['en', 'en', 'en']
True
has_all_unique_users_names
(value)
Validate that all user's names are unique and set if any is set.
Validate that all user's names are unique and set if any is set.
def has_all_unique_users_names(value): """Validate that all user's names are unique and set if any is set.""" names = [user.get(CONF_NAME) for user in value] if None in names and any(name is not None for name in names): raise vol.Invalid("user names of all users must be set if any is set") if no...
[ "def", "has_all_unique_users_names", "(", "value", ")", ":", "names", "=", "[", "user", ".", "get", "(", "CONF_NAME", ")", "for", "user", "in", "value", "]", "if", "None", "in", "names", "and", "any", "(", "name", "is", "not", "None", "for", "name", ...
[ 62, 0 ]
[ 69, 16 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up the Habitica service.
Set up the Habitica service.
async def async_setup(hass, config): """Set up the Habitica service.""" conf = config[DOMAIN] data = hass.data[DOMAIN] = {} websession = async_get_clientsession(hass) class HAHabitipyAsync(HabitipyAsync): """Closure API class to hold session.""" def __call__(self, **kwargs): ...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "=", "{", "}", "websession", "=", "async_get_clientsession", "(", "hass", ")", "class"...
[ 93, 0 ]
[ 152, 15 ]
python
en
['en', 'ro', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the Russound RIO platform.
Set up the Russound RIO platform.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Russound RIO platform.""" host = config.get(CONF_HOST) port = config.get(CONF_PORT) russ = Russound(hass.loop, host, port) await russ.connect() # Discover sources and zones sources = awai...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "host", "=", "config", ".", "get", "(", "CONF_HOST", ")", "port", "=", "config", ".", "get", "(", "CONF_PORT", ")",...
[ 41, 0 ]
[ 68, 31 ]
python
en
['en', 'pt', 'en']
True
RussoundZoneDevice.__init__
(self, russ, zone_id, name, sources)
Initialize the zone device.
Initialize the zone device.
def __init__(self, russ, zone_id, name, sources): """Initialize the zone device.""" super().__init__() self._name = name self._russ = russ self._zone_id = zone_id self._sources = sources
[ "def", "__init__", "(", "self", ",", "russ", ",", "zone_id", ",", "name", ",", "sources", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "_name", "=", "name", "self", ".", "_russ", "=", "russ", "self", ".", "_zone_id", "=", ...
[ 74, 4 ]
[ 80, 31 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice._source_na_var
(self, name)
Will replace invalid values with None.
Will replace invalid values with None.
def _source_na_var(self, name): """Will replace invalid values with None.""" current = int(self._zone_var("currentsource", 0)) if current: value = self._russ.get_cached_source_variable(current, name, None) if value in (None, "", "------"): return None ...
[ "def", "_source_na_var", "(", "self", ",", "name", ")", ":", "current", "=", "int", "(", "self", ".", "_zone_var", "(", "\"currentsource\"", ",", "0", ")", ")", "if", "current", ":", "value", "=", "self", ".", "_russ", ".", "get_cached_source_variable", ...
[ 91, 4 ]
[ 99, 19 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.async_added_to_hass
(self)
Register callback handlers.
Register callback handlers.
async def async_added_to_hass(self): """Register callback handlers.""" self._russ.add_zone_callback(self._zone_callback_handler) self._russ.add_source_callback(self._source_callback_handler)
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_russ", ".", "add_zone_callback", "(", "self", ".", "_zone_callback_handler", ")", "self", ".", "_russ", ".", "add_source_callback", "(", "self", ".", "_source_callback_handler", ")" ]
[ 110, 4 ]
[ 113, 69 ]
python
en
['en', 'af', 'en']
True
RussoundZoneDevice.should_poll
(self)
No polling needed.
No polling needed.
def should_poll(self): """No polling needed.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 116, 4 ]
[ 118, 20 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.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._zone_var("name", self._name)
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_zone_var", "(", "\"name\"", ",", "self", ".", "_name", ")" ]
[ 121, 4 ]
[ 123, 49 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" status = self._zone_var("status", "OFF") if status == "ON": return STATE_ON if status == "OFF": return STATE_OFF
[ "def", "state", "(", "self", ")", ":", "status", "=", "self", ".", "_zone_var", "(", "\"status\"", ",", "\"OFF\"", ")", "if", "status", "==", "\"ON\"", ":", "return", "STATE_ON", "if", "status", "==", "\"OFF\"", ":", "return", "STATE_OFF" ]
[ 126, 4 ]
[ 132, 28 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.supported_features
(self)
Flag media player features that are supported.
Flag media player features that are supported.
def supported_features(self): """Flag media player features that are supported.""" return SUPPORT_RUSSOUND
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_RUSSOUND" ]
[ 135, 4 ]
[ 137, 31 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.source
(self)
Get the currently selected source.
Get the currently selected source.
def source(self): """Get the currently selected source.""" return self._source_na_var("name")
[ "def", "source", "(", "self", ")", ":", "return", "self", ".", "_source_na_var", "(", "\"name\"", ")" ]
[ 140, 4 ]
[ 142, 42 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.source_list
(self)
Return a list of available input sources.
Return a list of available input sources.
def source_list(self): """Return a list of available input sources.""" return [x[1] for x in self._sources]
[ "def", "source_list", "(", "self", ")", ":", "return", "[", "x", "[", "1", "]", "for", "x", "in", "self", ".", "_sources", "]" ]
[ 145, 4 ]
[ 147, 44 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.media_content_type
(self)
Content type of current playing media.
Content type of current playing media.
def media_content_type(self): """Content type of current playing media.""" return MEDIA_TYPE_MUSIC
[ "def", "media_content_type", "(", "self", ")", ":", "return", "MEDIA_TYPE_MUSIC" ]
[ 150, 4 ]
[ 152, 31 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.media_title
(self)
Title of current playing media.
Title of current playing media.
def media_title(self): """Title of current playing media.""" return self._source_na_var("songname")
[ "def", "media_title", "(", "self", ")", ":", "return", "self", ".", "_source_na_var", "(", "\"songname\"", ")" ]
[ 155, 4 ]
[ 157, 46 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.media_artist
(self)
Artist of current playing media, music track only.
Artist of current playing media, music track only.
def media_artist(self): """Artist of current playing media, music track only.""" return self._source_na_var("artistname")
[ "def", "media_artist", "(", "self", ")", ":", "return", "self", ".", "_source_na_var", "(", "\"artistname\"", ")" ]
[ 160, 4 ]
[ 162, 48 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.media_album_name
(self)
Album name of current playing media, music track only.
Album name of current playing media, music track only.
def media_album_name(self): """Album name of current playing media, music track only.""" return self._source_na_var("albumname")
[ "def", "media_album_name", "(", "self", ")", ":", "return", "self", ".", "_source_na_var", "(", "\"albumname\"", ")" ]
[ 165, 4 ]
[ 167, 47 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.media_image_url
(self)
Image url of current playing media.
Image url of current playing media.
def media_image_url(self): """Image url of current playing media.""" return self._source_na_var("coverarturl")
[ "def", "media_image_url", "(", "self", ")", ":", "return", "self", ".", "_source_na_var", "(", "\"coverarturl\"", ")" ]
[ 170, 4 ]
[ 172, 49 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.volume_level
(self)
Volume level of the media player (0..1). Value is returned based on a range (0..50). Therefore float divide by 50 to get to the required range.
Volume level of the media player (0..1).
def volume_level(self): """Volume level of the media player (0..1). Value is returned based on a range (0..50). Therefore float divide by 50 to get to the required range. """ return float(self._zone_var("volume", 0)) / 50.0
[ "def", "volume_level", "(", "self", ")", ":", "return", "float", "(", "self", ".", "_zone_var", "(", "\"volume\"", ",", "0", ")", ")", "/", "50.0" ]
[ 175, 4 ]
[ 181, 56 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.async_turn_off
(self)
Turn off the zone.
Turn off the zone.
async def async_turn_off(self): """Turn off the zone.""" await self._russ.send_zone_event(self._zone_id, "ZoneOff")
[ "async", "def", "async_turn_off", "(", "self", ")", ":", "await", "self", ".", "_russ", ".", "send_zone_event", "(", "self", ".", "_zone_id", ",", "\"ZoneOff\"", ")" ]
[ 183, 4 ]
[ 185, 66 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.async_turn_on
(self)
Turn on the zone.
Turn on the zone.
async def async_turn_on(self): """Turn on the zone.""" await self._russ.send_zone_event(self._zone_id, "ZoneOn")
[ "async", "def", "async_turn_on", "(", "self", ")", ":", "await", "self", ".", "_russ", ".", "send_zone_event", "(", "self", ".", "_zone_id", ",", "\"ZoneOn\"", ")" ]
[ 187, 4 ]
[ 189, 65 ]
python
en
['en', 'en', 'en']
True
RussoundZoneDevice.async_set_volume_level
(self, volume)
Set the volume level.
Set the volume level.
async def async_set_volume_level(self, volume): """Set the volume level.""" rvol = int(volume * 50.0) await self._russ.send_zone_event(self._zone_id, "KeyPress", "Volume", rvol)
[ "async", "def", "async_set_volume_level", "(", "self", ",", "volume", ")", ":", "rvol", "=", "int", "(", "volume", "*", "50.0", ")", "await", "self", ".", "_russ", ".", "send_zone_event", "(", "self", ".", "_zone_id", ",", "\"KeyPress\"", ",", "\"Volume\""...
[ 191, 4 ]
[ 194, 83 ]
python
en
['en', 'sr', 'en']
True
RussoundZoneDevice.async_select_source
(self, source)
Select the source input for this zone.
Select the source input for this zone.
async def async_select_source(self, source): """Select the source input for this zone.""" for source_id, name in self._sources: if name.lower() != source.lower(): continue await self._russ.send_zone_event(self._zone_id, "SelectSource", source_id) break
[ "async", "def", "async_select_source", "(", "self", ",", "source", ")", ":", "for", "source_id", ",", "name", "in", "self", ".", "_sources", ":", "if", "name", ".", "lower", "(", ")", "!=", "source", ".", "lower", "(", ")", ":", "continue", "await", ...
[ 196, 4 ]
[ 202, 17 ]
python
en
['en', 'en', 'en']
True
test_get_device_detects_none
(mock_openzwave)
Test get_device returns None.
Test get_device returns None.
def test_get_device_detects_none(mock_openzwave): """Test get_device returns None.""" node = MockNode() value = MockValue(data=0, node=node) values = MockEntityValues(primary=value) device = sensor.get_device(node=node, values=values, node_config={}) assert device is None
[ "def", "test_get_device_detects_none", "(", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", ")", "value", "=", "MockValue", "(", "data", "=", "0", ",", "node", "=", "node", ")", "values", "=", "MockEntityValues", "(", "primary", "=", "value", ")"...
[ 7, 0 ]
[ 14, 25 ]
python
en
['nl', 'en', 'en']
True
test_get_device_detects_alarmsensor
(mock_openzwave)
Test get_device returns a Z-Wave alarmsensor.
Test get_device returns a Z-Wave alarmsensor.
def test_get_device_detects_alarmsensor(mock_openzwave): """Test get_device returns a Z-Wave alarmsensor.""" node = MockNode( command_classes=[const.COMMAND_CLASS_ALARM, const.COMMAND_CLASS_SENSOR_ALARM] ) value = MockValue(data=0, node=node) values = MockEntityValues(primary=value) dev...
[ "def", "test_get_device_detects_alarmsensor", "(", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", "command_classes", "=", "[", "const", ".", "COMMAND_CLASS_ALARM", ",", "const", ".", "COMMAND_CLASS_SENSOR_ALARM", "]", ")", "value", "=", "MockValue", "(", ...
[ 17, 0 ]
[ 26, 54 ]
python
en
['en', 'da', 'en']
True
test_get_device_detects_multilevelsensor
(mock_openzwave)
Test get_device returns a Z-Wave multilevel sensor.
Test get_device returns a Z-Wave multilevel sensor.
def test_get_device_detects_multilevelsensor(mock_openzwave): """Test get_device returns a Z-Wave multilevel sensor.""" node = MockNode( command_classes=[ const.COMMAND_CLASS_SENSOR_MULTILEVEL, const.COMMAND_CLASS_METER, ] ) value = MockValue(data=0, node=node) ...
[ "def", "test_get_device_detects_multilevelsensor", "(", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", "command_classes", "=", "[", "const", ".", "COMMAND_CLASS_SENSOR_MULTILEVEL", ",", "const", ".", "COMMAND_CLASS_METER", ",", "]", ")", "value", "=", "Mo...
[ 29, 0 ]
[ 42, 30 ]
python
en
['en', 'da', 'en']
True
test_get_device_detects_multilevel_meter
(mock_openzwave)
Test get_device returns a Z-Wave multilevel sensor.
Test get_device returns a Z-Wave multilevel sensor.
def test_get_device_detects_multilevel_meter(mock_openzwave): """Test get_device returns a Z-Wave multilevel sensor.""" node = MockNode(command_classes=[const.COMMAND_CLASS_METER]) value = MockValue(data=0, node=node, type=const.TYPE_DECIMAL) values = MockEntityValues(primary=value) device = sensor...
[ "def", "test_get_device_detects_multilevel_meter", "(", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", "command_classes", "=", "[", "const", ".", "COMMAND_CLASS_METER", "]", ")", "value", "=", "MockValue", "(", "data", "=", "0", ",", "node", "=", "n...
[ 45, 0 ]
[ 52, 59 ]
python
en
['en', 'da', 'en']
True
test_get_device_detects_battery_sensor
(mock_openzwave)
Test get_device returns a Z-Wave battery sensor.
Test get_device returns a Z-Wave battery sensor.
def test_get_device_detects_battery_sensor(mock_openzwave): """Test get_device returns a Z-Wave battery sensor.""" node = MockNode(command_classes=[const.COMMAND_CLASS_BATTERY]) value = MockValue( data=0, node=node, type=const.TYPE_DECIMAL, command_class=const.COMMAND_CLASS_...
[ "def", "test_get_device_detects_battery_sensor", "(", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", "command_classes", "=", "[", "const", ".", "COMMAND_CLASS_BATTERY", "]", ")", "value", "=", "MockValue", "(", "data", "=", "0", ",", "node", "=", "n...
[ 55, 0 ]
[ 69, 74 ]
python
en
['en', 'da', 'en']
True
test_multilevelsensor_value_changed_temp_fahrenheit
(mock_openzwave)
Test value changed for Z-Wave multilevel sensor for temperature.
Test value changed for Z-Wave multilevel sensor for temperature.
def test_multilevelsensor_value_changed_temp_fahrenheit(mock_openzwave): """Test value changed for Z-Wave multilevel sensor for temperature.""" node = MockNode( command_classes=[ const.COMMAND_CLASS_SENSOR_MULTILEVEL, const.COMMAND_CLASS_METER, ] ) value = MockVal...
[ "def", "test_multilevelsensor_value_changed_temp_fahrenheit", "(", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", "command_classes", "=", "[", "const", ".", "COMMAND_CLASS_SENSOR_MULTILEVEL", ",", "const", ".", "COMMAND_CLASS_METER", ",", "]", ")", "value", ...
[ 72, 0 ]
[ 88, 32 ]
python
en
['en', 'da', 'en']
True
test_multilevelsensor_value_changed_temp_celsius
(mock_openzwave)
Test value changed for Z-Wave multilevel sensor for temperature.
Test value changed for Z-Wave multilevel sensor for temperature.
def test_multilevelsensor_value_changed_temp_celsius(mock_openzwave): """Test value changed for Z-Wave multilevel sensor for temperature.""" node = MockNode( command_classes=[ const.COMMAND_CLASS_SENSOR_MULTILEVEL, const.COMMAND_CLASS_METER, ] ) value = MockValue(...
[ "def", "test_multilevelsensor_value_changed_temp_celsius", "(", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", "command_classes", "=", "[", "const", ".", "COMMAND_CLASS_SENSOR_MULTILEVEL", ",", "const", ".", "COMMAND_CLASS_METER", ",", "]", ")", "value", "=...
[ 91, 0 ]
[ 107, 31 ]
python
en
['en', 'da', 'en']
True
test_multilevelsensor_value_changed_other_units
(mock_openzwave)
Test value changed for Z-Wave multilevel sensor for other units.
Test value changed for Z-Wave multilevel sensor for other units.
def test_multilevelsensor_value_changed_other_units(mock_openzwave): """Test value changed for Z-Wave multilevel sensor for other units.""" node = MockNode( command_classes=[ const.COMMAND_CLASS_SENSOR_MULTILEVEL, const.COMMAND_CLASS_METER, ] ) value = MockValue( ...
[ "def", "test_multilevelsensor_value_changed_other_units", "(", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", "command_classes", "=", "[", "const", ".", "COMMAND_CLASS_SENSOR_MULTILEVEL", ",", "const", ".", "COMMAND_CLASS_METER", ",", "]", ")", "value", "="...
[ 110, 0 ]
[ 128, 33 ]
python
en
['en', 'da', 'en']
True
test_multilevelsensor_value_changed_integer
(mock_openzwave)
Test value changed for Z-Wave multilevel sensor for other units.
Test value changed for Z-Wave multilevel sensor for other units.
def test_multilevelsensor_value_changed_integer(mock_openzwave): """Test value changed for Z-Wave multilevel sensor for other units.""" node = MockNode( command_classes=[ const.COMMAND_CLASS_SENSOR_MULTILEVEL, const.COMMAND_CLASS_METER, ] ) value = MockValue(data=...
[ "def", "test_multilevelsensor_value_changed_integer", "(", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", "command_classes", "=", "[", "const", ".", "COMMAND_CLASS_SENSOR_MULTILEVEL", ",", "const", ".", "COMMAND_CLASS_METER", ",", "]", ")", "value", "=", ...
[ 131, 0 ]
[ 147, 28 ]
python
en
['en', 'da', 'en']
True
test_alarm_sensor_value_changed
(mock_openzwave)
Test value changed for Z-Wave sensor.
Test value changed for Z-Wave sensor.
def test_alarm_sensor_value_changed(mock_openzwave): """Test value changed for Z-Wave sensor.""" node = MockNode( command_classes=[const.COMMAND_CLASS_ALARM, const.COMMAND_CLASS_SENSOR_ALARM] ) value = MockValue(data=12.34, node=node, units=homeassistant.const.PERCENTAGE) values = MockEntity...
[ "def", "test_alarm_sensor_value_changed", "(", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", "command_classes", "=", "[", "const", ".", "COMMAND_CLASS_ALARM", ",", "const", ".", "COMMAND_CLASS_SENSOR_ALARM", "]", ")", "value", "=", "MockValue", "(", "d...
[ 150, 0 ]
[ 163, 32 ]
python
en
['en', 'da', '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", ",...
[ 22, 0 ]
[ 65, 5 ]
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 Counter states.
Reproduce Counter states.
async def async_reproduce_states( hass: HomeAssistantType, states: Iterable[State], *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, ) -> None: """Reproduce Counter states.""" await asyncio.gather( *( _async_reproduce_state( ...
[ "async", "def", "async_reproduce_states", "(", "hass", ":", "HomeAssistantType", ",", "states", ":", "Iterable", "[", "State", "]", ",", "*", ",", "context", ":", "Optional", "[", "Context", "]", "=", "None", ",", "reproduce_options", ":", "Optional", "[", ...
[ 68, 0 ]
[ 83, 5 ]
python
en
['en', 'en', 'en']
True
enumerate_stateless_switch
(service)
Enumerate a stateless switch, like a single button.
Enumerate a stateless switch, like a single button.
def enumerate_stateless_switch(service): """Enumerate a stateless switch, like a single button.""" # A stateless switch that has a SERVICE_LABEL_INDEX is part of a group # And is handled separately if service.has(CharacteristicsTypes.SERVICE_LABEL_INDEX): if len(service.linked) > 0: ...
[ "def", "enumerate_stateless_switch", "(", "service", ")", ":", "# A stateless switch that has a SERVICE_LABEL_INDEX is part of a group", "# And is handled separately", "if", "service", ".", "has", "(", "CharacteristicsTypes", ".", "SERVICE_LABEL_INDEX", ")", ":", "if", "len", ...
[ 96, 0 ]
[ 121, 18 ]
python
en
['en', 'en', 'en']
True
enumerate_stateless_switch_group
(service)
Enumerate a group of stateless switches, like a remote control.
Enumerate a group of stateless switches, like a remote control.
def enumerate_stateless_switch_group(service): """Enumerate a group of stateless switches, like a remote control.""" switches = list( service.accessory.services.filter( service_type=ServicesTypes.STATELESS_PROGRAMMABLE_SWITCH, child_service=service, order_by=[Characte...
[ "def", "enumerate_stateless_switch_group", "(", "service", ")", ":", "switches", "=", "list", "(", "service", ".", "accessory", ".", "services", ".", "filter", "(", "service_type", "=", "ServicesTypes", ".", "STATELESS_PROGRAMMABLE_SWITCH", ",", "child_service", "="...
[ 124, 0 ]
[ 151, 18 ]
python
en
['en', 'en', 'en']
True
enumerate_doorbell
(service)
Enumerate doorbell buttons.
Enumerate doorbell buttons.
def enumerate_doorbell(service): """Enumerate doorbell buttons.""" input_event = service[CharacteristicsTypes.INPUT_EVENT] # HomeKit itself supports single, double and long presses. But the # manufacturer might not - clamp options to what they say. all_values = clamp_enum_to_char(InputEventValues, ...
[ "def", "enumerate_doorbell", "(", "service", ")", ":", "input_event", "=", "service", "[", "CharacteristicsTypes", ".", "INPUT_EVENT", "]", "# HomeKit itself supports single, double and long presses. But the", "# manufacturer might not - clamp options to what they say.", "all_values"...
[ 154, 0 ]
[ 172, 18 ]
python
en
['en', 'en', 'en']
True
async_setup_triggers_for_entry
(hass: HomeAssistant, config_entry)
Triggers aren't entities as they have no state, but we still need to set them up for a config entry.
Triggers aren't entities as they have no state, but we still need to set them up for a config entry.
async def async_setup_triggers_for_entry(hass: HomeAssistant, config_entry): """Triggers aren't entities as they have no state, but we still need to set them up for a config entry.""" hkid = config_entry.data["AccessoryPairingID"] conn = hass.data[KNOWN_DEVICES][hkid] @callback def async_add_servic...
[ "async", "def", "async_setup_triggers_for_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ")", ":", "hkid", "=", "config_entry", ".", "data", "[", "\"AccessoryPairingID\"", "]", "conn", "=", "hass", ".", "data", "[", "KNOWN_DEVICES", "]", "[", ...
[ 182, 0 ]
[ 215, 40 ]
python
en
['en', 'en', 'en']
True
async_fire_triggers
(conn, events)
Process events generated by a HomeKit accessory into automation triggers.
Process events generated by a HomeKit accessory into automation triggers.
def async_fire_triggers(conn, events): """Process events generated by a HomeKit accessory into automation triggers.""" for (aid, iid), ev in events.items(): if aid in conn.devices: device_id = conn.devices[aid] if device_id in conn.hass.data[TRIGGERS]: source = co...
[ "def", "async_fire_triggers", "(", "conn", ",", "events", ")", ":", "for", "(", "aid", ",", "iid", ")", ",", "ev", "in", "events", ".", "items", "(", ")", ":", "if", "aid", "in", "conn", ".", "devices", ":", "device_id", "=", "conn", ".", "devices"...
[ 218, 0 ]
[ 225, 36 ]
python
en
['en', 'en', 'en']
True
async_get_triggers
(hass: HomeAssistant, device_id: str)
List device triggers for homekit devices.
List device triggers for homekit devices.
async def async_get_triggers(hass: HomeAssistant, device_id: str) -> List[dict]: """List device triggers for homekit devices.""" if device_id not in hass.data.get(TRIGGERS, {}): return [] device = hass.data[TRIGGERS][device_id] triggers = [] for trigger, subtype in device.async_get_trigg...
[ "async", "def", "async_get_triggers", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ")", "->", "List", "[", "dict", "]", ":", "if", "device_id", "not", "in", "hass", ".", "data", ".", "get", "(", "TRIGGERS", ",", "{", "}", ")", ":"...
[ 228, 0 ]
[ 249, 19 ]
python
en
['da', '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) device_id = config[CONF_DEVICE_ID] device = hass.data[TRIGGERS][device_id] return...
[ "async", "def", "async_attach_trigger", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ",", "action", ":", "AutomationActionType", ",", "automation_info", ":", "dict", ",", ")", "->", "CALLBACK_TYPE", ":", "config", "=", "TRIGGER_SCHEMA", "...
[ 252, 0 ]
[ 263, 77 ]
python
en
['en', 'lb', 'en']
True
TriggerSource.__init__
(self, connection, aid, triggers)
Initialize a set of triggers for a device.
Initialize a set of triggers for a device.
def __init__(self, connection, aid, triggers): """Initialize a set of triggers for a device.""" self._hass = connection.hass self._connection = connection self._aid = aid self._triggers = {} for trigger in triggers: self._triggers[(trigger["type"], trigger["su...
[ "def", "__init__", "(", "self", ",", "connection", ",", "aid", ",", "triggers", ")", ":", "self", ".", "_hass", "=", "connection", ".", "hass", "self", ".", "_connection", "=", "connection", "self", ".", "_aid", "=", "aid", "self", ".", "_triggers", "=...
[ 51, 4 ]
[ 59, 28 ]
python
en
['en', 'en', 'en']
True
TriggerSource.fire
(self, iid, value)
Process events that have been received from a HomeKit accessory.
Process events that have been received from a HomeKit accessory.
def fire(self, iid, value): """Process events that have been received from a HomeKit accessory.""" for event_handler in self._callbacks.get(iid, []): event_handler(value)
[ "def", "fire", "(", "self", ",", "iid", ",", "value", ")", ":", "for", "event_handler", "in", "self", ".", "_callbacks", ".", "get", "(", "iid", ",", "[", "]", ")", ":", "event_handler", "(", "value", ")" ]
[ 61, 4 ]
[ 64, 32 ]
python
en
['en', 'en', 'en']
True
TriggerSource.async_get_triggers
(self)
List device triggers for homekit devices.
List device triggers for homekit devices.
def async_get_triggers(self): """List device triggers for homekit devices.""" yield from self._triggers
[ "def", "async_get_triggers", "(", "self", ")", ":", "yield", "from", "self", ".", "_triggers" ]
[ 66, 4 ]
[ 68, 33 ]
python
en
['da', 'en', 'en']
True
TriggerSource.async_attach_trigger
( self, config: TRIGGER_SCHEMA, action: AutomationActionType, automation_info: dict, )
Attach a trigger.
Attach a trigger.
async def async_attach_trigger( self, config: TRIGGER_SCHEMA, action: AutomationActionType, automation_info: dict, ) -> CALLBACK_TYPE: """Attach a trigger.""" def event_handler(char): if config[CONF_SUBTYPE] != HK_TO_HA_INPUT_EVENT_VALUES[char["value"]]: ...
[ "async", "def", "async_attach_trigger", "(", "self", ",", "config", ":", "TRIGGER_SCHEMA", ",", "action", ":", "AutomationActionType", ",", "automation_info", ":", "dict", ",", ")", "->", "CALLBACK_TYPE", ":", "def", "event_handler", "(", "char", ")", ":", "if...
[ 70, 4 ]
[ 93, 35 ]
python
en
['en', 'lb', 'en']
True
setup_scanner
(hass, config, see, discovery_info=None)
Set up the Bluetooth LE Scanner.
Set up the Bluetooth LE Scanner.
def setup_scanner(hass, config, see, discovery_info=None): """Set up the Bluetooth LE Scanner.""" new_devices = {} hass.data.setdefault(DATA_BLE, {DATA_BLE_ADAPTER: None}) def handle_stop(event): """Try to shut down the bluetooth child process nicely.""" # These should never be unset a...
[ "def", "setup_scanner", "(", "hass", ",", "config", ",", "see", ",", "discovery_info", "=", "None", ")", ":", "new_devices", "=", "{", "}", "hass", ".", "data", ".", "setdefault", "(", "DATA_BLE", ",", "{", "DATA_BLE_ADAPTER", ":", "None", "}", ")", "d...
[ 48, 0 ]
[ 200, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the OpenTherm Gateway sensors.
Set up the OpenTherm Gateway sensors.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the OpenTherm Gateway sensors.""" sensors = [] for var, info in SENSOR_INFO.items(): device_class = info[0] unit = info[1] friendly_name_format = info[2] sensors.append( OpenThermSensor...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "sensors", "=", "[", "]", "for", "var", ",", "info", "in", "SENSOR_INFO", ".", "items", "(", ")", ":", "device_class", "=", "info", "[", "0", "]",...
[ 15, 0 ]
[ 32, 31 ]
python
en
['en', 'ny', 'en']
True
OpenThermSensor.__init__
(self, gw_dev, var, device_class, unit, friendly_name_format)
Initialize the OpenTherm Gateway sensor.
Initialize the OpenTherm Gateway sensor.
def __init__(self, gw_dev, var, device_class, unit, friendly_name_format): """Initialize the OpenTherm Gateway sensor.""" self.entity_id = async_generate_entity_id( ENTITY_ID_FORMAT, f"{var}_{gw_dev.gw_id}", hass=gw_dev.hass ) self._gateway = gw_dev self._var = var ...
[ "def", "__init__", "(", "self", ",", "gw_dev", ",", "var", ",", "device_class", ",", "unit", ",", "friendly_name_format", ")", ":", "self", ".", "entity_id", "=", "async_generate_entity_id", "(", "ENTITY_ID_FORMAT", ",", "f\"{var}_{gw_dev.gw_id}\"", ",", "hass", ...
[ 38, 4 ]
[ 49, 34 ]
python
en
['en', 'en', 'en']
True
OpenThermSensor.async_added_to_hass
(self)
Subscribe to updates from the component.
Subscribe to updates from the component.
async def async_added_to_hass(self): """Subscribe to updates from the component.""" _LOGGER.debug("Added OpenTherm Gateway sensor %s", self._friendly_name) self._unsub_updates = async_dispatcher_connect( self.hass, self._gateway.update_signal, self.receive_report )
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Added OpenTherm Gateway sensor %s\"", ",", "self", ".", "_friendly_name", ")", "self", ".", "_unsub_updates", "=", "async_dispatcher_connect", "(", "self", ".", "hass", ...
[ 51, 4 ]
[ 56, 9 ]
python
en
['en', 'en', 'en']
True
OpenThermSensor.async_will_remove_from_hass
(self)
Unsubscribe from updates from the component.
Unsubscribe from updates from the component.
async def async_will_remove_from_hass(self): """Unsubscribe from updates from the component.""" _LOGGER.debug("Removing OpenTherm Gateway sensor %s", self._friendly_name) self._unsub_updates()
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Removing OpenTherm Gateway sensor %s\"", ",", "self", ".", "_friendly_name", ")", "self", ".", "_unsub_updates", "(", ")" ]
[ 58, 4 ]
[ 61, 29 ]
python
en
['en', 'en', 'en']
True
OpenThermSensor.available
(self)
Return availability of the sensor.
Return availability of the sensor.
def available(self): """Return availability of the sensor.""" return self._value is not None
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_value", "is", "not", "None" ]
[ 64, 4 ]
[ 66, 38 ]
python
en
['en', 'ga', 'en']
True
OpenThermSensor.entity_registry_enabled_default
(self)
Disable sensors by default.
Disable sensors by default.
def entity_registry_enabled_default(self): """Disable sensors by default.""" return False
[ "def", "entity_registry_enabled_default", "(", "self", ")", ":", "return", "False" ]
[ 69, 4 ]
[ 71, 20 ]
python
en
['en', 'fr', 'en']
True
OpenThermSensor.receive_report
(self, status)
Handle status updates from the component.
Handle status updates from the component.
def receive_report(self, status): """Handle status updates from the component.""" value = status.get(self._var) if isinstance(value, float): value = f"{value:2.1f}" self._value = value self.async_write_ha_state()
[ "def", "receive_report", "(", "self", ",", "status", ")", ":", "value", "=", "status", ".", "get", "(", "self", ".", "_var", ")", "if", "isinstance", "(", "value", ",", "float", ")", ":", "value", "=", "f\"{value:2.1f}\"", "self", ".", "_value", "=", ...
[ 74, 4 ]
[ 80, 35 ]
python
en
['en', 'en', 'en']
True
OpenThermSensor.name
(self)
Return the friendly name of the sensor.
Return the friendly name of the sensor.
def name(self): """Return the friendly name of the sensor.""" return self._friendly_name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_friendly_name" ]
[ 83, 4 ]
[ 85, 34 ]
python
en
['en', 'ig', 'en']
True
OpenThermSensor.device_info
(self)
Return device info.
Return device info.
def device_info(self): """Return device info.""" return { "identifiers": {(DOMAIN, self._gateway.gw_id)}, "name": self._gateway.name, "manufacturer": "Schelte Bron", "model": "OpenTherm Gateway", "sw_version": self._gateway.gw_version, ...
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_gateway", ".", "gw_id", ")", "}", ",", "\"name\"", ":", "self", ".", "_gateway", ".", "name", ",", "\"manufacturer\"", ":", "\"S...
[ 88, 4 ]
[ 96, 9 ]
python
en
['es', 'hr', 'en']
False
OpenThermSensor.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self): """Return a unique ID.""" return f"{self._gateway.gw_id}-{self._var}"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"{self._gateway.gw_id}-{self._var}\"" ]
[ 99, 4 ]
[ 101, 51 ]
python
ca
['fr', 'ca', 'en']
False
OpenThermSensor.device_class
(self)
Return the device class.
Return the device class.
def device_class(self): """Return the device class.""" return self._device_class
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_device_class" ]
[ 104, 4 ]
[ 106, 33 ]
python
en
['en', 'en', 'en']
True
OpenThermSensor.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._value
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_value" ]
[ 109, 4 ]
[ 111, 26 ]
python
en
['en', 'en', 'en']
True
OpenThermSensor.unit_of_measurement
(self)
Return the unit of measurement.
Return the unit of measurement.
def unit_of_measurement(self): """Return the unit of measurement.""" return self._unit
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit" ]
[ 114, 4 ]
[ 116, 25 ]
python
en
['en', 'la', 'en']
True
OpenThermSensor.should_poll
(self)
Return False because entity pushes its state.
Return False because entity pushes its state.
def should_poll(self): """Return False because entity pushes its state.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 119, 4 ]
[ 121, 20 ]
python
en
['en', 'en', 'en']
True
manager
()
Return a flow manager.
Return a flow manager.
def manager(): """Return a flow manager.""" handlers = Registry() entries = [] class FlowManager(data_entry_flow.FlowManager): """Test flow manager.""" async def async_create_flow(self, handler_key, *, context, data): """Test create flow.""" handler = handlers.g...
[ "def", "manager", "(", ")", ":", "handlers", "=", "Registry", "(", ")", "entries", "=", "[", "]", "class", "FlowManager", "(", "data_entry_flow", ".", "FlowManager", ")", ":", "\"\"\"Test flow manager.\"\"\"", "async", "def", "async_create_flow", "(", "self", ...
[ 11, 0 ]
[ 40, 14 ]
python
en
['en', 'da', 'en']
True
test_configure_reuses_handler_instance
(manager)
Test that we reuse instances.
Test that we reuse instances.
async def test_configure_reuses_handler_instance(manager): """Test that we reuse instances.""" @manager.mock_reg_handler("test") class TestFlow(data_entry_flow.FlowHandler): handle_count = 0 async def async_step_init(self, user_input=None): self.handle_count += 1 re...
[ "async", "def", "test_configure_reuses_handler_instance", "(", "manager", ")", ":", "@", "manager", ".", "mock_reg_handler", "(", "\"test\"", ")", "class", "TestFlow", "(", "data_entry_flow", ".", "FlowHandler", ")", ":", "handle_count", "=", "0", "async", "def", ...
[ 43, 0 ]
[ 68, 49 ]
python
en
['en', 'fr', 'en']
True