core/homeassistant/components/fritzbox/switch.py

82 lines
2.6 KiB
Python
Raw Normal View History

"""Support for AVM FRITZ!SmartHome switch devices."""
from __future__ import annotations
from typing import Any
2021-07-22 16:19:39 +00:00
from homeassistant.components.sensor import ATTR_STATE_CLASS
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_ENTITY_ID,
ATTR_NAME,
ATTR_UNIT_OF_MEASUREMENT,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import FritzBoxEntity
from .const import (
ATTR_STATE_DEVICE_LOCKED,
ATTR_STATE_LOCKED,
CONF_COORDINATOR,
DOMAIN as FRITZBOX_DOMAIN,
)
from .model import SwitchExtraAttributes
Add AVM fritzbox smarthome component (#10688) * initial commit Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix failed flake8 tests Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add fritzhome files to .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong module import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too general exception Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove blank line Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix issue with operations Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * adapt to supported_features Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change checking of kwargs to canonical way Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused self._state Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Don't overwrite the platform domain Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove parenthesis from import without line break Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Do not pass hass to the components on init Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove check for available in current_operation Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove redundant logging message Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add blank line between standard and hass imports Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Use states from base climate component Also add the new state STATE_MANUAL to the base. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add reconnect when access failed Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add device specific attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * group the imports from the same module Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change domain data to fritz instance This let us use the fritz instance to reconnect from platform without accessing protected attributes. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix typo Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform from fritzhome to fritzbox Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add device_state_attributes Add attributes to have compatiblity to fritzdect. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add support for multiple fritzboxes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix pylint issues Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fixed pyfritzhome version Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix component name in requirements_all.txt Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * upgrade pyfritzhome to 0.3.7 Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform/component also in .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use DEFAULT_HOST when no host is in dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add config schema for dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove check The check since since the config scheme takes case. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add check for empty devices Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use standard attribute from base class Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove STATE_MANUAL from operation list Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove set DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * don't pass hass to the SwitchDevice Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unsed DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * refactored device attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add info output if no fritzbox is configured Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * small fixes according review comment Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unneeded default value Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove non required code from try..except block Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * line break for line that is too long Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too many empty lines Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2018-04-17 10:40:36 +00:00
async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Set up the FRITZ!SmartHome switch from ConfigEntry."""
entities: list[FritzboxSwitch] = []
coordinator = hass.data[FRITZBOX_DOMAIN][entry.entry_id][CONF_COORDINATOR]
for ain, device in coordinator.data.items():
if not device.has_switch:
continue
entities.append(
FritzboxSwitch(
{
ATTR_NAME: f"{device.name}",
ATTR_ENTITY_ID: f"{device.ain}",
ATTR_UNIT_OF_MEASUREMENT: None,
ATTR_DEVICE_CLASS: None,
2021-07-22 16:19:39 +00:00
ATTR_STATE_CLASS: None,
},
coordinator,
ain,
)
)
Add AVM fritzbox smarthome component (#10688) * initial commit Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix failed flake8 tests Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add fritzhome files to .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong module import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too general exception Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove blank line Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix issue with operations Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * adapt to supported_features Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change checking of kwargs to canonical way Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused self._state Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Don't overwrite the platform domain Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove parenthesis from import without line break Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Do not pass hass to the components on init Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove check for available in current_operation Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove redundant logging message Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add blank line between standard and hass imports Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Use states from base climate component Also add the new state STATE_MANUAL to the base. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add reconnect when access failed Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add device specific attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * group the imports from the same module Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change domain data to fritz instance This let us use the fritz instance to reconnect from platform without accessing protected attributes. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix typo Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform from fritzhome to fritzbox Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add device_state_attributes Add attributes to have compatiblity to fritzdect. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add support for multiple fritzboxes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix pylint issues Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fixed pyfritzhome version Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix component name in requirements_all.txt Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * upgrade pyfritzhome to 0.3.7 Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform/component also in .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use DEFAULT_HOST when no host is in dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add config schema for dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove check The check since since the config scheme takes case. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add check for empty devices Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use standard attribute from base class Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove STATE_MANUAL from operation list Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove set DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * don't pass hass to the SwitchDevice Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unsed DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * refactored device attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add info output if no fritzbox is configured Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * small fixes according review comment Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unneeded default value Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove non required code from try..except block Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * line break for line that is too long Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too many empty lines Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2018-04-17 10:40:36 +00:00
async_add_entities(entities)
Add AVM fritzbox smarthome component (#10688) * initial commit Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix failed flake8 tests Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add fritzhome files to .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong module import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too general exception Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove blank line Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix issue with operations Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * adapt to supported_features Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change checking of kwargs to canonical way Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused self._state Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Don't overwrite the platform domain Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove parenthesis from import without line break Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Do not pass hass to the components on init Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove check for available in current_operation Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove redundant logging message Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add blank line between standard and hass imports Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Use states from base climate component Also add the new state STATE_MANUAL to the base. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add reconnect when access failed Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add device specific attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * group the imports from the same module Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change domain data to fritz instance This let us use the fritz instance to reconnect from platform without accessing protected attributes. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix typo Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform from fritzhome to fritzbox Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add device_state_attributes Add attributes to have compatiblity to fritzdect. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add support for multiple fritzboxes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix pylint issues Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fixed pyfritzhome version Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix component name in requirements_all.txt Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * upgrade pyfritzhome to 0.3.7 Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform/component also in .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use DEFAULT_HOST when no host is in dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add config schema for dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove check The check since since the config scheme takes case. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add check for empty devices Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use standard attribute from base class Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove STATE_MANUAL from operation list Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove set DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * don't pass hass to the SwitchDevice Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unsed DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * refactored device attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add info output if no fritzbox is configured Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * small fixes according review comment Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unneeded default value Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove non required code from try..except block Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * line break for line that is too long Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too many empty lines Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2018-04-17 10:40:36 +00:00
class FritzboxSwitch(FritzBoxEntity, SwitchEntity):
"""The switch class for FRITZ!SmartHome switches."""
Add AVM fritzbox smarthome component (#10688) * initial commit Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix failed flake8 tests Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add fritzhome files to .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong module import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too general exception Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove blank line Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix issue with operations Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * adapt to supported_features Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change checking of kwargs to canonical way Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused self._state Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Don't overwrite the platform domain Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove parenthesis from import without line break Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Do not pass hass to the components on init Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove check for available in current_operation Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove redundant logging message Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add blank line between standard and hass imports Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Use states from base climate component Also add the new state STATE_MANUAL to the base. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add reconnect when access failed Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add device specific attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * group the imports from the same module Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change domain data to fritz instance This let us use the fritz instance to reconnect from platform without accessing protected attributes. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix typo Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform from fritzhome to fritzbox Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add device_state_attributes Add attributes to have compatiblity to fritzdect. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add support for multiple fritzboxes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix pylint issues Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fixed pyfritzhome version Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix component name in requirements_all.txt Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * upgrade pyfritzhome to 0.3.7 Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform/component also in .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use DEFAULT_HOST when no host is in dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add config schema for dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove check The check since since the config scheme takes case. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add check for empty devices Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use standard attribute from base class Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove STATE_MANUAL from operation list Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove set DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * don't pass hass to the SwitchDevice Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unsed DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * refactored device attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add info output if no fritzbox is configured Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * small fixes according review comment Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unneeded default value Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove non required code from try..except block Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * line break for line that is too long Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too many empty lines Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2018-04-17 10:40:36 +00:00
@property
def is_on(self) -> bool:
Add AVM fritzbox smarthome component (#10688) * initial commit Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix failed flake8 tests Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add fritzhome files to .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong module import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too general exception Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove blank line Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix issue with operations Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * adapt to supported_features Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change checking of kwargs to canonical way Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused self._state Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Don't overwrite the platform domain Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove parenthesis from import without line break Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Do not pass hass to the components on init Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove check for available in current_operation Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove redundant logging message Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add blank line between standard and hass imports Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Use states from base climate component Also add the new state STATE_MANUAL to the base. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add reconnect when access failed Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add device specific attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * group the imports from the same module Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change domain data to fritz instance This let us use the fritz instance to reconnect from platform without accessing protected attributes. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix typo Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform from fritzhome to fritzbox Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add device_state_attributes Add attributes to have compatiblity to fritzdect. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add support for multiple fritzboxes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix pylint issues Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fixed pyfritzhome version Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix component name in requirements_all.txt Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * upgrade pyfritzhome to 0.3.7 Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform/component also in .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use DEFAULT_HOST when no host is in dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add config schema for dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove check The check since since the config scheme takes case. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add check for empty devices Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use standard attribute from base class Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove STATE_MANUAL from operation list Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove set DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * don't pass hass to the SwitchDevice Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unsed DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * refactored device attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add info output if no fritzbox is configured Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * small fixes according review comment Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unneeded default value Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove non required code from try..except block Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * line break for line that is too long Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too many empty lines Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2018-04-17 10:40:36 +00:00
"""Return true if the switch is on."""
return self.device.switch_state # type: ignore [no-any-return]
Add AVM fritzbox smarthome component (#10688) * initial commit Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix failed flake8 tests Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add fritzhome files to .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong module import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too general exception Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove blank line Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix issue with operations Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * adapt to supported_features Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change checking of kwargs to canonical way Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused self._state Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Don't overwrite the platform domain Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove parenthesis from import without line break Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Do not pass hass to the components on init Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove check for available in current_operation Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove redundant logging message Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add blank line between standard and hass imports Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Use states from base climate component Also add the new state STATE_MANUAL to the base. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add reconnect when access failed Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add device specific attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * group the imports from the same module Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change domain data to fritz instance This let us use the fritz instance to reconnect from platform without accessing protected attributes. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix typo Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform from fritzhome to fritzbox Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add device_state_attributes Add attributes to have compatiblity to fritzdect. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add support for multiple fritzboxes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix pylint issues Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fixed pyfritzhome version Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix component name in requirements_all.txt Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * upgrade pyfritzhome to 0.3.7 Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform/component also in .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use DEFAULT_HOST when no host is in dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add config schema for dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove check The check since since the config scheme takes case. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add check for empty devices Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use standard attribute from base class Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove STATE_MANUAL from operation list Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove set DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * don't pass hass to the SwitchDevice Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unsed DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * refactored device attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add info output if no fritzbox is configured Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * small fixes according review comment Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unneeded default value Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove non required code from try..except block Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * line break for line that is too long Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too many empty lines Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2018-04-17 10:40:36 +00:00
async def async_turn_on(self, **kwargs: Any) -> None:
Add AVM fritzbox smarthome component (#10688) * initial commit Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix failed flake8 tests Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add fritzhome files to .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong module import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too general exception Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove blank line Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix issue with operations Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * adapt to supported_features Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change checking of kwargs to canonical way Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused self._state Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Don't overwrite the platform domain Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove parenthesis from import without line break Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Do not pass hass to the components on init Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove check for available in current_operation Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove redundant logging message Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add blank line between standard and hass imports Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Use states from base climate component Also add the new state STATE_MANUAL to the base. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add reconnect when access failed Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add device specific attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * group the imports from the same module Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change domain data to fritz instance This let us use the fritz instance to reconnect from platform without accessing protected attributes. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix typo Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform from fritzhome to fritzbox Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add device_state_attributes Add attributes to have compatiblity to fritzdect. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add support for multiple fritzboxes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix pylint issues Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fixed pyfritzhome version Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix component name in requirements_all.txt Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * upgrade pyfritzhome to 0.3.7 Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform/component also in .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use DEFAULT_HOST when no host is in dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add config schema for dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove check The check since since the config scheme takes case. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add check for empty devices Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use standard attribute from base class Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove STATE_MANUAL from operation list Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove set DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * don't pass hass to the SwitchDevice Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unsed DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * refactored device attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add info output if no fritzbox is configured Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * small fixes according review comment Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unneeded default value Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove non required code from try..except block Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * line break for line that is too long Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too many empty lines Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2018-04-17 10:40:36 +00:00
"""Turn the switch on."""
await self.hass.async_add_executor_job(self.device.set_switch_state_on)
await self.coordinator.async_refresh()
Add AVM fritzbox smarthome component (#10688) * initial commit Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix failed flake8 tests Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add fritzhome files to .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong module import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too general exception Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove blank line Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix issue with operations Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * adapt to supported_features Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change checking of kwargs to canonical way Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused self._state Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Don't overwrite the platform domain Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove parenthesis from import without line break Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Do not pass hass to the components on init Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove check for available in current_operation Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove redundant logging message Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add blank line between standard and hass imports Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Use states from base climate component Also add the new state STATE_MANUAL to the base. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add reconnect when access failed Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add device specific attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * group the imports from the same module Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change domain data to fritz instance This let us use the fritz instance to reconnect from platform without accessing protected attributes. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix typo Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform from fritzhome to fritzbox Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add device_state_attributes Add attributes to have compatiblity to fritzdect. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add support for multiple fritzboxes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix pylint issues Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fixed pyfritzhome version Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix component name in requirements_all.txt Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * upgrade pyfritzhome to 0.3.7 Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform/component also in .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use DEFAULT_HOST when no host is in dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add config schema for dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove check The check since since the config scheme takes case. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add check for empty devices Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use standard attribute from base class Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove STATE_MANUAL from operation list Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove set DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * don't pass hass to the SwitchDevice Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unsed DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * refactored device attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add info output if no fritzbox is configured Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * small fixes according review comment Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unneeded default value Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove non required code from try..except block Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * line break for line that is too long Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too many empty lines Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2018-04-17 10:40:36 +00:00
async def async_turn_off(self, **kwargs: Any) -> None:
Add AVM fritzbox smarthome component (#10688) * initial commit Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix failed flake8 tests Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add fritzhome files to .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong module import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too general exception Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove blank line Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix issue with operations Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * adapt to supported_features Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change checking of kwargs to canonical way Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused self._state Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Don't overwrite the platform domain Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove parenthesis from import without line break Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Do not pass hass to the components on init Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove check for available in current_operation Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove redundant logging message Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add blank line between standard and hass imports Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Use states from base climate component Also add the new state STATE_MANUAL to the base. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add reconnect when access failed Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add device specific attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * group the imports from the same module Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change domain data to fritz instance This let us use the fritz instance to reconnect from platform without accessing protected attributes. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix typo Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform from fritzhome to fritzbox Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add device_state_attributes Add attributes to have compatiblity to fritzdect. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add support for multiple fritzboxes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix pylint issues Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fixed pyfritzhome version Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix component name in requirements_all.txt Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * upgrade pyfritzhome to 0.3.7 Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform/component also in .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use DEFAULT_HOST when no host is in dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add config schema for dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove check The check since since the config scheme takes case. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add check for empty devices Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use standard attribute from base class Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove STATE_MANUAL from operation list Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove set DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * don't pass hass to the SwitchDevice Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unsed DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * refactored device attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add info output if no fritzbox is configured Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * small fixes according review comment Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unneeded default value Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove non required code from try..except block Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * line break for line that is too long Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too many empty lines Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2018-04-17 10:40:36 +00:00
"""Turn the switch off."""
await self.hass.async_add_executor_job(self.device.set_switch_state_off)
await self.coordinator.async_refresh()
Add AVM fritzbox smarthome component (#10688) * initial commit Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix failed flake8 tests Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add fritzhome files to .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong module import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too general exception Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove blank line Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix issue with operations Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * adapt to supported_features Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change checking of kwargs to canonical way Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused self._state Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Don't overwrite the platform domain Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove parenthesis from import without line break Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Do not pass hass to the components on init Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove check for available in current_operation Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove redundant logging message Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add blank line between standard and hass imports Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Use states from base climate component Also add the new state STATE_MANUAL to the base. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add reconnect when access failed Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add device specific attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * group the imports from the same module Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change domain data to fritz instance This let us use the fritz instance to reconnect from platform without accessing protected attributes. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix typo Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform from fritzhome to fritzbox Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add device_state_attributes Add attributes to have compatiblity to fritzdect. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add support for multiple fritzboxes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix pylint issues Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fixed pyfritzhome version Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix component name in requirements_all.txt Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * upgrade pyfritzhome to 0.3.7 Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform/component also in .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use DEFAULT_HOST when no host is in dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add config schema for dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove check The check since since the config scheme takes case. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add check for empty devices Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use standard attribute from base class Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove STATE_MANUAL from operation list Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove set DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * don't pass hass to the SwitchDevice Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unsed DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * refactored device attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add info output if no fritzbox is configured Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * small fixes according review comment Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unneeded default value Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove non required code from try..except block Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * line break for line that is too long Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too many empty lines Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2018-04-17 10:40:36 +00:00
@property
def extra_state_attributes(self) -> SwitchExtraAttributes:
Add AVM fritzbox smarthome component (#10688) * initial commit Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix failed flake8 tests Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add fritzhome files to .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong module import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too general exception Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove blank line Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix issue with operations Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * adapt to supported_features Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change checking of kwargs to canonical way Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused self._state Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Don't overwrite the platform domain Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove parenthesis from import without line break Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Do not pass hass to the components on init Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove check for available in current_operation Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove redundant logging message Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add blank line between standard and hass imports Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Use states from base climate component Also add the new state STATE_MANUAL to the base. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add reconnect when access failed Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add device specific attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * group the imports from the same module Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change domain data to fritz instance This let us use the fritz instance to reconnect from platform without accessing protected attributes. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix typo Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform from fritzhome to fritzbox Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add device_state_attributes Add attributes to have compatiblity to fritzdect. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add support for multiple fritzboxes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix pylint issues Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fixed pyfritzhome version Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix component name in requirements_all.txt Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * upgrade pyfritzhome to 0.3.7 Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform/component also in .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use DEFAULT_HOST when no host is in dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add config schema for dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove check The check since since the config scheme takes case. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add check for empty devices Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use standard attribute from base class Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove STATE_MANUAL from operation list Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove set DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * don't pass hass to the SwitchDevice Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unsed DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * refactored device attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add info output if no fritzbox is configured Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * small fixes according review comment Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unneeded default value Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove non required code from try..except block Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * line break for line that is too long Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too many empty lines Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2018-04-17 10:40:36 +00:00
"""Return the state attributes of the device."""
attrs: SwitchExtraAttributes = {
ATTR_STATE_DEVICE_LOCKED: self.device.device_lock,
ATTR_STATE_LOCKED: self.device.lock,
}
Add AVM fritzbox smarthome component (#10688) * initial commit Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix failed flake8 tests Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add fritzhome files to .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong module import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too general exception Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove blank line Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix wrong import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix issue with operations Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * incorporate review comments Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * adapt to supported_features Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change checking of kwargs to canonical way Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unused self._state Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Don't overwrite the platform domain Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove parenthesis from import without line break Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Do not pass hass to the components on init Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove check for available in current_operation Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Remove redundant logging message Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add blank line between standard and hass imports Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Use states from base climate component Also add the new state STATE_MANUAL to the base. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add reconnect when access failed Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add device specific attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * group the imports from the same module Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * change domain data to fritz instance This let us use the fritz instance to reconnect from platform without accessing protected attributes. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix typo Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform from fritzhome to fritzbox Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * Add device_state_attributes Add attributes to have compatiblity to fritzdect. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add support for multiple fritzboxes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix pylint issues Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fixed pyfritzhome version Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix import Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * fix component name in requirements_all.txt Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * upgrade pyfritzhome to 0.3.7 Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * rename platform/component also in .coveragerc Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use DEFAULT_HOST when no host is in dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add config schema for dict Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove check The check since since the config scheme takes case. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add check for empty devices Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * use standard attribute from base class Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove STATE_MANUAL from operation list Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove set DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * don't pass hass to the SwitchDevice Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unsed DEFAULT_HOST Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * refactored device attributes Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * add info output if no fritzbox is configured Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * small fixes according review comment Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove unneeded default value Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove non required code from try..except block Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * line break for line that is too long Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * remove too many empty lines Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2018-04-17 10:40:36 +00:00
return attrs