* Enable brightness slider for RGB
If we are using RGB with no brightness topic, the brighness slider
should still be visible, as we can scale the RGB amount to give us the
brightness.
* Output RGB scaled by brightness
If we are outputting to an RGB device, but do not have a dedicated
brightness topic set, when the brightness slider is changed, we should
output the current colour's HS, with the V coming from the brightness
slider.
* Brightness from RGB when we're not using a brightness topic
When we aren't using a brightness topic, set the brightness slider based
on the received value from an RGB -> HSV conversion.
* Test for new brightness state scaled by RGB
This adds a test to make sure the brightness stored in the state is
being computed correctly from the RGB value when a dedicated brightness
topic is not set.
* Changes from review
Fixes formatting of supported features flags, and checks HS colour
hasn't been set when operating in RGB-only mode
* Set optimistic brightness correctly in rgb mode
When we're using rgb mode to set the brightness, we want to set
optimistic brightness if:
we are running in optimistic mode
OR
the brightness state topic isn't set and we have a brightness command topic
OR
the rgb state topic isn't set and we don't have a brightness command topic
* Add test for turn_on in RGB brightness mode
* Changing z-wave brightness calculation to respect 0x01 and 0x02 byte
values
* adding additional line breaks to satisfy houndci
* - Update comment style for linter
- Add additional unit test to increase code coverage
* Update zwave.py
* First draft
* Generate device id
* No obscure registry
* Dont store config_entry_id in device
* Storage
* Small mistake on rebase
* Do storage more like entity registry
* Improve device identification
* Add tests
* Remove deconz device support from PR
* Fix hound comments, voff!
* Fix comments and clean up
* Fix proper indentation
* Fix pydoc issues
* Fix mochad component to not use self.device
* Fix mochad light platform to not use self.device
* Fix TankUtilitySensor to not use self.device
* Fix Soundtouch to not use self.device
* Fix Plex to not use self.device
* Fix Emby to not use self.device
* Fix Heatmiser to not use self.device
* Fix Wemo lights to not use self.device
* Fix Lifx to not use self.device
* Fix Radiotherm to not use self.device
* Fix Juicenet to not use self.device
* Fix Qwikswitch to not use self.device
* Fix Xiaomi miio to not use self.device
* Fix Nest to not use self.device
* Fix Tellduslive to not use self.device
* Fix Knx to not use self.device
* Clean up a small mistake in soundtouch
* Fix comment from Ballob
* Fix bad indentation
* Fix indentatin
* Lint
* Remove unused variable
* Lint
* Initial commit for deCONZ switch support
* Fix hound comment
* Fix martins comment; platforms shouldn't depend on another platform
* Fix existing tests
* New tests
* Clean up unnecessary methods
* Bump requirement to v43
* Added device state attributes to light
* Add context
* Add context to switch/light services
* Test set_state API
* Lint
* Fix tests
* Do not include context yet in comparison
* Do not pass in loop
* Fix Z-Wave tests
* Add websocket test without user
* Allow defining default turn-on values for lights in the profiles file.
* Mock out file operations in unit test.
* Fix unit test flakiness.
* Avoid unnecessary copy
* Fix ZWave RGBW lights not producing color without explicit white_value (#13930)
* simplify conditional in previous commit (#13930)
* ZwaveColorLight - only zero _white if white_value not specified in call (#13930)
* Fix MQTT Light with RGB and Brightness
When an MQTT light is given an RGB and Brightness topic, the RGB
is scaled by the brightness *as well* as the brightness being set
This causes 255,0,0 at 50% brightness to be sent as 127,0,0 at 50%
brightness, which ends up as 63,0,0 after the RGB bulb has applied
its brightness scaling.
Fixes the same issue in mqtt, mqtt-json and mqtt-template.
Related Issue: #13725
* Add comment to mqtt_json as well
* Add new device without restarting hass
* Remove debug prints
* Fix copy paste error
* Fix comments from balloob
Add tests to verify signalling with new added devices
* Fix hound comments
Add test to verify when new sensor is added
* Fix tests
* Unload entry should unsubscribe all deconz dispatchers
* Make sure mock setup also creates unsub in hass data
* Fix copy paste issue
* Lint
* Use forward entry setup with light platform
* Move sensor to forward entry setup
* Use forward entry setup with binary sensors
* Use forward entry setup with scene platform
* Remove import of unused functionality
* Move deconz setup in to setup entry
Create initial negative tests for setup entry
* Fix hound comment
* Improved tests
* Add test for scene platform
* Add test for binary sensor platform
* Add test for light platform
* Add test for light platform
* Add test for sensor platform
* Fix hound comment
* More asserts on sensor types
* Accept and report both xy and RGB color for lights
* Fix demo light supported_features
* Add new XY color util functions
* Always make color changes available as xy and RGB
* Always expose color as RGB and XY
* Consolidate color supported_features
* Test fixes
* Additional test fix
* Use hue/sat as the hass core color interface
* Tests updates
* Assume MQTT RGB devices need full RGB brightness
* Convert new platforms
* More migration
* Use float for HS API
* Fix backwards conversion for KNX lights
* Adjust limitless min saturation for new scale
* phue -> aiohue
* Clean up
* Fix config
* Address comments
* Typo
* Fix rebase error
* Mark light as unavailable when bridge is disconnected
* Tests
* Make Throttle work with double delay and async
* Rework update logic
* Don't resolve host to IP
* Clarify comment
* No longer do unnecessary updates
* Add more doc
* Another comment update
* Wrap up tests
* Lint
* Fix tests
* PyLint does not like mix 'n match async and coroutine
* Lint
* Update aiohue to 1.2
* Lint
* Fix await MagicMock
* Make color_name_to_rgb raise
* Add Light Set Color intent
* Move some methods around
* Cleanup
* Prevent 1 more func call
* Make a generic Set intent for light
* Lint
* lint
* Fix MQTT retained message not being re-dispatched
* Fix tests
* Use paho-mqtt for retained messages
* Improve code style
* Store list of subscribers
* Fix lint error
* Adhere to Home Assistant's logging standard
"Try to avoid brackets and additional quotes around the output to make it easier for users to parse the log."
- https://home-assistant.io/developers/development_guidelines/
* Add reconnect tests
* Fix lint error
* Introduce Subscription
Tests still need to be updated
* Use namedtuple for MQTT messages
... And fix issues
Accessing the config manually at runtime isn't ideal
* Fix MQTT __init__.py tests
* Updated usage of Mocks
* Moved tests that were testing subscriptions out of the MQTTComponent test, because of how mock.patch was used
* Adjusted the remaining tests for the MQTT clients new behavior - e.g. self.progress was removed
* Updated the async_fire_mqtt_message helper
* ✅ Update MQTT tests
* Re-introduce the MQTT subscriptions through the dispatcher for tests - quite ugly though... 🚧
* Update fixtures to use our new MQTT mock 🎨
* 📝 Update base code according to comments
* 🔨 Adjust MQTT test base
* 🔨 Update other MQTT tests
* 🍎 Fix carriage return in source files
Apparently test_mqtt_json.py and test_mqtt_template.py were written on Windows. In order to not mess up the diff, I'll just redo the carriage return.
* 🎨 Remove unused import
* 📝 Remove fire_mqtt_client_message
* 🐛 Fix using python 3.6 method
What's very interesting is that 3.4 didn't fail on travis...
* 🐛 Fix using assert directly
* Entity#unique_id defaults to None
* Initial commit entity registry
* Clean up unique_id property
* Lint
* Add tests to entity component
* Lint
* Restore some unique ids
* Spelling
* Remove use of IP address for unique ID
* Add tests
* Add tests
* Fix tests
* Add some docs
* Add one more test
* Fix new test…
* 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
* Use different colour channel intensities in tests
Uses a different value for each colour channel in MQTT light tests to
properly differentiate between colour channels.
* Correct ordering of RGB channels in MQTT light
* Improve support for multiple Hue bridges with lights that have the same id.
The old code pre-refactoring kept a per-bridge list of lights in a closure; my refactoring moved that to hass.data, which is convenient but caused them to conflict with each other.
Fixes#11183
* Update test_hue.py
* Fix X10 commands for mochad light turn on
This commit attempts to address issues that a lot of people are having
with the x10 light component. Originally this was written to use the
xdim (extended dim) X10 command. However, not every X10 dimmer device
supports the xdim command. Additionally, it turns out the number of
dim/brighness levels the X10 device supports is device specific and
there is no way to detect this (given the mostly 1 way nature of X10)
To address these issues, this commit removes the usage of xdim and
instead relies on using the 'on' command and the 'dim' command. This
should work on all x10 light devices. In an attempt to address the
different dim/brightness levels supported by different devices this
commit also adds a new optional config value, 'brightness_levels', to
specify if it's either 32, 64, or 256. By default 32 levels are used
as this is the normal case and what is documented by mochad.
Fixes#8943
* make code more readable
* fix style
* fix lint
* fix tests
* Introduce a new Hue component that knows how to talk to a Hue bridge, but doesn't actually set up lights.
* Refactor the hue lights platform to use the HueBridge class from the hue component.
* Reimplement support for multiple bridges
* Auto discover bridges.
* Provide some migration support by showing a persistent notification.
* Address most feedback from code review.
* Call load_platform from inside HueBridge.setup passing the bridge id.
Not only this looks nicer, but it also nicely solves additional bridges being added after initial setup (e.g. pairing a second bridge should work now, I believe it required a restart before).
* Add a unit test for hue_activate_scene
* Address feedback from code review.
* After feedback from @andrey-git I was able to find a way to not import phue in tests, yay!
* Inject a mock phue in a couple of places
* Added ability to control when the on command is sent.
* Changed to allow only brightness command
* Code cleanup
* Added test cases for on command mode.
* Added addition test
* Changed brightness options to lower case.
* Fixed case of default value
* Remove default
* Add mochad light component
This commit adds a new component to control x10 dimmers/lights with
mochad.
* Create comm_type and address constants
The comm_type and address conf constants are shared between all mochad
devices because they are required information used for configuring a
device. This commit moves the definition into const.py so they're
consistent between all component types.
* starting light template component
* linting/flaking
* starting unit tests from copypasta
* working on unit testing
* forgot to commit the test
* wrapped up unit testing
* adding remote back
* updates post running tox
* Revert "adding remote back"
This reverts commit 852c87ff96.
* adding submodule back from origin
* updating submodule
* removing a line to commit
* re-adding line
* trying to update line endings
* trying to fix line endings
* trying a different approach
* making requested changes, need to fix tests
* flaking
* union rather than intersect; makes a big difference
* more tests passing, not sure why this one's failing
* got it working
* most of the requested changes
* hopefully done now
* sets; the more you know
* Refactor color profiles to a class
* Refactor into preprocess_turn_on_alternatives
* LIFX: use light.preprocess_turn_on_alternatives
This avoids the color_name duplication and gains support for profile.
* Add kelvin parameter to light.turn_on
* Add brightness_pct parameter to light.turn_on
* LIFX: accept brightness_pct in effects
* Add test of kelvin/brightness_pct conversions
* Remove global limit on white light temperature
Here are the supported temperatures of some popular bulbs:
Philips Hue: 2000K-6500K (the current 500-154 mired range)
LIFX Color 1000: 2500K-9000K
IKEA TRÅDFRI: 2200K, 2700K, 4000K
Obviously, Home Assistant cannot enforce a global limit and work properly
with all of these bulbs. So just remove the limit and leave it up to each
platform to work it out.
This commit updates the existing users and adds a clamp to Hue (where the
limit appears to have originated). It does not attempt to update other
platforms that might need extra handling of the larger range that is now
possible.
* Add min_mireds/max_mireds state attributes to lights
* Support min_mireds/max_mireds with LIFX lights
* Add support for group commands (allon/alloff).
Add 'group_aliasses' config attribute that only respond to group commands.
Add nogroup_aliases that only respond to 'on' 'off' commands.
Allow settings device id group behaviour.
* Fix linting.
* Fix lint.
* added support for lights with toggle type
* fixed style errors
* introduced tests for the toggle type
it's not passing yet because of an assertionerror at line 407
* updated to reflect tristate of "state"
* Format code according to pep8
Added line break for import that was too long.
* fixed lint, replaced if statement with 'var = bool(test)'
* changed implementation of state check according to bug on 6bceb04ca1 (r106758784)