Commit graph

324 commits

Author SHA1 Message Date
javicalle
61ca9bb8e4 Restore states for RFLink devices ()
* Merge branch 'master' of https://github.com/home-assistant/home-assistant into dev

# Conflicts:
#	homeassistant/components/binary_sensor/point.py
#	homeassistant/components/cloud/__init__.py
#	homeassistant/components/cloud/prefs.py
#	homeassistant/components/frontend/__init__.py
#	homeassistant/components/light/fibaro.py
#	homeassistant/components/logbook.py
#	homeassistant/components/point/__init__.py
#	homeassistant/config_entries.py
#	homeassistant/const.py
#	homeassistant/helpers/service.py
#	requirements_all.txt
#	requirements_test_all.txt

* one 'async_get_last_state' refactor left behind

* Remove RestoreEntity inheritance (already in parent class)

* # pylint: disable=too-many-ancestors

* code predictor can be a bitch

* lint corrections

* # pylint: disable=too-many-ancestors

* recover from dict[key]

* Remove all 'coroutine' decorator, replace for 'async def'
Replace all 'yield from' for 'await'
Replace 'hass.async_add_job' for 'hass.async_create_task'
2018-12-11 17:20:30 +01:00
emontnemery
afa99915e3 Reconfigure MQTT light component if discovery info is changed () 2018-12-02 16:16:36 +01:00
Adam Mills
5c3a4e3d10 Restore states through a JSON store instead of recorder ()
* Restore states through a JSON store

* Accept entity_id directly in restore state helper

* Keep states stored between runs for a limited time

* Remove warning
2018-11-28 13:16:43 +01:00
emontnemery
16e3ff2fec Mqtt light refactor ()
* Rename mqtt light files

* Refactor mqtt light

* Remove outdated testcase

* Add backwards compatibility for MQTT discovered MQTT lights.
Refactor according to review comments.
2018-11-27 14:00:05 +01:00
Paulus Schoutsen
36c31a6293
Add permissions check in service helper ()
* Add permissions check in service helper

* Lint

* Fix tests

* Lint

* Typing

* Fix unused impoert
2018-11-21 12:26:08 +01:00
Franck Nijhof
80cd8b180c Adds light switch platform ()
* Adds light switch platform

* Addresses HoundCI warnings

* Addresses Flake8 reported issues

* Removes async_update call as per review
2018-11-20 11:51:34 +01:00
Robert Svensson
a9140dc8f5
deCONZ - retry if setup fails ()
* Make component retry if setup fails
* Improve overall test coverage
2018-10-31 22:38:04 +01:00
Paulus Schoutsen
6ae345b01c
Pass hass_config to load_platform ()
* Pass hass_config to load_platform

* Fix tests

* Lint
2018-10-29 19:21:21 +01:00
Paulus Schoutsen
644c33cc1e
Convert MQTT Light tests to async () 2018-10-26 15:10:05 +02:00
kennedyshead
67d92c4f5d This makes mqtt_template tests async () 2018-10-25 10:00:07 +02:00
kennedyshead
8bebfba21a Testing async in MQTT_json lights () 2018-10-25 09:54:53 +02:00
Paulus Schoutsen
08fe7c3ece
Pytest tests ()
* Convert core tests

* Convert component tests to use pytest assert

* Lint 🤷‍♂️

* Fix test

* Fix 3 typos in docs
2018-10-24 12:10:05 +02:00
Bob Clough
2e973c7572 Fix mqtt light brightness slider ()
* 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
2018-10-20 12:37:25 -04:00
emontnemery
42fb886d71 Add support for HS color to mqtt light ()
* Add support for HS color to mqtt light

* Warn if hs state update is invalid
2018-10-08 15:36:57 +02:00
Otto Winter
af89e7c50f Move more MQTT platforms to config entries ()
* Move more MQTT platforms to config entries

* Address comments
2018-09-28 16:57:17 +02:00
Otto Winter
c9b6567265 Remove discovered mqtt_json light entity when discovery is cleared ()
* Remove discovered mqtt_json entity device when discovery topic is cleared

* Keep imports ordered
2018-09-28 00:25:51 +02:00
cdce8p
70b901017f Remove service helper (5) ()
* Update switch

* Update script

* Update light

* Fix tests

* Fix config/script hook

* Async_create_task

* Fix flux switch
2018-09-27 23:13:11 +02:00
emontnemery
eb59f2dd3c Move MQTT discovery removal tests to platform test files () 2018-09-25 19:32:04 +02:00
Paulus Schoutsen
399040de46
Fix files left behind ()
* Light demo test to not write entity registry

* Fix Manual MQTT alarm control panel
2018-09-25 17:19:46 +02:00
Robert Svensson
90c18d1c15 deCONZ add via_hub attribute for device registry ()
* deCONZ add via_hub attribute for device registry

* A shorter way to get bridgeid
2018-09-21 09:21:44 +02:00
Paulus Schoutsen
a1c524d372
Config flow tradfri ()
* Fix comments

* Add config flow tests

* Fix Tradfri light tests

* Lint

* Remove import group from config flow

