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
test_light_basic
(hass, hk_driver, events)
Test light with char state.
Test light with char state.
async def test_light_basic(hass, hk_driver, events): """Test light with char state.""" entity_id = "light.demo" hass.states.async_set(entity_id, STATE_ON, {ATTR_SUPPORTED_FEATURES: 0}) await hass.async_block_till_done() acc = Light(hass, hk_driver, "Light", entity_id, 1, None) hk_driver.add_acc...
[ "async", "def", "test_light_basic", "(", "hass", ",", "hk_driver", ",", "events", ")", ":", "entity_id", "=", "\"light.demo\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "STATE_ON", ",", "{", "ATTR_SUPPORTED_FEATURES", ":", "0", "}", ")...
[ 45, 0 ]
[ 111, 58 ]
python
en
['en', 'en', 'en']
True
test_light_brightness
(hass, hk_driver, events, supported_color_modes)
Test light with brightness.
Test light with brightness.
async def test_light_brightness(hass, hk_driver, events, supported_color_modes): """Test light with brightness.""" entity_id = "light.demo" hass.states.async_set( entity_id, STATE_ON, {ATTR_SUPPORTED_COLOR_MODES: supported_color_modes, ATTR_BRIGHTNESS: 255}, ) await hass.asy...
[ "async", "def", "test_light_brightness", "(", "hass", ",", "hk_driver", ",", "events", ",", "supported_color_modes", ")", ":", "entity_id", "=", "\"light.demo\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "STATE_ON", ",", "{", "ATTR_SUPPORT...
[ 117, 0 ]
[ 232, 41 ]
python
en
['en', 'ky', 'en']
True
test_light_color_temperature
(hass, hk_driver, events)
Test light with color temperature.
Test light with color temperature.
async def test_light_color_temperature(hass, hk_driver, events): """Test light with color temperature.""" entity_id = "light.demo" hass.states.async_set( entity_id, STATE_ON, {ATTR_SUPPORTED_COLOR_MODES: ["color_temp"], ATTR_COLOR_TEMP: 190}, ) await hass.async_block_till_do...
[ "async", "def", "test_light_color_temperature", "(", "hass", ",", "hk_driver", ",", "events", ")", ":", "entity_id", "=", "\"light.demo\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "STATE_ON", ",", "{", "ATTR_SUPPORTED_COLOR_MODES", ":", "...
[ 235, 0 ]
[ 276, 68 ]
python
en
['en', 'en', 'en']
True
test_light_color_temperature_and_rgb_color
( hass, hk_driver, events, supported_color_modes )
Test light with color temperature and rgb color not exposing temperature.
Test light with color temperature and rgb color not exposing temperature.
async def test_light_color_temperature_and_rgb_color( hass, hk_driver, events, supported_color_modes ): """Test light with color temperature and rgb color not exposing temperature.""" entity_id = "light.demo" hass.states.async_set( entity_id, STATE_ON, { ATTR_SUPPORT...
[ "async", "def", "test_light_color_temperature_and_rgb_color", "(", "hass", ",", "hk_driver", ",", "events", ",", "supported_color_modes", ")", ":", "entity_id", "=", "\"light.demo\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "STATE_ON", ",", ...
[ 283, 0 ]
[ 478, 43 ]
python
en
['en', 'en', 'en']
True
test_light_rgb_color
(hass, hk_driver, events, supported_color_modes)
Test light with rgb_color.
Test light with rgb_color.
async def test_light_rgb_color(hass, hk_driver, events, supported_color_modes): """Test light with rgb_color.""" entity_id = "light.demo" hass.states.async_set( entity_id, STATE_ON, {ATTR_SUPPORTED_COLOR_MODES: supported_color_modes, ATTR_HS_COLOR: (260, 90)}, ) await hass.a...
[ "async", "def", "test_light_rgb_color", "(", "hass", ",", "hk_driver", ",", "events", ",", "supported_color_modes", ")", ":", "entity_id", "=", "\"light.demo\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "STATE_ON", ",", "{", "ATTR_SUPPORTE...
[ 482, 0 ]
[ 531, 66 ]
python
en
['en', 'en', 'en']
True
test_light_restore
(hass, hk_driver, events)
Test setting up an entity from state in the event registry.
Test setting up an entity from state in the event registry.
async def test_light_restore(hass, hk_driver, events): """Test setting up an entity from state in the event registry.""" hass.state = CoreState.not_running registry = er.async_get(hass) registry.async_get_or_create("light", "hue", "1234", suggested_object_id="simple") registry.async_get_or_create(...
[ "async", "def", "test_light_restore", "(", "hass", ",", "hk_driver", ",", "events", ")", ":", "hass", ".", "state", "=", "CoreState", ".", "not_running", "registry", "=", "er", ".", "async_get", "(", "hass", ")", "registry", ".", "async_get_or_create", "(", ...
[ 534, 0 ]
[ 564, 33 ]
python
en
['en', 'en', 'en']
True
test_light_set_brightness_and_color
(hass, hk_driver, events)
Test light with all chars in one go.
Test light with all chars in one go.
async def test_light_set_brightness_and_color(hass, hk_driver, events): """Test light with all chars in one go.""" entity_id = "light.demo" hass.states.async_set( entity_id, STATE_ON, { ATTR_SUPPORTED_COLOR_MODES: ["hs"], ATTR_BRIGHTNESS: 255, }, ...
[ "async", "def", "test_light_set_brightness_and_color", "(", "hass", ",", "hk_driver", ",", "events", ")", ":", "entity_id", "=", "\"light.demo\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "STATE_ON", ",", "{", "ATTR_SUPPORTED_COLOR_MODES", "...
[ 567, 0 ]
[ 640, 5 ]
python
en
['en', 'en', 'en']
True
test_light_min_max_mireds
(hass, hk_driver, events)
Test mireds are forced to ints.
Test mireds are forced to ints.
async def test_light_min_max_mireds(hass, hk_driver, events): """Test mireds are forced to ints.""" entity_id = "light.demo" hass.states.async_set( entity_id, STATE_ON, { ATTR_SUPPORTED_COLOR_MODES: ["color_temp"], ATTR_BRIGHTNESS: 255, ATTR_MAX_M...
[ "async", "def", "test_light_min_max_mireds", "(", "hass", ",", "hk_driver", ",", "events", ")", ":", "entity_id", "=", "\"light.demo\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "STATE_ON", ",", "{", "ATTR_SUPPORTED_COLOR_MODES", ":", "[",...
[ 643, 0 ]
[ 660, 53 ]
python
en
['en', 'en', 'en']
True
test_light_set_brightness_and_color_temp
(hass, hk_driver, events)
Test light with all chars in one go.
Test light with all chars in one go.
async def test_light_set_brightness_and_color_temp(hass, hk_driver, events): """Test light with all chars in one go.""" entity_id = "light.demo" hass.states.async_set( entity_id, STATE_ON, { ATTR_SUPPORTED_COLOR_MODES: ["color_temp"], ATTR_BRIGHTNESS: 255, ...
[ "async", "def", "test_light_set_brightness_and_color_temp", "(", "hass", ",", "hk_driver", ",", "events", ")", ":", "entity_id", "=", "\"light.demo\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "STATE_ON", ",", "{", "ATTR_SUPPORTED_COLOR_MODES"...
[ 663, 0 ]
[ 729, 5 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, )
Set up Tasmota light dynamically through discovery.
Set up Tasmota light dynamically through discovery.
async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: """Set up Tasmota light dynamically through discovery.""" @callback def async_discover( tasmota_entity: HATasmotaEntity, discovery_hash: DiscoveryHashType ...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", ")", "->", "None", ":", "@", "callback", "def", "async_discover", "(", "tasmota_entity", ":...
[ 47, 0 ]
[ 69, 5 ]
python
en
['en', 'en', 'en']
True
clamp
(value: float)
Clamp value to the range 0..255.
Clamp value to the range 0..255.
def clamp(value: float) -> float: """Clamp value to the range 0..255.""" return min(max(value, 0), 255)
[ "def", "clamp", "(", "value", ":", "float", ")", "->", "float", ":", "return", "min", "(", "max", "(", "value", ",", "0", ")", ",", "255", ")" ]
[ 72, 0 ]
[ 74, 34 ]
python
en
['en', 'en', 'en']
True
scale_brightness
(brightness: float)
Scale brightness from 0..255 to 1..100.
Scale brightness from 0..255 to 1..100.
def scale_brightness(brightness: float) -> float: """Scale brightness from 0..255 to 1..100.""" brightness_normalized = brightness / DEFAULT_BRIGHTNESS_MAX device_brightness = min( round(brightness_normalized * TASMOTA_BRIGHTNESS_MAX), TASMOTA_BRIGHTNESS_MAX, ) # Make sure the bright...
[ "def", "scale_brightness", "(", "brightness", ":", "float", ")", "->", "float", ":", "brightness_normalized", "=", "brightness", "/", "DEFAULT_BRIGHTNESS_MAX", "device_brightness", "=", "min", "(", "round", "(", "brightness_normalized", "*", "TASMOTA_BRIGHTNESS_MAX", ...
[ 77, 0 ]
[ 85, 36 ]
python
en
['en', 'en', 'en']
True
TasmotaLight.__init__
(self, **kwds: Any)
Initialize Tasmota light.
Initialize Tasmota light.
def __init__(self, **kwds: Any) -> None: """Initialize Tasmota light.""" self._supported_color_modes: set[str] | None = None self._supported_features = 0 self._brightness: int | None = None self._color_mode: str | None = None self._color_temp: int | None = None s...
[ "def", "__init__", "(", "self", ",", "*", "*", "kwds", ":", "Any", ")", "->", "None", ":", "self", ".", "_supported_color_modes", ":", "set", "[", "str", "]", "|", "None", "=", "None", "self", ".", "_supported_features", "=", "0", "self", ".", "_brig...
[ 98, 4 ]
[ 115, 33 ]
python
en
['en', 'zu', 'it']
False
TasmotaLight.discovery_update
( self, update: TasmotaEntityConfig, write_state: bool = True )
Handle updated discovery message.
Handle updated discovery message.
async def discovery_update( self, update: TasmotaEntityConfig, write_state: bool = True ) -> None: """Handle updated discovery message.""" await super().discovery_update(update, write_state=False) self._setup_from_entity() self.async_write_ha_state()
[ "async", "def", "discovery_update", "(", "self", ",", "update", ":", "TasmotaEntityConfig", ",", "write_state", ":", "bool", "=", "True", ")", "->", "None", ":", "await", "super", "(", ")", ".", "discovery_update", "(", "update", ",", "write_state", "=", "...
[ 117, 4 ]
[ 123, 35 ]
python
en
['en', 'en', 'en']
True
TasmotaLight._setup_from_entity
(self)
(Re)Setup the entity.
(Re)Setup the entity.
def _setup_from_entity(self) -> None: """(Re)Setup the entity.""" self._supported_color_modes = set() supported_features = 0 light_type = self._tasmota_entity.light_type if light_type in [LIGHT_TYPE_RGB, LIGHT_TYPE_RGBW, LIGHT_TYPE_RGBCW]: # Mark HS support for RGBW ...
[ "def", "_setup_from_entity", "(", "self", ")", "->", "None", ":", "self", ".", "_supported_color_modes", "=", "set", "(", ")", "supported_features", "=", "0", "light_type", "=", "self", ".", "_tasmota_entity", ".", "light_type", "if", "light_type", "in", "[", ...
[ 125, 4 ]
[ 158, 53 ]
python
en
['en', 'haw', 'en']
True
TasmotaLight.state_updated
(self, state: bool, **kwargs: Any)
Handle state updates.
Handle state updates.
def state_updated(self, state: bool, **kwargs: Any) -> None: """Handle state updates.""" self._on_off_state = state attributes = kwargs.get("attributes") if attributes: if "brightness" in attributes: brightness = float(attributes["brightness"]) ...
[ "def", "state_updated", "(", "self", ",", "state", ":", "bool", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "self", ".", "_on_off_state", "=", "state", "attributes", "=", "kwargs", ".", "get", "(", "\"attributes\"", ")", "if", "attribu...
[ 161, 4 ]
[ 193, 35 ]
python
en
['en', 'en', 'en']
True
TasmotaLight.brightness
(self)
Return the brightness of this light between 0..255.
Return the brightness of this light between 0..255.
def brightness(self) -> int | None: """Return the brightness of this light between 0..255.""" return self._brightness
[ "def", "brightness", "(", "self", ")", "->", "int", "|", "None", ":", "return", "self", ".", "_brightness" ]
[ 196, 4 ]
[ 198, 31 ]
python
en
['en', 'en', 'en']
True
TasmotaLight.color_mode
(self)
Return the color mode of the light.
Return the color mode of the light.
def color_mode(self) -> str | None: """Return the color mode of the light.""" return self._color_mode
[ "def", "color_mode", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "_color_mode" ]
[ 201, 4 ]
[ 203, 31 ]
python
en
['en', 'en', 'en']
True
TasmotaLight.color_temp
(self)
Return the color temperature in mired.
Return the color temperature in mired.
def color_temp(self) -> int | None: """Return the color temperature in mired.""" return self._color_temp
[ "def", "color_temp", "(", "self", ")", "->", "int", "|", "None", ":", "return", "self", ".", "_color_temp" ]
[ 206, 4 ]
[ 208, 31 ]
python
en
['en', 'en', 'en']
True
TasmotaLight.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) -> int: """Return the coldest color_temp that this light supports.""" return self._tasmota_entity.min_mireds
[ "def", "min_mireds", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_tasmota_entity", ".", "min_mireds" ]
[ 211, 4 ]
[ 213, 46 ]
python
en
['en', 'en', 'en']
True
TasmotaLight.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) -> int: """Return the warmest color_temp that this light supports.""" return self._tasmota_entity.max_mireds
[ "def", "max_mireds", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_tasmota_entity", ".", "max_mireds" ]
[ 216, 4 ]
[ 218, 46 ]
python
en
['en', 'en', 'en']
True
TasmotaLight.effect
(self)
Return the current effect.
Return the current effect.
def effect(self) -> str | None: """Return the current effect.""" return self._effect
[ "def", "effect", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "_effect" ]
[ 221, 4 ]
[ 223, 27 ]
python
en
['en', 'en', 'en']
True
TasmotaLight.effect_list
(self)
Return the list of supported effects.
Return the list of supported effects.
def effect_list(self) -> list[str] | None: """Return the list of supported effects.""" return self._tasmota_entity.effect_list
[ "def", "effect_list", "(", "self", ")", "->", "list", "[", "str", "]", "|", "None", ":", "return", "self", ".", "_tasmota_entity", ".", "effect_list" ]
[ 226, 4 ]
[ 228, 47 ]
python
en
['en', 'en', 'en']
True
TasmotaLight.hs_color
(self)
Return the hs color value.
Return the hs color value.
def hs_color(self) -> tuple[float, float] | None: """Return the hs color value.""" if self._hs is None: return None hs_color = self._hs return (hs_color[0], hs_color[1])
[ "def", "hs_color", "(", "self", ")", "->", "tuple", "[", "float", ",", "float", "]", "|", "None", ":", "if", "self", ".", "_hs", "is", "None", ":", "return", "None", "hs_color", "=", "self", ".", "_hs", "return", "(", "hs_color", "[", "0", "]", "...
[ 231, 4 ]
[ 236, 41 ]
python
en
['en', 'en', 'en']
True
TasmotaLight.force_update
(self)
Force update.
Force update.
def force_update(self) -> bool: """Force update.""" return False
[ "def", "force_update", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 239, 4 ]
[ 241, 20 ]
python
en
['en', 'en', 'en']
False
TasmotaLight.supported_color_modes
(self)
Flag supported color modes.
Flag supported color modes.
def supported_color_modes(self) -> set[str] | None: """Flag supported color modes.""" return self._supported_color_modes
[ "def", "supported_color_modes", "(", "self", ")", "->", "set", "[", "str", "]", "|", "None", ":", "return", "self", ".", "_supported_color_modes" ]
[ 244, 4 ]
[ 246, 42 ]
python
en
['en', 'en', 'en']
True
TasmotaLight.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self) -> int: """Flag supported features.""" return self._supported_features
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_supported_features" ]
[ 249, 4 ]
[ 251, 39 ]
python
en
['da', 'en', 'en']
True
TasmotaLight.async_turn_on
(self, **kwargs: Any)
Turn the entity on.
Turn the entity on.
async def async_turn_on(self, **kwargs: Any) -> None: """Turn the entity on.""" supported_color_modes = self._supported_color_modes or set() attributes: dict[str, Any] = {} if ATTR_HS_COLOR in kwargs and COLOR_MODE_HS in supported_color_modes: hs_color = kwargs[ATTR_HS_COLO...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "supported_color_modes", "=", "self", ".", "_supported_color_modes", "or", "set", "(", ")", "attributes", ":", "dict", "[", "str", ",", "Any", "]",...
[ 253, 4 ]
[ 278, 56 ]
python
en
['en', 'en', 'en']
True
TasmotaLight.async_turn_off
(self, **kwargs: Any)
Turn the entity off.
Turn the entity off.
async def async_turn_off(self, **kwargs: Any) -> None: """Turn the entity off.""" attributes = {"state": "OFF"} if ATTR_TRANSITION in kwargs: attributes["transition"] = kwargs[ATTR_TRANSITION] self._tasmota_entity.set_state(False, attributes)
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "attributes", "=", "{", "\"state\"", ":", "\"OFF\"", "}", "if", "ATTR_TRANSITION", "in", "kwargs", ":", "attributes", "[", "\"transition\"", "]", ...
[ 280, 4 ]
[ 287, 57 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: core.HomeAssistant, entry: config_entries.ConfigEntry )
Set up the Xiaomi Miio components from a config entry.
Set up the Xiaomi Miio components from a config entry.
async def async_setup_entry( hass: core.HomeAssistant, entry: config_entries.ConfigEntry ): """Set up the Xiaomi Miio components from a config entry.""" hass.data.setdefault(DOMAIN, {}) if entry.data[ CONF_FLOW_TYPE ] == CONF_GATEWAY and not await async_setup_gateway_entry(hass, entry): ...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "entry", ":", "config_entries", ".", "ConfigEntry", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "if", "entry", ".", "data",...
[ 68, 0 ]
[ 81, 5 ]
python
en
['en', 'en', 'en']
True
get_platforms
(config_entry)
Return the platforms belonging to a config_entry.
Return the platforms belonging to a config_entry.
def get_platforms(config_entry): """Return the platforms belonging to a config_entry.""" model = config_entry.data[CONF_MODEL] flow_type = config_entry.data[CONF_FLOW_TYPE] if flow_type == CONF_GATEWAY: return GATEWAY_PLATFORMS if flow_type == CONF_DEVICE: if model in MODELS_SWITCH:...
[ "def", "get_platforms", "(", "config_entry", ")", ":", "model", "=", "config_entry", ".", "data", "[", "CONF_MODEL", "]", "flow_type", "=", "config_entry", ".", "data", "[", "CONF_FLOW_TYPE", "]", "if", "flow_type", "==", "CONF_GATEWAY", ":", "return", "GATEWA...
[ 85, 0 ]
[ 113, 13 ]
python
en
['en', 'en', 'en']
True
async_create_miio_device_and_coordinator
( hass: core.HomeAssistant, entry: config_entries.ConfigEntry )
Set up a data coordinator and one miio device to service multiple entities.
Set up a data coordinator and one miio device to service multiple entities.
async def async_create_miio_device_and_coordinator( hass: core.HomeAssistant, entry: config_entries.ConfigEntry ): """Set up a data coordinator and one miio device to service multiple entities.""" model = entry.data[CONF_MODEL] host = entry.data[CONF_HOST] token = entry.data[CONF_TOKEN] name = e...
[ "async", "def", "async_create_miio_device_and_coordinator", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "entry", ":", "config_entries", ".", "ConfigEntry", ")", ":", "model", "=", "entry", ".", "data", "[", "CONF_MODEL", "]", "host", "=", "entry", "."...
[ 116, 0 ]
[ 201, 56 ]
python
en
['en', 'en', 'en']
True
async_setup_gateway_entry
( hass: core.HomeAssistant, entry: config_entries.ConfigEntry )
Set up the Xiaomi Gateway component from a config entry.
Set up the Xiaomi Gateway component from a config entry.
async def async_setup_gateway_entry( hass: core.HomeAssistant, entry: config_entries.ConfigEntry ): """Set up the Xiaomi Gateway component from a config entry.""" host = entry.data[CONF_HOST] token = entry.data[CONF_TOKEN] name = entry.title gateway_id = entry.unique_id # For backwards comp...
[ "async", "def", "async_setup_gateway_entry", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "entry", ":", "config_entries", ".", "ConfigEntry", ")", ":", "host", "=", "entry", ".", "data", "[", "CONF_HOST", "]", "token", "=", "entry", ".", "data", "[...
[ 204, 0 ]
[ 275, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_device_entry
( hass: core.HomeAssistant, entry: config_entries.ConfigEntry )
Set up the Xiaomi Miio device component from a config entry.
Set up the Xiaomi Miio device component from a config entry.
async def async_setup_device_entry( hass: core.HomeAssistant, entry: config_entries.ConfigEntry ): """Set up the Xiaomi Miio device component from a config entry.""" platforms = get_platforms(entry) await async_create_miio_device_and_coordinator(hass, entry) if not platforms: return False ...
[ "async", "def", "async_setup_device_entry", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "entry", ":", "config_entries", ".", "ConfigEntry", ")", ":", "platforms", "=", "get_platforms", "(", "entry", ")", "await", "async_create_miio_device_and_coordinator", ...
[ 278, 0 ]
[ 292, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
( hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry )
Unload a config entry.
Unload a config entry.
async def async_unload_entry( hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry ): """Unload a config entry.""" platforms = get_platforms(config_entry) unload_ok = await hass.config_entries.async_unload_platforms( config_entry, platforms ) if unload_ok: hass.da...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ")", ":", "platforms", "=", "get_platforms", "(", "config_entry", ")", "unload_ok", "=", "await", "hass", ".", ...
[ 295, 0 ]
[ 308, 20 ]
python
en
['en', 'es', 'en']
True
update_listener
( hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry )
Handle options update.
Handle options update.
async def update_listener( hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry ): """Handle options update.""" await hass.config_entries.async_reload(config_entry.entry_id)
[ "async", "def", "update_listener", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ")", ":", "await", "hass", ".", "config_entries", ".", "async_reload", "(", "config_entry", ".", "entry_id", ")" ]
[ 311, 0 ]
[ 315, 65 ]
python
en
['en', 'nl', 'en']
True
mock_device
()
Mock a Dynalite device.
Mock a Dynalite device.
def mock_device(): """Mock a Dynalite device.""" return create_mock_device("switch", DynalitePresetSwitchDevice)
[ "def", "mock_device", "(", ")", ":", "return", "create_mock_device", "(", "\"switch\"", ",", "DynalitePresetSwitchDevice", ")" ]
[ 17, 0 ]
[ 19, 67 ]
python
en
['ro', 'ht', 'en']
False
test_switch_setup
(hass, mock_device)
Test a successful setup.
Test a successful setup.
async def test_switch_setup(hass, mock_device): """Test a successful setup.""" await create_entity_from_device(hass, mock_device) entity_state = hass.states.get("switch.name") assert entity_state.attributes[ATTR_FRIENDLY_NAME] == mock_device.name await run_service_tests( hass, mock_d...
[ "async", "def", "test_switch_setup", "(", "hass", ",", "mock_device", ")", ":", "await", "create_entity_from_device", "(", "hass", ",", "mock_device", ")", "entity_state", "=", "hass", ".", "states", ".", "get", "(", "\"switch.name\"", ")", "assert", "entity_sta...
[ 22, 0 ]
[ 35, 5 ]
python
en
['en', 'co', 'en']
True
test_heartbeat_trigger_startup
(hass)
Test that the heartbeat is initialized with the first config entry.
Test that the heartbeat is initialized with the first config entry.
async def test_heartbeat_trigger_startup(hass): """Test that the heartbeat is initialized with the first config entry.""" device = get_device("Office") with patch(DEVICE_PING) as mock_ping: await device.setup_entry(hass) await hass.async_block_till_done() assert mock_ping.call_count ==...
[ "async", "def", "test_heartbeat_trigger_startup", "(", "hass", ")", ":", "device", "=", "get_device", "(", "\"Office\"", ")", "with", "patch", "(", "DEVICE_PING", ")", "as", "mock_ping", ":", "await", "device", ".", "setup_entry", "(", "hass", ")", "await", ...
[ 13, 0 ]
[ 22, 51 ]
python
en
['en', 'en', 'en']
True
test_heartbeat_ignore_oserror
(hass, caplog)
Test that an OSError is ignored.
Test that an OSError is ignored.
async def test_heartbeat_ignore_oserror(hass, caplog): """Test that an OSError is ignored.""" device = get_device("Office") with patch(DEVICE_PING, side_effect=OSError()): await device.setup_entry(hass) await hass.async_block_till_done() assert "Failed to send heartbeat to" in caplog.t...
[ "async", "def", "test_heartbeat_ignore_oserror", "(", "hass", ",", "caplog", ")", ":", "device", "=", "get_device", "(", "\"Office\"", ")", "with", "patch", "(", "DEVICE_PING", ",", "side_effect", "=", "OSError", "(", ")", ")", ":", "await", "device", ".", ...
[ 25, 0 ]
[ 33, 55 ]
python
en
['en', 'en', 'en']
True
test_heartbeat_trigger_right_time
(hass)
Test that the heartbeat is triggered at the right time.
Test that the heartbeat is triggered at the right time.
async def test_heartbeat_trigger_right_time(hass): """Test that the heartbeat is triggered at the right time.""" device = get_device("Office") await device.setup_entry(hass) await hass.async_block_till_done() with patch(DEVICE_PING) as mock_ping: async_fire_time_changed( hass, ...
[ "async", "def", "test_heartbeat_trigger_right_time", "(", "hass", ")", ":", "device", "=", "get_device", "(", "\"Office\"", ")", "await", "device", ".", "setup_entry", "(", "hass", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "with", "patch", ...
[ 36, 0 ]
[ 50, 51 ]
python
en
['en', 'en', 'en']
True
test_heartbeat_do_not_trigger_before_time
(hass)
Test that the heartbeat is not triggered before the time.
Test that the heartbeat is not triggered before the time.
async def test_heartbeat_do_not_trigger_before_time(hass): """Test that the heartbeat is not triggered before the time.""" device = get_device("Office") await device.setup_entry(hass) await hass.async_block_till_done() with patch(DEVICE_PING) as mock_ping: async_fire_time_changed( ...
[ "async", "def", "test_heartbeat_do_not_trigger_before_time", "(", "hass", ")", ":", "device", "=", "get_device", "(", "\"Office\"", ")", "await", "device", ".", "setup_entry", "(", "hass", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "with", "pa...
[ 53, 0 ]
[ 67, 36 ]
python
en
['en', 'en', 'en']
True
test_heartbeat_unload
(hass)
Test that the heartbeat is deactivated when the last config entry is removed.
Test that the heartbeat is deactivated when the last config entry is removed.
async def test_heartbeat_unload(hass): """Test that the heartbeat is deactivated when the last config entry is removed.""" device = get_device("Office") mock_setup = await device.setup_entry(hass) await hass.async_block_till_done() await hass.config_entries.async_remove(mock_setup.entry.entry_id) ...
[ "async", "def", "test_heartbeat_unload", "(", "hass", ")", ":", "device", "=", "get_device", "(", "\"Office\"", ")", "mock_setup", "=", "await", "device", ".", "setup_entry", "(", "hass", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "await", ...
[ 70, 0 ]
[ 85, 36 ]
python
en
['en', 'en', 'en']
True
test_heartbeat_do_not_unload
(hass)
Test that the heartbeat is not deactivated until the last config entry is removed.
Test that the heartbeat is not deactivated until the last config entry is removed.
async def test_heartbeat_do_not_unload(hass): """Test that the heartbeat is not deactivated until the last config entry is removed.""" device_a = get_device("Office") device_b = get_device("Bedroom") mock_setup = await device_a.setup_entry(hass) await device_b.setup_entry(hass) await hass.async...
[ "async", "def", "test_heartbeat_do_not_unload", "(", "hass", ")", ":", "device_a", "=", "get_device", "(", "\"Office\"", ")", "device_b", "=", "get_device", "(", "\"Bedroom\"", ")", "mock_setup", "=", "await", "device_a", ".", "setup_entry", "(", "hass", ")", ...
[ 88, 0 ]
[ 107, 53 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, )
Set up the UpCloud server binary sensor.
Set up the UpCloud server binary sensor.
async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: """Set up the UpCloud server binary sensor.""" coordinator = hass.data[DATA_UPCLOUD].coordinators[config_entry.data[CONF_USERNAME]] entities = [UpCloudBinarySensor(coo...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", ")", "->", "None", ":", "coordinator", "=", "hass", ".", "data", "[", "DATA_UPCLOUD", "]"...
[ 18, 0 ]
[ 26, 38 ]
python
en
['en', 'su', 'en']
True
test_sensors
(hass, nzbget_api)
Test the creation and values of the sensors.
Test the creation and values of the sensors.
async def test_sensors(hass, nzbget_api) -> None: """Test the creation and values of the sensors.""" now = dt_util.utcnow().replace(microsecond=0) with patch("homeassistant.components.nzbget.sensor.utcnow", return_value=now): entry = await init_integration(hass) registry = er.async_get(hass) ...
[ "async", "def", "test_sensors", "(", "hass", ",", "nzbget_api", ")", "->", "None", ":", "now", "=", "dt_util", ".", "utcnow", "(", ")", ".", "replace", "(", "microsecond", "=", "0", ")", "with", "patch", "(", "\"homeassistant.components.nzbget.sensor.utcnow\""...
[ 16, 0 ]
[ 53, 37 ]
python
en
['en', 'en', 'en']
True
Source.__init__
(self, config)
Create a new source Args: config: index configuration
Create a new source
def __init__(self, config): """ Create a new source Args: config: index configuration """ # Source configuration self.config = config # Article schema definition self.article = namedtuple("Article", ["uid", "source", "date", "title", "url", ...
[ "def", "__init__", "(", "self", ",", "config", ")", ":", "# Source configuration", "self", ".", "config", "=", "config", "# Article schema definition", "self", ".", "article", "=", "namedtuple", "(", "\"Article\"", ",", "[", "\"uid\"", ",", "\"source\"", ",", ...
[ 12, 4 ]
[ 24, 96 ]
python
en
['en', 'error', 'th']
False
Source.run
(self)
Maps a source into a list of articles. Articles have the following schema: uid - unique id source - source name date - article date title - article title url - reference url for data entry - entry date Sources must implem...
Maps a source into a list of articles.
def run(self): """ Maps a source into a list of articles. Articles have the following schema: uid - unique id source - source name date - article date title - article title url - reference url for data entry - entry date ...
[ "def", "run", "(", "self", ")", ":", "return", "[", "]" ]
[ 26, 4 ]
[ 48, 17 ]
python
en
['en', 'error', 'th']
False
Source.now
(self)
Builds a timestamp for the current time. Returns: YYYY-MM-DD HH:MI:SS timestamp
Builds a timestamp for the current time.
def now(self): """ Builds a timestamp for the current time. Returns: YYYY-MM-DD HH:MI:SS timestamp """ return datetime.now().strftime("%Y-%m-%d %H:%M:%S")
[ "def", "now", "(", "self", ")", ":", "return", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "\"%Y-%m-%d %H:%M:%S\"", ")" ]
[ 50, 4 ]
[ 58, 59 ]
python
en
['en', 'error', 'th']
False
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up Atag integration from a config entry.
Set up Atag integration from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Atag integration from a config entry.""" async def _async_update_data(): """Update data via library.""" with async_timeout.timeout(20): try: await atag.update() except...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "async", "def", "_async_update_data", "(", ")", ":", "\"\"\"Update data via library.\"\"\"", "with", "async_timeout", ".", "timeout", ...
[ 26, 0 ]
[ 57, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass, entry)
Unload Atag config entry.
Unload Atag config entry.
async def async_unload_entry(hass, entry): """Unload Atag config entry.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: hass.data[DOMAIN].pop(entry.entry_id) return unload_ok
[ "async", "def", "async_unload_entry", "(", "hass", ",", "entry", ")", ":", "unload_ok", "=", "await", "hass", ".", "config_entries", ".", "async_unload_platforms", "(", "entry", ",", "PLATFORMS", ")", "if", "unload_ok", ":", "hass", ".", "data", "[", "DOMAIN...
[ 60, 0 ]
[ 66, 20 ]
python
da
['da', 'es', 'en']
False
AtagEntity.__init__
(self, coordinator: DataUpdateCoordinator, atag_id: str)
Initialize the Atag entity.
Initialize the Atag entity.
def __init__(self, coordinator: DataUpdateCoordinator, atag_id: str) -> None: """Initialize the Atag entity.""" super().__init__(coordinator) self._id = atag_id self._attr_name = DOMAIN.title() self._attr_unique_id = f"{coordinator.data.id}-{atag_id}"
[ "def", "__init__", "(", "self", ",", "coordinator", ":", "DataUpdateCoordinator", ",", "atag_id", ":", "str", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "_id", "=", "atag_id", "self", ".", "_attr_nam...
[ 72, 4 ]
[ 78, 65 ]
python
en
['en', 'en', 'en']
True
AtagEntity.device_info
(self)
Return info for device registry.
Return info for device registry.
def device_info(self) -> DeviceInfo: """Return info for device registry.""" return { "identifiers": {(DOMAIN, self.coordinator.data.id)}, "name": "Atag Thermostat", "model": "Atag One", "sw_version": self.coordinator.data.apiversion, "manufactu...
[ "def", "device_info", "(", "self", ")", "->", "DeviceInfo", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "coordinator", ".", "data", ".", "id", ")", "}", ",", "\"name\"", ":", "\"Atag Thermostat\"", ",", "\"model\"", ...
[ 81, 4 ]
[ 89, 9 ]
python
da
['da', 'no', 'en']
False
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Ring binary sensors from a config entry.
Set up the Ring binary sensors from a config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Ring binary sensors from a config entry.""" ring = hass.data[DOMAIN][config_entry.entry_id]["api"] devices = hass.data[DOMAIN][config_entry.entry_id]["devices"] entities = [ RingBinarySensor(config_entry.entry_id...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "ring", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "[", "\"api\"", "]", "devices", "=", "hass", ".", ...
[ 48, 0 ]
[ 61, 32 ]
python
en
['en', 'en', 'en']
True
RingBinarySensor.__init__
( self, config_entry_id, ring, device, description: RingBinarySensorEntityDescription, )
Initialize a sensor for Ring device.
Initialize a sensor for Ring device.
def __init__( self, config_entry_id, ring, device, description: RingBinarySensorEntityDescription, ): """Initialize a sensor for Ring device.""" super().__init__(config_entry_id, device) self.entity_description = description self._ring = ring ...
[ "def", "__init__", "(", "self", ",", "config_entry_id", ",", "ring", ",", "device", ",", "description", ":", "RingBinarySensorEntityDescription", ",", ")", ":", "super", "(", ")", ".", "__init__", "(", "config_entry_id", ",", "device", ")", "self", ".", "ent...
[ 70, 4 ]
[ 83, 28 ]
python
en
['en', 'en', 'en']
True
RingBinarySensor.async_added_to_hass
(self)
Register callbacks.
Register callbacks.
async def async_added_to_hass(self): """Register callbacks.""" await super().async_added_to_hass() self.ring_objects["dings_data"].async_add_listener(self._dings_update_callback) self._dings_update_callback()
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "self", ".", "ring_objects", "[", "\"dings_data\"", "]", ".", "async_add_listener", "(", "self", ".", "_dings_update_callback", ")", ...
[ 85, 4 ]
[ 89, 37 ]
python
en
['en', 'no', 'en']
False
RingBinarySensor.async_will_remove_from_hass
(self)
Disconnect callbacks.
Disconnect callbacks.
async def async_will_remove_from_hass(self): """Disconnect callbacks.""" await super().async_will_remove_from_hass() self.ring_objects["dings_data"].async_remove_listener( self._dings_update_callback )
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_will_remove_from_hass", "(", ")", "self", ".", "ring_objects", "[", "\"dings_data\"", "]", ".", "async_remove_listener", "(", "self", ".", "_dings_update_...
[ 91, 4 ]
[ 96, 9 ]
python
en
['en', 'ja', 'en']
False
RingBinarySensor._dings_update_callback
(self)
Call update method.
Call update method.
def _dings_update_callback(self): """Call update method.""" self._update_alert() self.async_write_ha_state()
[ "def", "_dings_update_callback", "(", "self", ")", ":", "self", ".", "_update_alert", "(", ")", "self", ".", "async_write_ha_state", "(", ")" ]
[ 99, 4 ]
[ 102, 35 ]
python
en
['en', 'sn', 'en']
True
RingBinarySensor._update_alert
(self)
Update active alert.
Update active alert.
def _update_alert(self): """Update active alert.""" self._active_alert = next( ( alert for alert in self._ring.active_alerts() if alert["kind"] == self.entity_description.key and alert["doorbot_id"] == self._device.id ...
[ "def", "_update_alert", "(", "self", ")", ":", "self", ".", "_active_alert", "=", "next", "(", "(", "alert", "for", "alert", "in", "self", ".", "_ring", ".", "active_alerts", "(", ")", "if", "alert", "[", "\"kind\"", "]", "==", "self", ".", "entity_des...
[ 105, 4 ]
[ 115, 9 ]
python
en
['ro', 'nl', 'en']
False
RingBinarySensor.is_on
(self)
Return True if the binary sensor is on.
Return True if the binary sensor is on.
def is_on(self): """Return True if the binary sensor is on.""" return self._active_alert is not None
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_active_alert", "is", "not", "None" ]
[ 118, 4 ]
[ 120, 45 ]
python
en
['en', 'fy', 'en']
True
RingBinarySensor.extra_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def extra_state_attributes(self): """Return the state attributes.""" attrs = super().extra_state_attributes if self._active_alert is None: return attrs attrs["state"] = self._active_alert["state"] attrs["expires_at"] = datetime.fromtimestamp( self._activ...
[ "def", "extra_state_attributes", "(", "self", ")", ":", "attrs", "=", "super", "(", ")", ".", "extra_state_attributes", "if", "self", ".", "_active_alert", "is", "None", ":", "return", "attrs", "attrs", "[", "\"state\"", "]", "=", "self", ".", "_active_alert...
[ 123, 4 ]
[ 135, 20 ]
python
en
['en', 'en', 'en']
True
WLEDEntity.device_info
(self)
Return device information about this WLED device.
Return device information about this WLED device.
def device_info(self) -> DeviceInfo: """Return device information about this WLED device.""" return { ATTR_IDENTIFIERS: {(DOMAIN, self.coordinator.data.info.mac_address)}, ATTR_NAME: self.coordinator.data.info.name, ATTR_MANUFACTURER: self.coordinator.data.info.brand,...
[ "def", "device_info", "(", "self", ")", "->", "DeviceInfo", ":", "return", "{", "ATTR_IDENTIFIERS", ":", "{", "(", "DOMAIN", ",", "self", ".", "coordinator", ".", "data", ".", "info", ".", "mac_address", ")", "}", ",", "ATTR_NAME", ":", "self", ".", "c...
[ 21, 4 ]
[ 29, 9 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Rachio switches.
Set up the Rachio switches.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Rachio switches.""" zone_entities = [] has_flex_sched = False entities = await hass.async_add_executor_job(_create_entities, hass, config_entry) for entity in entities: if isinstance(entity, RachioZone): ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "zone_entities", "=", "[", "]", "has_flex_sched", "=", "False", "entities", "=", "await", "hass", ".", "async_add_executor_job", "(", "_create_entities", ",...
[ 90, 0 ]
[ 147, 9 ]
python
en
['en', 'en', 'en']
True
RachioSwitch.__init__
(self, controller)
Initialize a new Rachio switch.
Initialize a new Rachio switch.
def __init__(self, controller): """Initialize a new Rachio switch.""" super().__init__(controller) self._state = None
[ "def", "__init__", "(", "self", ",", "controller", ")", ":", "super", "(", ")", ".", "__init__", "(", "controller", ")", "self", ".", "_state", "=", "None" ]
[ 173, 4 ]
[ 176, 26 ]
python
en
['en', 'pl', 'en']
True
RachioSwitch.name
(self)
Get a name for this switch.
Get a name for this switch.
def name(self) -> str: """Get a name for this switch.""" return f"Switch on {self._controller.name}"
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "f\"Switch on {self._controller.name}\"" ]
[ 179, 4 ]
[ 181, 51 ]
python
en
['en', 'en', 'en']
True
RachioSwitch.is_on
(self)
Return whether the switch is currently on.
Return whether the switch is currently on.
def is_on(self) -> bool: """Return whether the switch is currently on.""" return self._state
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_state" ]
[ 184, 4 ]
[ 186, 26 ]
python
en
['en', 'en', 'en']
True
RachioSwitch._async_handle_any_update
(self, *args, **kwargs)
Determine whether an update event applies to this device.
Determine whether an update event applies to this device.
def _async_handle_any_update(self, *args, **kwargs) -> None: """Determine whether an update event applies to this device.""" if args[0][KEY_DEVICE_ID] != self._controller.controller_id: # For another device return # For this device self._async_handle_update(args,...
[ "def", "_async_handle_any_update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "if", "args", "[", "0", "]", "[", "KEY_DEVICE_ID", "]", "!=", "self", ".", "_controller", ".", "controller_id", ":", "# For another device", ...
[ 189, 4 ]
[ 196, 47 ]
python
en
['en', 'en', 'en']
True
RachioSwitch._async_handle_update
(self, *args, **kwargs)
Handle incoming webhook data.
Handle incoming webhook data.
def _async_handle_update(self, *args, **kwargs) -> None: """Handle incoming webhook data."""
[ "def", "_async_handle_update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":" ]
[ 199, 4 ]
[ 200, 43 ]
python
en
['en', 'xh', 'en']
True
RachioStandbySwitch.name
(self)
Return the name of the standby switch.
Return the name of the standby switch.
def name(self) -> str: """Return the name of the standby switch.""" return f"{self._controller.name} in standby mode"
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "f\"{self._controller.name} in standby mode\"" ]
[ 207, 4 ]
[ 209, 57 ]
python
en
['en', 'en', 'en']
True
RachioStandbySwitch.unique_id
(self)
Return a unique id by combining controller id and purpose.
Return a unique id by combining controller id and purpose.
def unique_id(self) -> str: """Return a unique id by combining controller id and purpose.""" return f"{self._controller.controller_id}-standby"
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "f\"{self._controller.controller_id}-standby\"" ]
[ 212, 4 ]
[ 214, 58 ]
python
en
['en', 'en', 'en']
True
RachioStandbySwitch.icon
(self)
Return an icon for the standby switch.
Return an icon for the standby switch.
def icon(self) -> str: """Return an icon for the standby switch.""" return "mdi:power"
[ "def", "icon", "(", "self", ")", "->", "str", ":", "return", "\"mdi:power\"" ]
[ 217, 4 ]
[ 219, 26 ]
python
en
['en', 'en', 'en']
True
RachioStandbySwitch._async_handle_update
(self, *args, **kwargs)
Update the state using webhook data.
Update the state using webhook data.
def _async_handle_update(self, *args, **kwargs) -> None: """Update the state using webhook data.""" if args[0][0][KEY_SUBTYPE] == SUBTYPE_SLEEP_MODE_ON: self._state = True elif args[0][0][KEY_SUBTYPE] == SUBTYPE_SLEEP_MODE_OFF: self._state = False self.async_writ...
[ "def", "_async_handle_update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "if", "args", "[", "0", "]", "[", "0", "]", "[", "KEY_SUBTYPE", "]", "==", "SUBTYPE_SLEEP_MODE_ON", ":", "self", ".", "_state", "=", "True"...
[ 222, 4 ]
[ 229, 35 ]
python
en
['en', 'en', 'en']
True
RachioStandbySwitch.turn_on
(self, **kwargs)
Put the controller in standby mode.
Put the controller in standby mode.
def turn_on(self, **kwargs) -> None: """Put the controller in standby mode.""" self._controller.rachio.device.turn_off(self._controller.controller_id)
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "self", ".", "_controller", ".", "rachio", ".", "device", ".", "turn_off", "(", "self", ".", "_controller", ".", "controller_id", ")" ]
[ 231, 4 ]
[ 233, 79 ]
python
en
['en', 'en', 'en']
True
RachioStandbySwitch.turn_off
(self, **kwargs)
Resume controller functionality.
Resume controller functionality.
def turn_off(self, **kwargs) -> None: """Resume controller functionality.""" self._controller.rachio.device.turn_on(self._controller.controller_id)
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "self", ".", "_controller", ".", "rachio", ".", "device", ".", "turn_on", "(", "self", ".", "_controller", ".", "controller_id", ")" ]
[ 235, 4 ]
[ 237, 78 ]
python
en
['da', 'en', 'en']
True
RachioStandbySwitch.async_added_to_hass
(self)
Subscribe to updates.
Subscribe to updates.
async def async_added_to_hass(self): """Subscribe to updates.""" if KEY_ON in self._controller.init_data: self._state = not self._controller.init_data[KEY_ON] self.async_on_remove( async_dispatcher_connect( self.hass, SIGNAL_RACHIO_CONTROL...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "if", "KEY_ON", "in", "self", ".", "_controller", ".", "init_data", ":", "self", ".", "_state", "=", "not", "self", ".", "_controller", ".", "init_data", "[", "KEY_ON", "]", "self", ".", "asyn...
[ 239, 4 ]
[ 250, 9 ]
python
en
['en', 'en', 'en']
True
RachioRainDelay.__init__
(self, controller)
Set up a Rachio rain delay switch.
Set up a Rachio rain delay switch.
def __init__(self, controller): """Set up a Rachio rain delay switch.""" self._cancel_update = None super().__init__(controller)
[ "def", "__init__", "(", "self", ",", "controller", ")", ":", "self", ".", "_cancel_update", "=", "None", "super", "(", ")", ".", "__init__", "(", "controller", ")" ]
[ 256, 4 ]
[ 259, 36 ]
python
en
['en', 'fr', 'en']
True
RachioRainDelay.name
(self)
Return the name of the switch.
Return the name of the switch.
def name(self) -> str: """Return the name of the switch.""" return f"{self._controller.name} rain delay"
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "f\"{self._controller.name} rain delay\"" ]
[ 262, 4 ]
[ 264, 52 ]
python
en
['en', 'en', 'en']
True
RachioRainDelay.unique_id
(self)
Return a unique id by combining controller id and purpose.
Return a unique id by combining controller id and purpose.
def unique_id(self) -> str: """Return a unique id by combining controller id and purpose.""" return f"{self._controller.controller_id}-delay"
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "f\"{self._controller.controller_id}-delay\"" ]
[ 267, 4 ]
[ 269, 56 ]
python
en
['en', 'en', 'en']
True
RachioRainDelay.icon
(self)
Return an icon for rain delay.
Return an icon for rain delay.
def icon(self) -> str: """Return an icon for rain delay.""" return "mdi:camera-timer"
[ "def", "icon", "(", "self", ")", "->", "str", ":", "return", "\"mdi:camera-timer\"" ]
[ 272, 4 ]
[ 274, 33 ]
python
en
['en', 'gd', 'en']
True
RachioRainDelay._async_handle_update
(self, *args, **kwargs)
Update the state using webhook data.
Update the state using webhook data.
def _async_handle_update(self, *args, **kwargs) -> None: """Update the state using webhook data.""" if self._cancel_update: self._cancel_update() self._cancel_update = None if args[0][0][KEY_SUBTYPE] == SUBTYPE_RAIN_DELAY_ON: endtime = parse_datetime(args[0][...
[ "def", "_async_handle_update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "if", "self", ".", "_cancel_update", ":", "self", ".", "_cancel_update", "(", ")", "self", ".", "_cancel_update", "=", "None", "if", "args", ...
[ 277, 4 ]
[ 293, 35 ]
python
en
['en', 'en', 'en']
True
RachioRainDelay._delay_expiration
(self, *args)
Trigger when a rain delay expires.
Trigger when a rain delay expires.
def _delay_expiration(self, *args) -> None: """Trigger when a rain delay expires.""" self._state = False self._cancel_update = None self.async_write_ha_state()
[ "def", "_delay_expiration", "(", "self", ",", "*", "args", ")", "->", "None", ":", "self", ".", "_state", "=", "False", "self", ".", "_cancel_update", "=", "None", "self", ".", "async_write_ha_state", "(", ")" ]
[ 296, 4 ]
[ 300, 35 ]
python
en
['en', 'gl', 'en']
True
RachioRainDelay.turn_on
(self, **kwargs)
Activate a 24 hour rain delay on the controller.
Activate a 24 hour rain delay on the controller.
def turn_on(self, **kwargs) -> None: """Activate a 24 hour rain delay on the controller.""" self._controller.rachio.device.rain_delay(self._controller.controller_id, 86400) _LOGGER.debug("Starting rain delay for 24 hours")
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "self", ".", "_controller", ".", "rachio", ".", "device", ".", "rain_delay", "(", "self", ".", "_controller", ".", "controller_id", ",", "86400", ")", "_LOGGER", ".", "debu...
[ 302, 4 ]
[ 305, 57 ]
python
en
['en', 'en', 'en']
True
RachioRainDelay.turn_off
(self, **kwargs)
Resume controller functionality.
Resume controller functionality.
def turn_off(self, **kwargs) -> None: """Resume controller functionality.""" self._controller.rachio.device.rain_delay(self._controller.controller_id, 0) _LOGGER.debug("Canceling rain delay")
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "self", ".", "_controller", ".", "rachio", ".", "device", ".", "rain_delay", "(", "self", ".", "_controller", ".", "controller_id", ",", "0", ")", "_LOGGER", ".", "debug",...
[ 307, 4 ]
[ 310, 45 ]
python
en
['da', 'en', 'en']
True
RachioRainDelay.async_added_to_hass
(self)
Subscribe to updates.
Subscribe to updates.
async def async_added_to_hass(self): """Subscribe to updates.""" if KEY_RAIN_DELAY in self._controller.init_data: self._state = self._controller.init_data[ KEY_RAIN_DELAY ] / 1000 > as_timestamp(now()) # If the controller was in a rain delay state during ...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "if", "KEY_RAIN_DELAY", "in", "self", ".", "_controller", ".", "init_data", ":", "self", ".", "_state", "=", "self", ".", "_controller", ".", "init_data", "[", "KEY_RAIN_DELAY", "]", "/", "1000", ...
[ 312, 4 ]
[ 335, 9 ]
python
en
['en', 'en', 'en']
True
RachioZone.__init__
(self, person, controller, data, current_schedule)
Initialize a new Rachio Zone.
Initialize a new Rachio Zone.
def __init__(self, person, controller, data, current_schedule): """Initialize a new Rachio Zone.""" self.id = data[KEY_ID] self._zone_name = data[KEY_NAME] self._zone_number = data[KEY_ZONE_NUMBER] self._zone_enabled = data[KEY_ENABLED] self._entity_picture = data.get(KEY...
[ "def", "__init__", "(", "self", ",", "person", ",", "controller", ",", "data", ",", "current_schedule", ")", ":", "self", ".", "id", "=", "data", "[", "KEY_ID", "]", "self", ".", "_zone_name", "=", "data", "[", "KEY_NAME", "]", "self", ".", "_zone_numb...
[ 341, 4 ]
[ 354, 36 ]
python
en
['es', 'pl', 'en']
False
RachioZone.__str__
(self)
Display the zone as a string.
Display the zone as a string.
def __str__(self): """Display the zone as a string.""" return f'Rachio Zone "{self.name}" on {str(self._controller)}'
[ "def", "__str__", "(", "self", ")", ":", "return", "f'Rachio Zone \"{self.name}\" on {str(self._controller)}'" ]
[ 356, 4 ]
[ 358, 70 ]
python
en
['en', 'en', 'en']
True
RachioZone.zone_id
(self)
How the Rachio API refers to the zone.
How the Rachio API refers to the zone.
def zone_id(self) -> str: """How the Rachio API refers to the zone.""" return self.id
[ "def", "zone_id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "id" ]
[ 361, 4 ]
[ 363, 22 ]
python
en
['en', 'en', 'en']
True
RachioZone.name
(self)
Return the friendly name of the zone.
Return the friendly name of the zone.
def name(self) -> str: """Return the friendly name of the zone.""" return self._zone_name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_zone_name" ]
[ 366, 4 ]
[ 368, 30 ]
python
en
['en', 'en', 'en']
True
RachioZone.unique_id
(self)
Return a unique id by combining controller id and zone number.
Return a unique id by combining controller id and zone number.
def unique_id(self) -> str: """Return a unique id by combining controller id and zone number.""" return f"{self._controller.controller_id}-zone-{self.zone_id}"
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "f\"{self._controller.controller_id}-zone-{self.zone_id}\"" ]
[ 371, 4 ]
[ 373, 70 ]
python
en
['en', 'en', 'en']
True
RachioZone.icon
(self)
Return the icon to display.
Return the icon to display.
def icon(self) -> str: """Return the icon to display.""" return "mdi:water"
[ "def", "icon", "(", "self", ")", "->", "str", ":", "return", "\"mdi:water\"" ]
[ 376, 4 ]
[ 378, 26 ]
python
en
['en', 'en', 'en']
True
RachioZone.zone_is_enabled
(self)
Return whether the zone is allowed to run.
Return whether the zone is allowed to run.
def zone_is_enabled(self) -> bool: """Return whether the zone is allowed to run.""" return self._zone_enabled
[ "def", "zone_is_enabled", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_zone_enabled" ]
[ 381, 4 ]
[ 383, 33 ]
python
en
['en', 'en', 'en']
True
RachioZone.entity_picture
(self)
Return the entity picture to use in the frontend, if any.
Return the entity picture to use in the frontend, if any.
def entity_picture(self): """Return the entity picture to use in the frontend, if any.""" return self._entity_picture
[ "def", "entity_picture", "(", "self", ")", ":", "return", "self", ".", "_entity_picture" ]
[ 386, 4 ]
[ 388, 35 ]
python
en
['en', 'en', 'en']
True
RachioZone.extra_state_attributes
(self)
Return the optional state attributes.
Return the optional state attributes.
def extra_state_attributes(self) -> dict: """Return the optional state attributes.""" props = {ATTR_ZONE_NUMBER: self._zone_number, ATTR_ZONE_SUMMARY: self._summary} if self._shade_type: props[ATTR_ZONE_SHADE] = self._shade_type if self._zone_type: props[ATTR_ZONE...
[ "def", "extra_state_attributes", "(", "self", ")", "->", "dict", ":", "props", "=", "{", "ATTR_ZONE_NUMBER", ":", "self", ".", "_zone_number", ",", "ATTR_ZONE_SUMMARY", ":", "self", ".", "_summary", "}", "if", "self", ".", "_shade_type", ":", "props", "[", ...
[ 391, 4 ]
[ 407, 20 ]
python
en
['en', 'en', 'en']
True
RachioZone.turn_on
(self, **kwargs)
Start watering this zone.
Start watering this zone.
def turn_on(self, **kwargs) -> None: """Start watering this zone.""" # Stop other zones first self.turn_off() # Start this zone manual_run_time = timedelta( minutes=self._person.config_entry.options.get( CONF_MANUAL_RUN_MINS, DEFAULT_MANUAL_RUN_MINS ...
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "# Stop other zones first", "self", ".", "turn_off", "(", ")", "# Start this zone", "manual_run_time", "=", "timedelta", "(", "minutes", "=", "self", ".", "_person", ".", "config...
[ 409, 4 ]
[ 427, 9 ]
python
en
['en', 'sn', 'en']
True
RachioZone.turn_off
(self, **kwargs)
Stop watering all zones.
Stop watering all zones.
def turn_off(self, **kwargs) -> None: """Stop watering all zones.""" self._controller.stop_watering()
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "self", ".", "_controller", ".", "stop_watering", "(", ")" ]
[ 429, 4 ]
[ 431, 40 ]
python
en
['en', 'nl', 'en']
True
RachioZone.set_moisture_percent
(self, percent)
Set the zone moisture percent.
Set the zone moisture percent.
def set_moisture_percent(self, percent) -> None: """Set the zone moisture percent.""" _LOGGER.debug("Setting %s moisture to %s percent", self._zone_name, percent) self._controller.rachio.zone.set_moisture_percent(self.id, percent / 100)
[ "def", "set_moisture_percent", "(", "self", ",", "percent", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Setting %s moisture to %s percent\"", ",", "self", ".", "_zone_name", ",", "percent", ")", "self", ".", "_controller", ".", "rachio", ".", "zon...
[ 433, 4 ]
[ 436, 81 ]
python
en
['en', 'bg-Latn', 'en']
True
RachioZone._async_handle_update
(self, *args, **kwargs)
Handle incoming webhook zone data.
Handle incoming webhook zone data.
def _async_handle_update(self, *args, **kwargs) -> None: """Handle incoming webhook zone data.""" if args[0][KEY_ZONE_ID] != self.zone_id: return self._summary = args[0][KEY_SUMMARY] if args[0][KEY_SUBTYPE] == SUBTYPE_ZONE_STARTED: self._state = True eli...
[ "def", "_async_handle_update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "None", ":", "if", "args", "[", "0", "]", "[", "KEY_ZONE_ID", "]", "!=", "self", ".", "zone_id", ":", "return", "self", ".", "_summary", "=", "args", ...
[ 439, 4 ]
[ 455, 35 ]
python
en
['pl', 'xh', 'en']
False
RachioZone.async_added_to_hass
(self)
Subscribe to updates.
Subscribe to updates.
async def async_added_to_hass(self): """Subscribe to updates.""" self._state = self.zone_id == self._current_schedule.get(KEY_ZONE_ID) self.async_on_remove( async_dispatcher_connect( self.hass, SIGNAL_RACHIO_ZONE_UPDATE, self._async_handle_update ) ...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_state", "=", "self", ".", "zone_id", "==", "self", ".", "_current_schedule", ".", "get", "(", "KEY_ZONE_ID", ")", "self", ".", "async_on_remove", "(", "async_dispatcher_connect", "(",...
[ 457, 4 ]
[ 465, 9 ]
python
en
['en', 'en', 'en']
True
RachioSchedule.__init__
(self, person, controller, data, current_schedule)
Initialize a new Rachio Schedule.
Initialize a new Rachio Schedule.
def __init__(self, person, controller, data, current_schedule): """Initialize a new Rachio Schedule.""" self._schedule_id = data[KEY_ID] self._schedule_name = data[KEY_NAME] self._duration = data[KEY_DURATION] self._schedule_enabled = data[KEY_ENABLED] self._summary = dat...
[ "def", "__init__", "(", "self", ",", "person", ",", "controller", ",", "data", ",", "current_schedule", ")", ":", "self", ".", "_schedule_id", "=", "data", "[", "KEY_ID", "]", "self", ".", "_schedule_name", "=", "data", "[", "KEY_NAME", "]", "self", ".",...
[ 471, 4 ]
[ 480, 36 ]
python
co
['es', 'co', 'en']
False
RachioSchedule.name
(self)
Return the friendly name of the schedule.
Return the friendly name of the schedule.
def name(self) -> str: """Return the friendly name of the schedule.""" return f"{self._schedule_name} Schedule"
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "f\"{self._schedule_name} Schedule\"" ]
[ 483, 4 ]
[ 485, 48 ]
python
en
['en', 'en', 'en']
True