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
AmcrestChecker.available
(self)
Return if camera's API is responding.
Return if camera's API is responding.
def available(self): """Return if camera's API is responding.""" return self._wrap_errors <= MAX_ERRORS and not self._wrap_login_err
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_wrap_errors", "<=", "MAX_ERRORS", "and", "not", "self", ".", "_wrap_login_err" ]
[ 138, 4 ]
[ 140, 75 ]
python
en
['en', 'no', 'en']
True
AmcrestChecker.available_flag
(self)
Return threading event flag that indicates if camera's API is responding.
Return threading event flag that indicates if camera's API is responding.
def available_flag(self): """Return threading event flag that indicates if camera's API is responding.""" return self._wrap_event_flag
[ "def", "available_flag", "(", "self", ")", ":", "return", "self", ".", "_wrap_event_flag" ]
[ 143, 4 ]
[ 145, 36 ]
python
en
['en', 'en', 'en']
True
AmcrestChecker.command
(self, *args, **kwargs)
amcrest.Http.command wrapper to catch errors.
amcrest.Http.command wrapper to catch errors.
def command(self, *args, **kwargs): """amcrest.Http.command wrapper to catch errors.""" try: ret = super().command(*args, **kwargs) except LoginError as ex: with self._wrap_lock: was_online = self.available was_login_err = self._wrap_login_...
[ "def", "command", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "ret", "=", "super", "(", ")", ".", "command", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "LoginError", "as", "ex", ":", "with", "sel...
[ 154, 4 ]
[ 188, 18 ]
python
en
['en', 'en', 'en']
True
AmcrestChecker._wrap_test_online
(self, now)
Test if camera is back online.
Test if camera is back online.
def _wrap_test_online(self, now): """Test if camera is back online.""" _LOGGER.debug("Testing if %s back online", self._wrap_name) try: self.current_time except AmcrestError: pass
[ "def", "_wrap_test_online", "(", "self", ",", "now", ")", ":", "_LOGGER", ".", "debug", "(", "\"Testing if %s back online\"", ",", "self", ".", "_wrap_name", ")", "try", ":", "self", ".", "current_time", "except", "AmcrestError", ":", "pass" ]
[ 190, 4 ]
[ 196, 16 ]
python
en
['en', 'en', 'en']
True
AmcrestDevice.__init__
( self, api, authentication, ffmpeg_arguments, stream_source, resolution, control_light, )
Initialize the entity.
Initialize the entity.
def __init__( self, api, authentication, ffmpeg_arguments, stream_source, resolution, control_light, ): """Initialize the entity.""" self.api = api self.authentication = authentication self.ffmpeg_arguments = ffmpeg_arguments ...
[ "def", "__init__", "(", "self", ",", "api", ",", "authentication", ",", "ffmpeg_arguments", ",", "stream_source", ",", "resolution", ",", "control_light", ",", ")", ":", "self", ".", "api", "=", "api", "self", ".", "authentication", "=", "authentication", "s...
[ 336, 4 ]
[ 351, 42 ]
python
en
['en', 'en', 'en']
True
test_hassio_discovery_startup
(hass, aioclient_mock, hassio_client)
Test startup and discovery after event.
Test startup and discovery after event.
async def test_hassio_discovery_startup(hass, aioclient_mock, hassio_client): """Test startup and discovery after event.""" aioclient_mock.get( "http://127.0.0.1/discovery", json={ "result": "ok", "data": { "discovery": [ { ...
[ "async", "def", "test_hassio_discovery_startup", "(", "hass", ",", "aioclient_mock", ",", "hassio_client", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://127.0.0.1/discovery\"", ",", "json", "=", "{", "\"result\"", ":", "\"ok\"", ",", "\"data\"", ":", "{",...
[ 8, 0 ]
[ 57, 9 ]
python
en
['en', 'en', 'en']
True
test_hassio_discovery_startup_done
(hass, aioclient_mock, hassio_client)
Test startup and discovery with hass discovery.
Test startup and discovery with hass discovery.
async def test_hassio_discovery_startup_done(hass, aioclient_mock, hassio_client): """Test startup and discovery with hass discovery.""" aioclient_mock.post( "http://127.0.0.1/supervisor/options", json={"result": "ok", "data": {}}, ) aioclient_mock.get( "http://127.0.0.1/discover...
[ "async", "def", "test_hassio_discovery_startup_done", "(", "hass", ",", "aioclient_mock", ",", "hassio_client", ")", ":", "aioclient_mock", ".", "post", "(", "\"http://127.0.0.1/supervisor/options\"", ",", "json", "=", "{", "\"result\"", ":", "\"ok\"", ",", "\"data\""...
[ 60, 0 ]
[ 118, 9 ]
python
en
['en', 'en', 'en']
True
test_hassio_discovery_webhook
(hass, aioclient_mock, hassio_client)
Test discovery webhook.
Test discovery webhook.
async def test_hassio_discovery_webhook(hass, aioclient_mock, hassio_client): """Test discovery webhook.""" aioclient_mock.get( "http://127.0.0.1/discovery/testuuid", json={ "result": "ok", "data": { "service": "mqtt", "uuid": "test", ...
[ "async", "def", "test_hassio_discovery_webhook", "(", "hass", ",", "aioclient_mock", ",", "hassio_client", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://127.0.0.1/discovery/testuuid\"", ",", "json", "=", "{", "\"result\"", ":", "\"ok\"", ",", "\"data\"", ":...
[ 121, 0 ]
[ 168, 9 ]
python
en
['en', 'en', 'en']
True
mock_storage
(hass_storage, data)
Mock the onboarding storage.
Mock the onboarding storage.
def mock_storage(hass_storage, data): """Mock the onboarding storage.""" hass_storage[onboarding.STORAGE_KEY] = { "version": onboarding.STORAGE_VERSION, "data": data, }
[ "def", "mock_storage", "(", "hass_storage", ",", "data", ")", ":", "hass_storage", "[", "onboarding", ".", "STORAGE_KEY", "]", "=", "{", "\"version\"", ":", "onboarding", ".", "STORAGE_VERSION", ",", "\"data\"", ":", "data", ",", "}" ]
[ 5, 0 ]
[ 10, 5 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the sensor platform.
Set up the sensor platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the sensor platform.""" username = config[CONF_USERNAME] password = config[CONF_PASSWORD] counter_id = config[CONF_COUNTER_ID] try: client = SuezClient(username, password, counter_id) if not client.check_...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "username", "=", "config", "[", "CONF_USERNAME", "]", "password", "=", "config", "[", "CONF_PASSWORD", "]", "counter_id", "=", "config", "...
[ 30, 0 ]
[ 46, 44 ]
python
en
['en', 'da', 'en']
True
SuezSensor.__init__
(self, client)
Initialize the data object.
Initialize the data object.
def __init__(self, client): """Initialize the data object.""" self._attributes = {} self._state = None self._available = None self.client = client
[ "def", "__init__", "(", "self", ",", "client", ")", ":", "self", ".", "_attributes", "=", "{", "}", "self", ".", "_state", "=", "None", "self", ".", "_available", "=", "None", "self", ".", "client", "=", "client" ]
[ 52, 4 ]
[ 57, 28 ]
python
en
['en', 'en', 'en']
True
SuezSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return COMPONENT_NAME
[ "def", "name", "(", "self", ")", ":", "return", "COMPONENT_NAME" ]
[ 60, 4 ]
[ 62, 29 ]
python
en
['en', 'mi', 'en']
True
SuezSensor.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" ]
[ 65, 4 ]
[ 67, 26 ]
python
en
['en', 'en', 'en']
True
SuezSensor.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 VOLUME_LITERS
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "VOLUME_LITERS" ]
[ 70, 4 ]
[ 72, 28 ]
python
en
['en', 'la', 'en']
True
SuezSensor.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" return self._attributes
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_attributes" ]
[ 75, 4 ]
[ 77, 31 ]
python
en
['en', 'en', 'en']
True
SuezSensor.icon
(self)
Return the icon of the sensor.
Return the icon of the sensor.
def icon(self): """Return the icon of the sensor.""" return COMPONENT_ICON
[ "def", "icon", "(", "self", ")", ":", "return", "COMPONENT_ICON" ]
[ 80, 4 ]
[ 82, 29 ]
python
en
['en', 'en', 'en']
True
SuezSensor._fetch_data
(self)
Fetch latest data from Suez.
Fetch latest data from Suez.
def _fetch_data(self): """Fetch latest data from Suez.""" try: self.client.update() # _state holds the volume of consumed water during previous day self._state = self.client.state self._available = True self._attributes["attribution"] = self.cl...
[ "def", "_fetch_data", "(", "self", ")", ":", "try", ":", "self", ".", "client", ".", "update", "(", ")", "# _state holds the volume of consumed water during previous day", "self", ".", "_state", "=", "self", ".", "client", ".", "state", "self", ".", "_available"...
[ 84, 4 ]
[ 119, 51 ]
python
en
['en', 'pl', 'en']
True
SuezSensor.update
(self)
Return the latest collected data from Linky.
Return the latest collected data from Linky.
def update(self): """Return the latest collected data from Linky.""" self._fetch_data() _LOGGER.debug("Suez data state is: %s", self._state)
[ "def", "update", "(", "self", ")", ":", "self", ".", "_fetch_data", "(", ")", "_LOGGER", ".", "debug", "(", "\"Suez data state is: %s\"", ",", "self", ".", "_state", ")" ]
[ 121, 4 ]
[ 124, 60 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the deCONZ lights and groups from a config entry.
Set up the deCONZ lights and groups from a config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the deCONZ lights and groups from a config entry.""" gateway = get_gateway_from_config_entry(hass, config_entry) gateway.entities[DOMAIN] = set() @callback def async_add_light(lights): """Add light from deCONZ.""...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "gateway", "=", "get_gateway_from_config_entry", "(", "hass", ",", "config_entry", ")", "gateway", ".", "entities", "[", "DOMAIN", "]", "=", "set", "(", ...
[ 37, 0 ]
[ 90, 48 ]
python
en
['en', 'en', 'en']
True
DeconzBaseLight.__init__
(self, device, gateway)
Set up light.
Set up light.
def __init__(self, device, gateway): """Set up light.""" super().__init__(device, gateway) self._features = 0 if self._device.brightness is not None: self._features |= SUPPORT_BRIGHTNESS self._features |= SUPPORT_FLASH self._features |= SUPPORT_TRANS...
[ "def", "__init__", "(", "self", ",", "device", ",", "gateway", ")", ":", "super", "(", ")", ".", "__init__", "(", "device", ",", "gateway", ")", "self", ".", "_features", "=", "0", "if", "self", ".", "_device", ".", "brightness", "is", "not", "None",...
[ 98, 4 ]
[ 116, 44 ]
python
en
['en', 'ky', 'en']
True
DeconzBaseLight.brightness
(self)
Return the brightness of this light between 0..255.
Return the brightness of this light between 0..255.
def brightness(self): """Return the brightness of this light between 0..255.""" return self._device.brightness
[ "def", "brightness", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "brightness" ]
[ 119, 4 ]
[ 121, 38 ]
python
en
['en', 'en', 'en']
True
DeconzBaseLight.effect_list
(self)
Return the list of supported effects.
Return the list of supported effects.
def effect_list(self): """Return the list of supported effects.""" return [EFFECT_COLORLOOP]
[ "def", "effect_list", "(", "self", ")", ":", "return", "[", "EFFECT_COLORLOOP", "]" ]
[ 124, 4 ]
[ 126, 33 ]
python
en
['en', 'en', 'en']
True
DeconzBaseLight.color_temp
(self)
Return the CT color value.
Return the CT color value.
def color_temp(self): """Return the CT color value.""" if self._device.colormode != "ct": return None return self._device.ct
[ "def", "color_temp", "(", "self", ")", ":", "if", "self", ".", "_device", ".", "colormode", "!=", "\"ct\"", ":", "return", "None", "return", "self", ".", "_device", ".", "ct" ]
[ 129, 4 ]
[ 134, 30 ]
python
en
['en', 'en', 'en']
True
DeconzBaseLight.hs_color
(self)
Return the hs color value.
Return the hs color value.
def hs_color(self): """Return the hs color value.""" if self._device.colormode in ("xy", "hs") and self._device.xy: return color_util.color_xy_to_hs(*self._device.xy) return None
[ "def", "hs_color", "(", "self", ")", ":", "if", "self", ".", "_device", ".", "colormode", "in", "(", "\"xy\"", ",", "\"hs\"", ")", "and", "self", ".", "_device", ".", "xy", ":", "return", "color_util", ".", "color_xy_to_hs", "(", "*", "self", ".", "_...
[ 137, 4 ]
[ 141, 19 ]
python
en
['en', 'en', 'en']
True
DeconzBaseLight.is_on
(self)
Return true if light is on.
Return true if light is on.
def is_on(self): """Return true if light is on.""" return self._device.state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "state" ]
[ 144, 4 ]
[ 146, 33 ]
python
en
['en', 'et', 'en']
True
DeconzBaseLight.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" return self._features
[ "def", "supported_features", "(", "self", ")", ":", "return", "self", ".", "_features" ]
[ 149, 4 ]
[ 151, 29 ]
python
en
['da', 'en', 'en']
True
DeconzBaseLight.async_turn_on
(self, **kwargs)
Turn on light.
Turn on light.
async def async_turn_on(self, **kwargs): """Turn on light.""" data = {"on": True} if ATTR_COLOR_TEMP in kwargs: data["ct"] = kwargs[ATTR_COLOR_TEMP] if ATTR_HS_COLOR in kwargs: data["xy"] = color_util.color_hs_to_xy(*kwargs[ATTR_HS_COLOR]) if ATTR_BRIGH...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"on\"", ":", "True", "}", "if", "ATTR_COLOR_TEMP", "in", "kwargs", ":", "data", "[", "\"ct\"", "]", "=", "kwargs", "[", "ATTR_COLOR_TEMP", "]", "if", ...
[ 153, 4 ]
[ 185, 48 ]
python
en
['en', 'et', 'en']
True
DeconzBaseLight.async_turn_off
(self, **kwargs)
Turn off light.
Turn off light.
async def async_turn_off(self, **kwargs): """Turn off light.""" if not self._device.state: return data = {"on": False} if ATTR_TRANSITION in kwargs: data["bri"] = 0 data["transitiontime"] = int(kwargs[ATTR_TRANSITION] * 10) if ATTR_FLASH in ...
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "_device", ".", "state", ":", "return", "data", "=", "{", "\"on\"", ":", "False", "}", "if", "ATTR_TRANSITION", "in", "kwargs", ":", "data", "...
[ 187, 4 ]
[ 206, 48 ]
python
en
['en', 'zh', 'en']
True
DeconzBaseLight.device_state_attributes
(self)
Return the device state attributes.
Return the device state attributes.
def device_state_attributes(self): """Return the device state attributes.""" return {"is_deconz_group": self._device.type == "LightGroup"}
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "\"is_deconz_group\"", ":", "self", ".", "_device", ".", "type", "==", "\"LightGroup\"", "}" ]
[ 209, 4 ]
[ 211, 69 ]
python
en
['en', 'en', 'en']
True
DeconzLight.max_mireds
(self)
Return the warmest color_temp that this light supports.
Return the warmest color_temp that this light supports.
def max_mireds(self): """Return the warmest color_temp that this light supports.""" return self._device.ctmax or super().max_mireds
[ "def", "max_mireds", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "ctmax", "or", "super", "(", ")", ".", "max_mireds" ]
[ 218, 4 ]
[ 220, 55 ]
python
en
['en', 'en', 'en']
True
DeconzLight.min_mireds
(self)
Return the coldest color_temp that this light supports.
Return the coldest color_temp that this light supports.
def min_mireds(self): """Return the coldest color_temp that this light supports.""" return self._device.ctmin or super().min_mireds
[ "def", "min_mireds", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "ctmin", "or", "super", "(", ")", ".", "min_mireds" ]
[ 223, 4 ]
[ 225, 55 ]
python
en
['en', 'en', 'en']
True
DeconzGroup.__init__
(self, device, gateway)
Set up group and create an unique id.
Set up group and create an unique id.
def __init__(self, device, gateway): """Set up group and create an unique id.""" group_id_base = gateway.config_entry.unique_id if CONF_GROUP_ID_BASE in gateway.config_entry.data: group_id_base = gateway.config_entry.data[CONF_GROUP_ID_BASE] self._unique_id = f"{group_id_base...
[ "def", "__init__", "(", "self", ",", "device", ",", "gateway", ")", ":", "group_id_base", "=", "gateway", ".", "config_entry", ".", "unique_id", "if", "CONF_GROUP_ID_BASE", "in", "gateway", ".", "config_entry", ".", "data", ":", "group_id_base", "=", "gateway"...
[ 231, 4 ]
[ 238, 41 ]
python
en
['en', 'en', 'en']
True
DeconzGroup.unique_id
(self)
Return a unique identifier for this device.
Return a unique identifier for this device.
def unique_id(self): """Return a unique identifier for this device.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 241, 4 ]
[ 243, 30 ]
python
en
['en', 'en', 'en']
True
DeconzGroup.device_info
(self)
Return a device description for device registry.
Return a device description for device registry.
def device_info(self): """Return a device description for device registry.""" bridgeid = self.gateway.api.config.bridgeid return { "identifiers": {(DECONZ_DOMAIN, self.unique_id)}, "manufacturer": "Dresden Elektronik", "model": "deCONZ group", "na...
[ "def", "device_info", "(", "self", ")", ":", "bridgeid", "=", "self", ".", "gateway", ".", "api", ".", "config", ".", "bridgeid", "return", "{", "\"identifiers\"", ":", "{", "(", "DECONZ_DOMAIN", ",", "self", ".", "unique_id", ")", "}", ",", "\"manufactu...
[ 246, 4 ]
[ 256, 9 ]
python
en
['ro', 'fr', 'en']
False
DeconzGroup.device_state_attributes
(self)
Return the device state attributes.
Return the device state attributes.
def device_state_attributes(self): """Return the device state attributes.""" attributes = dict(super().device_state_attributes) attributes["all_on"] = self._device.all_on return attributes
[ "def", "device_state_attributes", "(", "self", ")", ":", "attributes", "=", "dict", "(", "super", "(", ")", ".", "device_state_attributes", ")", "attributes", "[", "\"all_on\"", "]", "=", "self", ".", "_device", ".", "all_on", "return", "attributes" ]
[ 259, 4 ]
[ 264, 25 ]
python
en
['en', 'en', 'en']
True
InsteonEntity.__init__
(self, device, group)
Initialize the INSTEON binary sensor.
Initialize the INSTEON binary sensor.
def __init__(self, device, group): """Initialize the INSTEON binary sensor.""" self._insteon_device_group = device.groups[group] self._insteon_device = device
[ "def", "__init__", "(", "self", ",", "device", ",", "group", ")", ":", "self", ".", "_insteon_device_group", "=", "device", ".", "groups", "[", "group", "]", "self", ".", "_insteon_device", "=", "device" ]
[ 29, 4 ]
[ 32, 37 ]
python
en
['en', 'pl', 'en']
True
InsteonEntity.__hash__
(self)
Return the hash of the Insteon Entity.
Return the hash of the Insteon Entity.
def __hash__(self): """Return the hash of the Insteon Entity.""" return hash(self._insteon_device)
[ "def", "__hash__", "(", "self", ")", ":", "return", "hash", "(", "self", ".", "_insteon_device", ")" ]
[ 34, 4 ]
[ 36, 41 ]
python
en
['en', 'en', 'en']
True
InsteonEntity.should_poll
(self)
No polling needed.
No polling needed.
def should_poll(self): """No polling needed.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 39, 4 ]
[ 41, 20 ]
python
en
['en', 'en', 'en']
True
InsteonEntity.address
(self)
Return the address of the node.
Return the address of the node.
def address(self): """Return the address of the node.""" return str(self._insteon_device.address)
[ "def", "address", "(", "self", ")", ":", "return", "str", "(", "self", ".", "_insteon_device", ".", "address", ")" ]
[ 44, 4 ]
[ 46, 48 ]
python
en
['en', 'en', 'en']
True
InsteonEntity.group
(self)
Return the INSTEON group that the entity responds to.
Return the INSTEON group that the entity responds to.
def group(self): """Return the INSTEON group that the entity responds to.""" return self._insteon_device_group.group
[ "def", "group", "(", "self", ")", ":", "return", "self", ".", "_insteon_device_group", ".", "group" ]
[ 49, 4 ]
[ 51, 47 ]
python
en
['en', 'en', 'en']
True
InsteonEntity.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self) -> str: """Return a unique ID.""" if self._insteon_device_group.group == 0x01: uid = self._insteon_device.id else: uid = f"{self._insteon_device.id}_{self._insteon_device_group.group}" return uid
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "if", "self", ".", "_insteon_device_group", ".", "group", "==", "0x01", ":", "uid", "=", "self", ".", "_insteon_device", ".", "id", "else", ":", "uid", "=", "f\"{self._insteon_device.id}_{self._insteon_de...
[ 54, 4 ]
[ 60, 18 ]
python
ca
['fr', 'ca', 'en']
False
InsteonEntity.name
(self)
Return the name of the node (used for Entity_ID).
Return the name of the node (used for Entity_ID).
def name(self): """Return the name of the node (used for Entity_ID).""" # Set a base description description = self._insteon_device.description if description is None: description = "Unknown Device" # Get an extension label if there is one extension = self._ge...
[ "def", "name", "(", "self", ")", ":", "# Set a base description", "description", "=", "self", ".", "_insteon_device", ".", "description", "if", "description", "is", "None", ":", "description", "=", "\"Unknown Device\"", "# Get an extension label if there is one", "exten...
[ 63, 4 ]
[ 73, 73 ]
python
en
['en', 'en', 'en']
True
InsteonEntity.device_state_attributes
(self)
Provide attributes for display on device card.
Provide attributes for display on device card.
def device_state_attributes(self): """Provide attributes for display on device card.""" return {"insteon_address": self.address, "insteon_group": self.group}
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "\"insteon_address\"", ":", "self", ".", "address", ",", "\"insteon_group\"", ":", "self", ".", "group", "}" ]
[ 76, 4 ]
[ 78, 77 ]
python
en
['en', 'en', 'en']
True
InsteonEntity.device_info
(self)
Return device information.
Return device information.
def device_info(self): """Return device information.""" return { "identifiers": {(DOMAIN, str(self._insteon_device.address))}, "name": f"{self._insteon_device.description} {self._insteon_device.address}", "model": f"{self._insteon_device.model} (0x{self._insteon_devic...
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "str", "(", "self", ".", "_insteon_device", ".", "address", ")", ")", "}", ",", "\"name\"", ":", "f\"{self._insteon_device.description} {self._insteon_de...
[ 81, 4 ]
[ 90, 9 ]
python
da
['es', 'da', 'en']
False
InsteonEntity.async_entity_update
(self, name, address, value, group)
Receive notification from transport that new data exists.
Receive notification from transport that new data exists.
def async_entity_update(self, name, address, value, group): """Receive notification from transport that new data exists.""" _LOGGER.debug( "Received update for device %s group %d value %s", address, group, value, ) self.async_write_ha_state...
[ "def", "async_entity_update", "(", "self", ",", "name", ",", "address", ",", "value", ",", "group", ")", ":", "_LOGGER", ".", "debug", "(", "\"Received update for device %s group %d value %s\"", ",", "address", ",", "group", ",", "value", ",", ")", "self", "."...
[ 93, 4 ]
[ 101, 35 ]
python
en
['en', 'en', 'en']
True
InsteonEntity.async_added_to_hass
(self)
Register INSTEON update events.
Register INSTEON update events.
async def async_added_to_hass(self): """Register INSTEON update events.""" _LOGGER.debug( "Tracking updates for device %s group %d name %s", self.address, self.group, self._insteon_device_group.name, ) self._insteon_device_group.subscribe(s...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Tracking updates for device %s group %d name %s\"", ",", "self", ".", "address", ",", "self", ".", "group", ",", "self", ".", "_insteon_device_group", ".", "name", ",", ...
[ 103, 4 ]
[ 125, 9 ]
python
en
['es', 'nl', 'en']
False
InsteonEntity.async_will_remove_from_hass
(self)
Unsubscribe to INSTEON update events.
Unsubscribe to INSTEON update events.
async def async_will_remove_from_hass(self): """Unsubscribe to INSTEON update events.""" _LOGGER.debug( "Remove tracking updates for device %s group %d name %s", self.address, self.group, self._insteon_device_group.name, ) self._insteon_dev...
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Remove tracking updates for device %s group %d name %s\"", ",", "self", ".", "address", ",", "self", ".", "group", ",", "self", ".", "_insteon_device_group", ".", ...
[ 127, 4 ]
[ 135, 72 ]
python
en
['en', 'en', 'en']
True
InsteonEntity._async_read_aldb
(self, reload)
Call device load process and print to log.
Call device load process and print to log.
async def _async_read_aldb(self, reload): """Call device load process and print to log.""" await self._insteon_device.aldb.async_load(refresh=reload) self._print_aldb() async_dispatcher_send(self.hass, SIGNAL_SAVE_DEVICES)
[ "async", "def", "_async_read_aldb", "(", "self", ",", "reload", ")", ":", "await", "self", ".", "_insteon_device", ".", "aldb", ".", "async_load", "(", "refresh", "=", "reload", ")", "self", ".", "_print_aldb", "(", ")", "async_dispatcher_send", "(", "self",...
[ 137, 4 ]
[ 141, 61 ]
python
en
['en', 'en', 'en']
True
InsteonEntity._print_aldb
(self)
Print the device ALDB to the log file.
Print the device ALDB to the log file.
def _print_aldb(self): """Print the device ALDB to the log file.""" print_aldb_to_log(self._insteon_device.aldb)
[ "def", "_print_aldb", "(", "self", ")", ":", "print_aldb_to_log", "(", "self", ".", "_insteon_device", ".", "aldb", ")" ]
[ 143, 4 ]
[ 145, 52 ]
python
en
['en', 'en', 'en']
True
InsteonEntity._get_label
(self)
Get the device label for grouped devices.
Get the device label for grouped devices.
def _get_label(self): """Get the device label for grouped devices.""" label = "" if len(self._insteon_device.groups) > 1: if self._insteon_device_group.name in STATE_NAME_LABEL_MAP: label = STATE_NAME_LABEL_MAP[self._insteon_device_group.name] else: ...
[ "def", "_get_label", "(", "self", ")", ":", "label", "=", "\"\"", "if", "len", "(", "self", ".", "_insteon_device", ".", "groups", ")", ">", "1", ":", "if", "self", ".", "_insteon_device_group", ".", "name", "in", "STATE_NAME_LABEL_MAP", ":", "label", "=...
[ 147, 4 ]
[ 155, 20 ]
python
en
['en', 'en', 'en']
True
InsteonEntity._async_add_default_links
(self)
Add default links between the device and the modem.
Add default links between the device and the modem.
async def _async_add_default_links(self): """Add default links between the device and the modem.""" await self._insteon_device.async_add_default_links()
[ "async", "def", "_async_add_default_links", "(", "self", ")", ":", "await", "self", ".", "_insteon_device", ".", "async_add_default_links", "(", ")" ]
[ 157, 4 ]
[ 159, 60 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Add a AccuWeather weather entity from a config_entry.
Add a AccuWeather weather entity from a config_entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Add a AccuWeather weather entity from a config_entry.""" name = config_entry.data[CONF_NAME] coordinator = hass.data[DOMAIN][config_entry.entry_id][COORDINATOR] async_add_entities([AccuWeatherEntity(name, coordinator)], False)
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "name", "=", "config_entry", ".", "data", "[", "CONF_NAME", "]", "coordinator", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", "."...
[ 31, 0 ]
[ 37, 69 ]
python
en
['en', 'en', 'en']
True
AccuWeatherEntity.__init__
(self, name, coordinator)
Initialize.
Initialize.
def __init__(self, name, coordinator): """Initialize.""" super().__init__(coordinator) self._name = name self._attrs = {} self._unit_system = "Metric" if self.coordinator.is_metric else "Imperial"
[ "def", "__init__", "(", "self", ",", "name", ",", "coordinator", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "_name", "=", "name", "self", ".", "_attrs", "=", "{", "}", "self", ".", "_unit_system", "=", "\"Metr...
[ 43, 4 ]
[ 48, 82 ]
python
en
['en', 'en', 'it']
False
AccuWeatherEntity.name
(self)
Return the name.
Return the name.
def name(self): """Return the name.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 51, 4 ]
[ 53, 25 ]
python
en
['en', 'ig', 'en']
True
AccuWeatherEntity.attribution
(self)
Return the attribution.
Return the attribution.
def attribution(self): """Return the attribution.""" return ATTRIBUTION
[ "def", "attribution", "(", "self", ")", ":", "return", "ATTRIBUTION" ]
[ 56, 4 ]
[ 58, 26 ]
python
en
['en', 'ja', 'en']
True
AccuWeatherEntity.unique_id
(self)
Return a unique_id for this entity.
Return a unique_id for this entity.
def unique_id(self): """Return a unique_id for this entity.""" return self.coordinator.location_key
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "coordinator", ".", "location_key" ]
[ 61, 4 ]
[ 63, 44 ]
python
en
['en', 'en', 'en']
True
AccuWeatherEntity.device_info
(self)
Return the device info.
Return the device info.
def device_info(self): """Return the device info.""" return { "identifiers": {(DOMAIN, self.coordinator.location_key)}, "name": NAME, "manufacturer": MANUFACTURER, "entry_type": "service", }
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "coordinator", ".", "location_key", ")", "}", ",", "\"name\"", ":", "NAME", ",", "\"manufacturer\"", ":", "MANUFACTURER", ",", "\"entr...
[ 66, 4 ]
[ 73, 9 ]
python
en
['en', 'en', 'en']
True
AccuWeatherEntity.condition
(self)
Return the current condition.
Return the current condition.
def condition(self): """Return the current condition.""" try: return [ k for k, v in CONDITION_CLASSES.items() if self.coordinator.data["WeatherIcon"] in v ][0] except IndexError: return None
[ "def", "condition", "(", "self", ")", ":", "try", ":", "return", "[", "k", "for", "k", ",", "v", "in", "CONDITION_CLASSES", ".", "items", "(", ")", "if", "self", ".", "coordinator", ".", "data", "[", "\"WeatherIcon\"", "]", "in", "v", "]", "[", "0"...
[ 76, 4 ]
[ 85, 23 ]
python
en
['en', 'en', 'en']
True
AccuWeatherEntity.temperature
(self)
Return the temperature.
Return the temperature.
def temperature(self): """Return the temperature.""" return self.coordinator.data["Temperature"][self._unit_system]["Value"]
[ "def", "temperature", "(", "self", ")", ":", "return", "self", ".", "coordinator", ".", "data", "[", "\"Temperature\"", "]", "[", "self", ".", "_unit_system", "]", "[", "\"Value\"", "]" ]
[ 88, 4 ]
[ 90, 79 ]
python
en
['en', 'la', 'en']
True
AccuWeatherEntity.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" return TEMP_CELSIUS if self.coordinator.is_metric else TEMP_FAHRENHEIT
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "TEMP_CELSIUS", "if", "self", ".", "coordinator", ".", "is_metric", "else", "TEMP_FAHRENHEIT" ]
[ 93, 4 ]
[ 95, 78 ]
python
en
['en', 'la', 'en']
True
AccuWeatherEntity.pressure
(self)
Return the pressure.
Return the pressure.
def pressure(self): """Return the pressure.""" return self.coordinator.data["Pressure"][self._unit_system]["Value"]
[ "def", "pressure", "(", "self", ")", ":", "return", "self", ".", "coordinator", ".", "data", "[", "\"Pressure\"", "]", "[", "self", ".", "_unit_system", "]", "[", "\"Value\"", "]" ]
[ 98, 4 ]
[ 100, 76 ]
python
en
['en', 'ig', 'en']
True
AccuWeatherEntity.humidity
(self)
Return the humidity.
Return the humidity.
def humidity(self): """Return the humidity.""" return self.coordinator.data["RelativeHumidity"]
[ "def", "humidity", "(", "self", ")", ":", "return", "self", ".", "coordinator", ".", "data", "[", "\"RelativeHumidity\"", "]" ]
[ 103, 4 ]
[ 105, 56 ]
python
en
['en', 'sw', 'en']
True
AccuWeatherEntity.wind_speed
(self)
Return the wind speed.
Return the wind speed.
def wind_speed(self): """Return the wind speed.""" return self.coordinator.data["Wind"]["Speed"][self._unit_system]["Value"]
[ "def", "wind_speed", "(", "self", ")", ":", "return", "self", ".", "coordinator", ".", "data", "[", "\"Wind\"", "]", "[", "\"Speed\"", "]", "[", "self", ".", "_unit_system", "]", "[", "\"Value\"", "]" ]
[ 108, 4 ]
[ 110, 81 ]
python
en
['en', 'zh', 'en']
True
AccuWeatherEntity.wind_bearing
(self)
Return the wind bearing.
Return the wind bearing.
def wind_bearing(self): """Return the wind bearing.""" return self.coordinator.data["Wind"]["Direction"]["Degrees"]
[ "def", "wind_bearing", "(", "self", ")", ":", "return", "self", ".", "coordinator", ".", "data", "[", "\"Wind\"", "]", "[", "\"Direction\"", "]", "[", "\"Degrees\"", "]" ]
[ 113, 4 ]
[ 115, 68 ]
python
en
['en', 'ig', 'en']
True
AccuWeatherEntity.visibility
(self)
Return the visibility.
Return the visibility.
def visibility(self): """Return the visibility.""" return self.coordinator.data["Visibility"][self._unit_system]["Value"]
[ "def", "visibility", "(", "self", ")", ":", "return", "self", ".", "coordinator", ".", "data", "[", "\"Visibility\"", "]", "[", "self", ".", "_unit_system", "]", "[", "\"Value\"", "]" ]
[ 118, 4 ]
[ 120, 78 ]
python
en
['en', 'en', 'en']
True
AccuWeatherEntity.ozone
(self)
Return the ozone level.
Return the ozone level.
def ozone(self): """Return the ozone level.""" # We only have ozone data for certain locations and only in the forecast data. if self.coordinator.forecast and self.coordinator.data[ATTR_FORECAST][0].get( "Ozone" ): return self.coordinator.data[ATTR_FORECAST][0]["O...
[ "def", "ozone", "(", "self", ")", ":", "# We only have ozone data for certain locations and only in the forecast data.", "if", "self", ".", "coordinator", ".", "forecast", "and", "self", ".", "coordinator", ".", "data", "[", "ATTR_FORECAST", "]", "[", "0", "]", ".",...
[ 123, 4 ]
[ 130, 19 ]
python
en
['en', 'zu', 'en']
True
AccuWeatherEntity.forecast
(self)
Return the forecast array.
Return the forecast array.
def forecast(self): """Return the forecast array.""" if not self.coordinator.forecast: return None # remap keys from library to keys understood by the weather component forecast = [ { ATTR_FORECAST_TIME: utc_from_timestamp(item["EpochDate"]).isofor...
[ "def", "forecast", "(", "self", ")", ":", "if", "not", "self", ".", "coordinator", ".", "forecast", ":", "return", "None", "# remap keys from library to keys understood by the weather component", "forecast", "=", "[", "{", "ATTR_FORECAST_TIME", ":", "utc_from_timestamp"...
[ 133, 4 ]
[ 160, 23 ]
python
en
['en', 'ga', 'en']
True
AccuWeatherEntity._calc_precipitation
(day: dict)
Return sum of the precipitation.
Return sum of the precipitation.
def _calc_precipitation(day: dict) -> float: """Return sum of the precipitation.""" precip_sum = 0 precip_types = ["Rain", "Snow", "Ice"] for precip in precip_types: precip_sum = sum( [ precip_sum, day[f"{precip}Day"]["V...
[ "def", "_calc_precipitation", "(", "day", ":", "dict", ")", "->", "float", ":", "precip_sum", "=", "0", "precip_types", "=", "[", "\"Rain\"", ",", "\"Snow\"", ",", "\"Ice\"", "]", "for", "precip", "in", "precip_types", ":", "precip_sum", "=", "sum", "(", ...
[ 163, 4 ]
[ 175, 35 ]
python
en
['en', 'pt', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Netio platform.
Set up the Netio platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Netio platform.""" host = config.get(CONF_HOST) username = config.get(CONF_USERNAME) password = config.get(CONF_PASSWORD) port = config.get(CONF_PORT) if not DEVICES: hass.http.register_view(NetioApiView...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "host", "=", "config", ".", "get", "(", "CONF_HOST", ")", "username", "=", "config", ".", "get", "(", "CONF_USERNAME", ")", "password", ...
[ 51, 0 ]
[ 76, 15 ]
python
en
['en', 'ky', 'en']
True
dispose
(event)
Close connections to Netio Devices.
Close connections to Netio Devices.
def dispose(event): """Close connections to Netio Devices.""" for value in DEVICES.values(): value.netio.stop()
[ "def", "dispose", "(", "event", ")", ":", "for", "value", "in", "DEVICES", ".", "values", "(", ")", ":", "value", ".", "netio", ".", "stop", "(", ")" ]
[ 79, 0 ]
[ 82, 26 ]
python
en
['en', 'en', 'en']
True
NetioApiView.get
(self, request, host)
Request handler.
Request handler.
def get(self, request, host): """Request handler.""" data = request.query states, consumptions, cumulated_consumptions, start_dates = [], [], [], [] for i in range(1, 5): out = "output%d" % i states.append(data.get("%s_state" % out) == STATE_ON) consu...
[ "def", "get", "(", "self", ",", "request", ",", "host", ")", ":", "data", "=", "request", ".", "query", "states", ",", "consumptions", ",", "cumulated_consumptions", ",", "start_dates", "=", "[", "]", ",", "[", "]", ",", "[", "]", ",", "[", "]", "f...
[ 92, 4 ]
[ 124, 30 ]
python
en
['en', 'nl', 'en']
False
NetioSwitch.__init__
(self, netio, outlet, name)
Initialize the Netio switch.
Initialize the Netio switch.
def __init__(self, netio, outlet, name): """Initialize the Netio switch.""" self._name = name self.outlet = outlet self.netio = netio
[ "def", "__init__", "(", "self", ",", "netio", ",", "outlet", ",", "name", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "outlet", "=", "outlet", "self", ".", "netio", "=", "netio" ]
[ 130, 4 ]
[ 134, 26 ]
python
en
['en', 'pl', 'en']
True
NetioSwitch.name
(self)
Return the device's name.
Return the device's name.
def name(self): """Return the device's name.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 137, 4 ]
[ 139, 25 ]
python
en
['en', 'en', 'en']
True
NetioSwitch.available
(self)
Return true if entity is available.
Return true if entity is available.
def available(self): """Return true if entity is available.""" return not hasattr(self, "telnet")
[ "def", "available", "(", "self", ")", ":", "return", "not", "hasattr", "(", "self", ",", "\"telnet\"", ")" ]
[ 142, 4 ]
[ 144, 42 ]
python
en
['en', 'en', 'en']
True
NetioSwitch.turn_on
(self, **kwargs)
Turn switch on.
Turn switch on.
def turn_on(self, **kwargs): """Turn switch on.""" self._set(True)
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_set", "(", "True", ")" ]
[ 146, 4 ]
[ 148, 23 ]
python
en
['en', 'en', 'en']
True
NetioSwitch.turn_off
(self, **kwargs)
Turn switch off.
Turn switch off.
def turn_off(self, **kwargs): """Turn switch off.""" self._set(False)
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_set", "(", "False", ")" ]
[ 150, 4 ]
[ 152, 24 ]
python
en
['en', 'en', 'en']
True
NetioSwitch.is_on
(self)
Return the switch's status.
Return the switch's status.
def is_on(self): """Return the switch's status.""" return self.netio.states[int(self.outlet) - 1]
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "netio", ".", "states", "[", "int", "(", "self", ".", "outlet", ")", "-", "1", "]" ]
[ 162, 4 ]
[ 164, 54 ]
python
en
['en', 'sn', 'en']
True
NetioSwitch.update
(self)
Update the state.
Update the state.
def update(self): """Update the state.""" self.netio.update()
[ "def", "update", "(", "self", ")", ":", "self", ".", "netio", ".", "update", "(", ")" ]
[ 166, 4 ]
[ 168, 27 ]
python
en
['en', 'en', 'en']
True
NetioSwitch.state_attributes
(self)
Return optional state attributes.
Return optional state attributes.
def state_attributes(self): """Return optional state attributes.""" return { ATTR_TOTAL_CONSUMPTION_KWH: self.cumulated_consumption_kwh, ATTR_START_DATE: self.start_date.split("|")[0], }
[ "def", "state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_TOTAL_CONSUMPTION_KWH", ":", "self", ".", "cumulated_consumption_kwh", ",", "ATTR_START_DATE", ":", "self", ".", "start_date", ".", "split", "(", "\"|\"", ")", "[", "0", "]", ",", "}" ]
[ 171, 4 ]
[ 176, 9 ]
python
en
['en', 'en', 'en']
True
NetioSwitch.current_power_w
(self)
Return actual power.
Return actual power.
def current_power_w(self): """Return actual power.""" return self.netio.consumptions[int(self.outlet) - 1]
[ "def", "current_power_w", "(", "self", ")", ":", "return", "self", ".", "netio", ".", "consumptions", "[", "int", "(", "self", ".", "outlet", ")", "-", "1", "]" ]
[ 179, 4 ]
[ 181, 60 ]
python
en
['en', 'id', 'en']
True
NetioSwitch.cumulated_consumption_kwh
(self)
Return the total enerygy consumption since start_date.
Return the total enerygy consumption since start_date.
def cumulated_consumption_kwh(self): """Return the total enerygy consumption since start_date.""" return self.netio.cumulated_consumptions[int(self.outlet) - 1]
[ "def", "cumulated_consumption_kwh", "(", "self", ")", ":", "return", "self", ".", "netio", ".", "cumulated_consumptions", "[", "int", "(", "self", ".", "outlet", ")", "-", "1", "]" ]
[ 184, 4 ]
[ 186, 70 ]
python
en
['en', 'en', 'en']
True
NetioSwitch.start_date
(self)
Point in time when the energy accumulation started.
Point in time when the energy accumulation started.
def start_date(self): """Point in time when the energy accumulation started.""" return self.netio.start_dates[int(self.outlet) - 1]
[ "def", "start_date", "(", "self", ")", ":", "return", "self", ".", "netio", ".", "start_dates", "[", "int", "(", "self", ".", "outlet", ")", "-", "1", "]" ]
[ 189, 4 ]
[ 191, 59 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the sensor platform.
Set up the sensor platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the sensor platform.""" try: # initializing I2C bus using the auto-detected pins i2c = I2C(board.SCL, board.SDA) # initializing the sensor bmp280 = Adafruit_BMP280_I2C(i2c, address=config[CONF_I2C_ADDR...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "try", ":", "# initializing I2C bus using the auto-detected pins", "i2c", "=", "I2C", "(", "board", ".", "SCL", ",", "board", ".", "SDA", ")...
[ 42, 0 ]
[ 64, 5 ]
python
en
['en', 'da', 'en']
True
Bmp280Sensor.__init__
( self, bmp280: Adafruit_BMP280_I2C, name: str, unit_of_measurement: str, device_class: str, )
Initialize the sensor.
Initialize the sensor.
def __init__( self, bmp280: Adafruit_BMP280_I2C, name: str, unit_of_measurement: str, device_class: str, ): """Initialize the sensor.""" self._bmp280 = bmp280 self._name = name self._unit_of_measurement = unit_of_measurement self._devic...
[ "def", "__init__", "(", "self", ",", "bmp280", ":", "Adafruit_BMP280_I2C", ",", "name", ":", "str", ",", "unit_of_measurement", ":", "str", ",", "device_class", ":", "str", ",", ")", ":", "self", ".", "_bmp280", "=", "bmp280", "self", ".", "_name", "=", ...
[ 70, 4 ]
[ 83, 29 ]
python
en
['en', 'en', 'en']
True
Bmp280Sensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 86, 4 ]
[ 88, 25 ]
python
en
['en', 'mi', 'en']
True
Bmp280Sensor.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" ]
[ 91, 4 ]
[ 93, 26 ]
python
en
['en', 'en', 'en']
True
Bmp280Sensor.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_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 96, 4 ]
[ 98, 40 ]
python
en
['en', 'la', 'en']
True
Bmp280Sensor.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" ]
[ 101, 4 ]
[ 103, 33 ]
python
en
['en', 'en', 'en']
True
Bmp280Sensor.available
(self)
Return if the device is currently available.
Return if the device is currently available.
def available(self) -> bool: """Return if the device is currently available.""" return not self._errored
[ "def", "available", "(", "self", ")", "->", "bool", ":", "return", "not", "self", ".", "_errored" ]
[ 106, 4 ]
[ 108, 32 ]
python
en
['en', 'en', 'en']
True
Bmp280TemperatureSensor.__init__
(self, bmp280: Adafruit_BMP280_I2C, name: str)
Initialize the entity.
Initialize the entity.
def __init__(self, bmp280: Adafruit_BMP280_I2C, name: str): """Initialize the entity.""" super().__init__( bmp280, f"{name} Temperature", TEMP_CELSIUS, DEVICE_CLASS_TEMPERATURE )
[ "def", "__init__", "(", "self", ",", "bmp280", ":", "Adafruit_BMP280_I2C", ",", "name", ":", "str", ")", ":", "super", "(", ")", ".", "__init__", "(", "bmp280", ",", "f\"{name} Temperature\"", ",", "TEMP_CELSIUS", ",", "DEVICE_CLASS_TEMPERATURE", ")" ]
[ 114, 4 ]
[ 118, 9 ]
python
en
['en', 'en', 'en']
True
Bmp280TemperatureSensor.update
(self)
Fetch new state data for the sensor.
Fetch new state data for the sensor.
def update(self): """Fetch new state data for the sensor.""" try: self._state = round(self._bmp280.temperature, 1) if self._errored: _LOGGER.warning("Communication restored with temperature sensor") self._errored = False except OSError: ...
[ "def", "update", "(", "self", ")", ":", "try", ":", "self", ".", "_state", "=", "round", "(", "self", ".", "_bmp280", ".", "temperature", ",", "1", ")", "if", "self", ".", "_errored", ":", "_LOGGER", ".", "warning", "(", "\"Communication restored with te...
[ 121, 4 ]
[ 133, 32 ]
python
en
['en', 'en', 'en']
True
Bmp280PressureSensor.__init__
(self, bmp280: Adafruit_BMP280_I2C, name: str)
Initialize the entity.
Initialize the entity.
def __init__(self, bmp280: Adafruit_BMP280_I2C, name: str): """Initialize the entity.""" super().__init__( bmp280, f"{name} Pressure", PRESSURE_HPA, DEVICE_CLASS_PRESSURE )
[ "def", "__init__", "(", "self", ",", "bmp280", ":", "Adafruit_BMP280_I2C", ",", "name", ":", "str", ")", ":", "super", "(", ")", ".", "__init__", "(", "bmp280", ",", "f\"{name} Pressure\"", ",", "PRESSURE_HPA", ",", "DEVICE_CLASS_PRESSURE", ")" ]
[ 139, 4 ]
[ 143, 9 ]
python
en
['en', 'en', 'en']
True
Bmp280PressureSensor.update
(self)
Fetch new state data for the sensor.
Fetch new state data for the sensor.
def update(self): """Fetch new state data for the sensor.""" try: self._state = round(self._bmp280.pressure) if self._errored: _LOGGER.warning("Communication restored with pressure sensor") self._errored = False except OSError: ...
[ "def", "update", "(", "self", ")", ":", "try", ":", "self", ".", "_state", "=", "round", "(", "self", ".", "_bmp280", ".", "pressure", ")", "if", "self", ".", "_errored", ":", "_LOGGER", ".", "warning", "(", "\"Communication restored with pressure sensor\"",...
[ 146, 4 ]
[ 158, 32 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config, async_add_entities)
Initialize a Blink sensor.
Initialize a Blink sensor.
async def async_setup_entry(hass, config, async_add_entities): """Initialize a Blink sensor.""" data = hass.data[DOMAIN][config.entry_id] entities = [] for camera in data.cameras: for sensor_type in SENSORS: entities.append(BlinkSensor(data, camera, sensor_type)) async_add_entit...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config", ",", "async_add_entities", ")", ":", "data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config", ".", "entry_id", "]", "entities", "=", "[", "]", "for", "camera", "in", "data", "...
[ 25, 0 ]
[ 33, 32 ]
python
da
['en', 'da', 'it']
False
BlinkSensor.__init__
(self, data, camera, sensor_type)
Initialize sensors from Blink camera.
Initialize sensors from Blink camera.
def __init__(self, data, camera, sensor_type): """Initialize sensors from Blink camera.""" name, units, device_class = SENSORS[sensor_type] self._name = f"{DOMAIN} {camera} {name}" self._camera_name = name self._type = sensor_type self._device_class = device_class ...
[ "def", "__init__", "(", "self", ",", "data", ",", "camera", ",", "sensor_type", ")", ":", "name", ",", "units", ",", "device_class", "=", "SENSORS", "[", "sensor_type", "]", "self", ".", "_name", "=", "f\"{DOMAIN} {camera} {name}\"", "self", ".", "_camera_na...
[ 39, 4 ]
[ 53, 55 ]
python
en
['en', 'en', 'en']
True
BlinkSensor.name
(self)
Return the name of the camera.
Return the name of the camera.
def name(self): """Return the name of the camera.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 56, 4 ]
[ 58, 25 ]
python
en
['en', 'en', 'en']
True
BlinkSensor.unique_id
(self)
Return the unique id for the camera sensor.
Return the unique id for the camera sensor.
def unique_id(self): """Return the unique id for the camera sensor.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 61, 4 ]
[ 63, 30 ]
python
en
['en', 'it', 'en']
True
BlinkSensor.state
(self)
Return the camera's current state.
Return the camera's current state.
def state(self): """Return the camera's current state.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 66, 4 ]
[ 68, 26 ]
python
en
['en', 'en', 'en']
True
BlinkSensor.device_class
(self)
Return the device's class.
Return the device's class.
def device_class(self): """Return the device's class.""" return self._device_class
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_device_class" ]
[ 71, 4 ]
[ 73, 33 ]
python
en
['en', 'en', 'en']
True
BlinkSensor.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_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 76, 4 ]
[ 78, 40 ]
python
en
['en', 'la', 'en']
True