* fix stale comments
2018-09-19 21:21:43 +02:00
Paulus Schoutsen
201fd4afee Add config entries to connection class () 2018-09-17 10:12:46 +02:00
Harvtronix
d076251b18 Changing z-wave brightness calculation to respect 0x01 and 0x02 byte values ()
* 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
2018-09-13 10:38:07 -04:00
Paulus Schoutsen
994b829cb4
add_devices -> add_entities ()
* add_devices -> add_entities

* Lint

* PyLint

* Revert external method in scsgate
2018-08-24 16:37:30 +02:00
Robert Svensson
0009be595c Device Registry ()
* 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
2018-08-22 10:46:37 +02:00
Ville Skyttä
dbd0763f83 Grammar and spelling fixes () 2018-08-19 22:29:08 +02:00
Paulus Schoutsen
8ec550d6e0 Storage entity registry ()
* Split out storage delayed write

* Update code using delayed save

* Fix tests

* Fix typing test

* Add callback decorator

* Migrate entity registry to storage helper

* Make double loading protection easier

* Lint

* Fix tests

* Ordered Dict
2018-08-18 13:34:33 +02:00
Paulus Schoutsen
1ff1639cef
More entity service ()
* Camera use entity service

* Convert climate services

* Convert light

* Convert media player

* Migrate fan
2018-08-16 14:28:59 +02:00
Robert Svensson
f8a478946e deCONZ - support for power plugs ()
* 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
2018-08-01 11:03:08 +02:00
Paulus Schoutsen
c7f4bdafc0 Context ()
* 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
2018-07-28 17:53:37 -07:00
Daniel Kalmar
0cc9798c8f Allow defining default turn-on values for lights in the profiles file. ()
* 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
2018-07-24 20:29:59 +02:00
Ville Skyttä
b7c336a687 Pylint cleanups ()
* Pylint 2 no-else-return fixes

* Remove unneeded abstract-class-not-used pylint disable
2018-07-23 10:16:05 +02:00
Anders Melchiorsen
e427f9ee38 RFC: Only use supported light properties ()
* Only use supported light properties

* Fix tests
2018-07-18 12:18:22 +02:00
Jason Antman
6e22a0e4d9 Fix ZWave RGBW lights not producing color without explicit white_value ()
* Fix ZWave RGBW lights not producing color without explicit white_value ()

* simplify conditional in previous commit ()

* ZwaveColorLight - only zero _white if white_value not specified in call ()
2018-07-14 00:54:15 +02:00
Paulus Schoutsen
538236de8f Fix formatting pylint comments in test () 2018-07-13 23:02:23 +02:00
Bob Clough
bfc55137ea Fix MQTT Light with RGB and Brightness ()
* 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: 

* Add comment to mqtt_json as well
2018-06-21 14:59:02 -04:00
Hate-Usernames
153ccda853 Patch save_json () 2018-06-18 21:34:36 -04:00
Robert Svensson
ac13a2736b Deconz make groups configurable ()
* Make groups configurable

* Config flow and tests in place

* Fix too long line
2018-06-15 14:31:22 -04:00
Hate-Usernames
a373793029 pytradfri 5.5.1: Improved 3rd party bulb support ()
* Bump pytradfri version

* Update light component

* Add tests

* lint

* Docstring typos

* Blank line

* lint

* 5.5.1

* Fix tests on py3.5
2018-06-13 07:17:52 +02:00
Diogo Gomes
d47006c98f Optimistic MQTT light ()
* Restores light state, case the light is optimistic

* lint

* hound

* hound

* Added mqtt_json

* hound

* added mqtt_template

* lint

* cleanup

* use ATTR
2018-05-15 12:25:50 +02:00
Ville Skyttä
843789528e Remove extra quotes from docstrings () 2018-05-13 11:06:15 +02:00
Robert Svensson
8410b63d9c deCONZ add new device without restart ()
* 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
2018-05-05 10:11:00 -04:00
Anders Melchiorsen
bf056b6f01 Fix Hue color state for missing xy () 2018-05-02 09:25:08 -04:00
Paulus Schoutsen
83d300fd11 Custom component loading cleanup ()
* Clean up custom component loading

* Fix some tests

* Fix some stuff

* Make imports work again

* Fix tests

* Remove debug print

* Lint
2018-05-01 20:57:30 +02:00
Anders Melchiorsen
30d987f59f
Revert Hue color state to be xy-based () 2018-04-30 00:49:19 +02:00
Otto Winter
a0b14c2913 Light mqtt_json: Add HS color support ()
* Light mqtt_json HS color support

* Lint

* Catch float ValueError
2018-04-29 00:33:10 +02:00
Anders Melchiorsen
0b350993b5 Improve precision of Hue color state () 2018-04-27 13:18:58 +02:00
Kane610
8a10fcd985 deCONZ use forward entry setup ()
* 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
2018-04-23 12:00:16 -04:00
Paulus Schoutsen
f47572d3c0 Allow platform unloading ()
* Allow platform unloading

* Add tests

* Add last test
2018-04-12 14:28:54 +02:00
Anders Melchiorsen
9c1bc18def Fix too green color conversion ()
* Prepare test

* Fix too green color conversion

* Fix remaining tests
2018-04-11 20:58:57 -04:00