core/homeassistant/components/deconz/light.py

270 lines
7.6 KiB
Python
Raw Normal View History

"""Support for deCONZ lights."""
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
from homeassistant.components.light import (
2019-07-31 19:25:30 +00:00
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_EFFECT,
ATTR_FLASH,
ATTR_HS_COLOR,
ATTR_TRANSITION,
DOMAIN,
2019-07-31 19:25:30 +00:00
EFFECT_COLORLOOP,
FLASH_LONG,
FLASH_SHORT,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
SUPPORT_EFFECT,
SUPPORT_FLASH,
SUPPORT_TRANSITION,
2020-04-26 16:49:41 +00:00
LightEntity,
2019-07-31 19:25:30 +00:00
)
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
import homeassistant.util.color as color_util
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
from .const import (
CONF_GROUP_ID_BASE,
2019-07-31 19:25:30 +00:00
COVER_TYPES,
DOMAIN as DECONZ_DOMAIN,
NEW_GROUP,
NEW_LIGHT,
SWITCH_TYPES,
)
from .deconz_device import DeconzDevice
from .gateway import get_gateway_from_config_entry
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
2019-07-31 19:25:30 +00:00
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Old way of setting up deCONZ platforms."""
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the deCONZ lights and groups from a config entry."""
gateway = get_gateway_from_config_entry(hass, config_entry)
gateway.entities[DOMAIN] = set()
@callback
def async_add_light(lights):
"""Add light from deCONZ."""
entities = []
for light in lights:
if (
light.type not in COVER_TYPES + SWITCH_TYPES
and light.uniqueid not in gateway.entities[DOMAIN]
):
entities.append(DeconzLight(light, gateway))
async_add_entities(entities, True)
2019-07-31 19:25:30 +00:00
gateway.listeners.append(
async_dispatcher_connect(
hass, gateway.async_signal_new_device(NEW_LIGHT), async_add_light
2019-07-31 19:25:30 +00:00
)
)
@callback
def async_add_group(groups):
"""Add group from deCONZ."""
if not gateway.option_allow_deconz_groups:
return
entities = []
for group in groups:
if not group.lights:
continue
known_groups = list(gateway.entities[DOMAIN])
new_group = DeconzGroup(group, gateway)
if new_group.unique_id not in known_groups:
entities.append(new_group)
async_add_entities(entities, True)
2019-07-31 19:25:30 +00:00
gateway.listeners.append(
async_dispatcher_connect(
hass, gateway.async_signal_new_device(NEW_GROUP), async_add_group
2019-07-31 19:25:30 +00:00
)
)
async_add_light(gateway.api.lights.values())
async_add_group(gateway.api.groups.values())
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
class DeconzBaseLight(DeconzDevice, LightEntity):
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
"""Representation of a deCONZ light."""
TYPE = DOMAIN
def __init__(self, device, gateway):
"""Set up light."""
super().__init__(device, gateway)
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
self._features = 0
if self._device.brightness is not None:
self._features |= SUPPORT_BRIGHTNESS
self._features |= SUPPORT_FLASH
self._features |= SUPPORT_TRANSITION
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
if self._device.ct is not None:
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
self._features |= SUPPORT_COLOR_TEMP
if self._device.xy is not None:
self._features |= SUPPORT_COLOR
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
if self._device.effect is not None:
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
self._features |= SUPPORT_EFFECT
@property
def brightness(self):
"""Return the brightness of this light between 0..255."""
return self._device.brightness
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
@property
def effect_list(self):
"""Return the list of supported effects."""
return [EFFECT_COLORLOOP]
@property
def color_temp(self):
"""Return the CT color value."""
2019-07-31 19:25:30 +00:00
if self._device.colormode != "ct":
return None
return self._device.ct
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
@property
def hs_color(self):
"""Return the hs color value."""
2019-07-31 19:25:30 +00:00
if self._device.colormode in ("xy", "hs") and self._device.xy:
return color_util.color_xy_to_hs(*self._device.xy)
return None
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
@property
def is_on(self):
"""Return true if light is on."""
return self._device.state
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
@property
def supported_features(self):
"""Flag supported features."""
return self._features
async def async_turn_on(self, **kwargs):
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
"""Turn on light."""
2019-07-31 19:25:30 +00:00
data = {"on": True}
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
if ATTR_COLOR_TEMP in kwargs:
2019-07-31 19:25:30 +00:00
data["ct"] = kwargs[ATTR_COLOR_TEMP]
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
if ATTR_HS_COLOR in kwargs:
2019-07-31 19:25:30 +00:00
data["xy"] = color_util.color_hs_to_xy(*kwargs[ATTR_HS_COLOR])
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
if ATTR_BRIGHTNESS in kwargs:
2019-07-31 19:25:30 +00:00
data["bri"] = kwargs[ATTR_BRIGHTNESS]
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
if ATTR_TRANSITION in kwargs:
2019-07-31 19:25:30 +00:00
data["transitiontime"] = int(kwargs[ATTR_TRANSITION] * 10)
elif "IKEA" in self._device.manufacturer:
data["transitiontime"] = 0
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
if ATTR_FLASH in kwargs:
if kwargs[ATTR_FLASH] == FLASH_SHORT:
2019-07-31 19:25:30 +00:00
data["alert"] = "select"
del data["on"]
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
elif kwargs[ATTR_FLASH] == FLASH_LONG:
2019-07-31 19:25:30 +00:00
data["alert"] = "lselect"
del data["on"]
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
if ATTR_EFFECT in kwargs:
if kwargs[ATTR_EFFECT] == EFFECT_COLORLOOP:
2019-07-31 19:25:30 +00:00
data["effect"] = "colorloop"
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
else:
2019-07-31 19:25:30 +00:00
data["effect"] = "none"
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
await self._device.async_set_state(data)
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
async def async_turn_off(self, **kwargs):
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
"""Turn off light."""
if not self._device.state:
return
2019-07-31 19:25:30 +00:00
data = {"on": False}
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
if ATTR_TRANSITION in kwargs:
2019-07-31 19:25:30 +00:00
data["bri"] = 0
data["transitiontime"] = int(kwargs[ATTR_TRANSITION] * 10)
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
if ATTR_FLASH in kwargs:
if kwargs[ATTR_FLASH] == FLASH_SHORT:
2019-07-31 19:25:30 +00:00
data["alert"] = "select"
del data["on"]
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
elif kwargs[ATTR_FLASH] == FLASH_LONG:
2019-07-31 19:25:30 +00:00
data["alert"] = "lselect"
del data["on"]
Add deCONZ component (#10321) * Base implementation of component, no sensors yet * Added senor files * First fully working chain of sensors and binary sensors going from hardware in to hass * Clean up * Clean up * Added light platform * Turning lights on and off and set brightness now works * Pydeconz is now a proper pypi package Stop sessions when Home Assistant is shutting down Use a simpler websocket client * Updated pydocstrings Followed recommendations from pylint and flake8 * Clean up * Updated requirements_all.txt * Updated Codeowners to include deconz.py Also re-added the Axis component since it had gotten removed * Bump requirement * Bumped to v2 Reran script/gen_requirements * Removed global DECONZ since it wasn't relevant any more * Username and password is only relevant in the context of getting a API key * Add support for additional sensors * Added support for groups * Moved import of component library to inside of methods * Moved the need for device id to library * Bump pydeconz to v5 * Add support for colored lights * Pylint and flake8 import improvements * DATA_DECONZ TO DECONZ_DATA * Add support for transition time * Add support for flash * Bump to v7 * ZHASwitch devices will now only generate events by default, instead of being a sensor entity * Clean up * Add battery sensor when device signals through an event * Third-party library communicates with service * Add support for effect colorloop * Bump to pydeconz v8 * Same domain everywhere * Clean up * Updated requirements_all * Generated API key will now be stored in a config file * Change battery sensor to register to callback since library now supports multiple callbacks Move DeconzEvent to hub Bump to v9 * Improve entity attributes * Change end of battery name to battery level No need for static icon variable when using battery level helper * Bump requirement to v10 * Improve pydocstring for DeconzEvent Rename TYPE_AS_EVENT to CONF_TYPE_AS_EVENT * Allow separate brightness to override RGB brightness * Expose device.reachable in entity available property * Bump requirement to 11 (it goes up to 11!) * Pylint comment * Binary sensors don't have unit of measurement * Removed service to generate API key in favor of just generating it as a last resort of no API key is specified in configuration.yaml or deconz.conf * Replace clear text to attribute definitions * Use more constants * Bump requirements to v12 * Color temp requires xy color support * Only ZHASwitch should be an event * Bump requirements to v13 * Added effect_list property * Add attribute to battery sensor to easy find event id * Bump requirements to v14 * Fix hound comment * Bumped requirements_all information to v14 * Add service to configure devices on deCONZ * Add initial support for scenes * Bump requirements to v15 * Fix review comments * Python doc string improvement * Improve setup and error handling during setup * Changed how to evaluate light features * Remove 'ghost' events by not triggering updates if the signal originates from a config event Bump requirement to v17 * Fix pylint issue by moving scene ownership in to groups in requirement pydeconz Bump requirement to v18 * Added configurator option to register to deCONZ when unlocking gateway through settings Bump requirement to v20 * Improve async configurator * No user interaction for deconz.conf * No file management in event loop * Improve readability of load platform * Fewer entity attributes * Use values() instead of items() for dicts where applicable * Do one add devices per platform * Clean up of unused attributes * Make sure that discovery info is not None * Only register configure service and shutdown service when deconz has been setup properly * Move description * Fix lines longer than 80 * Moved deconz services to a separate file and moved hub to deconz/__init__.py * Remove option to configure switch as entity * Moved DeconzEvent to sensor since it is only Switch buttonpress that will be sent as event * Added support for automatic discovery of deconz Thanks to Kroimon for adding support to netdisco * Use markup for configuration description * Fix coveragerc * Remove deCONZ support from Hue component * Improved docstrings and readability * Remove unnecessary extra name for storing in hass.data, using domain instead * Improve readability by renaming all async methods Bump to v21 - improved async naming on methods * Fix first line not being in imperative mood * Added logo to configurator Let deconz.conf be visible since it will be the main config for the component after initial setup * Removed bridge_type from new unit tests as part of removing deconz support from hue component * Capitalize first letters of Battery Level * Properly update state of sensor as well as reachable and battery Bump dependency to v22 * Fix flake8 Multi-line docstring closing quotes should be on a separate line * Fix martinhjelmares comments Bump dependency to v23 Use only HASS aiohttp session Change when to use 'deconz' or domain or deconz data Clean up unused logger defines Remove unnecessary return values Fix faulty references to component documentation Move callback registration to after entity has been initialized by HASS Less inception style on pydocs ;) Simplify loading platforms by using a for loop Added voluptous schema for service Yaml file is for deconz only, no need to have the domain present Remove domain constraint when creating event title
2018-01-01 16:08:13 +00:00
await self._device.async_set_state(data)
@property
def device_state_attributes(self):
"""Return the device state attributes."""
attributes = {}
2019-07-31 19:25:30 +00:00
attributes["is_deconz_group"] = self._device.type == "LightGroup"
return attributes
class DeconzLight(DeconzBaseLight):
"""Representation of a deCONZ light."""
@property
def max_mireds(self):
"""Return the warmest color_temp that this light supports."""
return self._device.ctmax or super().max_mireds
@property
def min_mireds(self):
"""Return the coldest color_temp that this light supports."""
return self._device.ctmin or super().min_mireds
class DeconzGroup(DeconzBaseLight):
"""Representation of a deCONZ group."""
def __init__(self, device, gateway):
"""Set up group and create an unique id."""
group_id_base = gateway.config_entry.unique_id
if CONF_GROUP_ID_BASE in gateway.config_entry.data:
group_id_base = gateway.config_entry.data[CONF_GROUP_ID_BASE]
self._unique_id = f"{group_id_base}-{device.deconz_id}"
super().__init__(device, gateway)
@property
def unique_id(self):
"""Return a unique identifier for this device."""
return self._unique_id
@property
def device_info(self):
"""Return a device description for device registry."""
bridgeid = self.gateway.api.config.bridgeid
return {
2019-07-31 19:25:30 +00:00
"identifiers": {(DECONZ_DOMAIN, self.unique_id)},
"manufacturer": "Dresden Elektronik",
"model": "deCONZ group",
"name": self._device.name,
"via_device": (DECONZ_DOMAIN, bridgeid),
}
@property
def device_state_attributes(self):
"""Return the device state attributes."""
attributes = dict(super().device_state_attributes)
attributes["all_on"] = self._device.all_on
return attributes