Commit Graph

46 Commits (dc01b1726050fd379f544244d92e1b1c471ac37b)

Author SHA1 Message Date
Anders Melchiorsen e427f9ee38 RFC: Only use supported light properties (#15484)
* Only use supported light properties

* Fix tests
2018-07-18 12:18:22 +02:00
Ville Skyttä bf17ed0917 More pylint 2 fixes (#15516)
* Pylint 2 useless-import-alias fixes

* Pylint 2 chained-comparison fixes

* Pylint 2 consider-using-get fixes

* Pylint 2 len-as-condition fixes
2018-07-18 11:54:27 +02:00
Bob Clough bfc55137ea Fix MQTT Light with RGB and Brightness (#15053)
* 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
2018-06-21 14:59:02 -04:00
Diogo Gomes d47006c98f Optimistic MQTT light (#14401)
* 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
Adam Mills 89c7c80e42 Use hue/sat as internal light color interface (#11288)
* 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
2018-03-18 15:00:29 -07:00
Dan Nixon f0bf7b0def More support for availability reporting on MQTT components (#11336)
* Abstract MQTT availability from individual components

- Moved availability topic and payloads to MQTT base schema.
- Updated components that already report availability:
  - Switch
  - Binary sensor
  - Cover

* Add availability reporting to additional MQTT components

- Light
- JSON light
- Template light
- Lock
- Fan
- HVAC
- Sensor
- Vacuum
- Alarm control panel

* Annotate MQTT platform coroutines
2018-01-01 18:32:29 -08:00
Dan Nixon f07a4684e0 Fix RGB template ordering in MQTT Light (#11362)
* 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
2017-12-29 15:28:20 +01:00
Ted Drain 253c8aee1f Mqtt light options to fix #9330 and #7810 (#9829)
* 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
2017-10-31 23:18:49 +01:00
Pascal Vizeli 90f9a6bc0a Cleanup and simplitfy the async state update (#9390)
* Cleanup and simplitfy the async state update

* Update test_entity.py
2017-09-12 10:01:03 +02:00
Konstantin Belyalov 9ade8002ac Add new config variable to MQTT light (#9304)
* Add new config variable to MQTT light

* Address reviewer's issues: refactor template render part.

* Update mqtt.py
2017-09-06 01:01:03 +02:00
Fabian Affolter a4f1f6e724 Update docstrings (#7374)
* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstring

* Update docstrings

* Update docstrings

* Fix lint issues

* Update docstrings

* Revert changes in dict
2017-05-02 09:18:47 -07:00
Robbie Trencheny ddc260b628 Add required changes to support MQTT discovery that I previously missed. See #6481. 2017-03-08 23:57:54 -08:00
Robbie Trencheny 2b97449d98 Expand MQTT lights (#6481)
* Add effect support to MQTT Light

* Use effect state topic for supported_features

* Dont use rainbow as default color

* Add color_temp support to MQTT JSON Light

* Add effect to MQTT JSON light

* Support lights in MQTT discovery

* Allow discovered devices to set their platform

* Add white value support to MQTT Light

* Add white value support to MQTT JSON Light

* Remove blank line

* Add color_temp support to MQTT Template light

* Add white value support to MQTT Template Light

* Remove unused SUPPORT_MQTT_TEMPLATE and stale unused flash and transition code from MQTT Template

* Add XY Color to MQTT Light Platform

* Fix syntax

* Fix more syntax errors

* Revert "Remove unused SUPPORT_MQTT_TEMPLATE and stale unused flash and transition code from MQTT Template"

This reverts commit c03798cb63.

* MQTT Template supports flash and transition but doesnt allow templating of the values

* Add XY color support to MQTT JSON

* Proper variable names

* Only allow whitelisted MQTT platforms to be loaded via MQTT Discovery

* Minor tweaks.
2017-03-07 23:01:36 -08:00
Pascal Vizeli 41f558b181 Bootstrap / Component setup async (#6264)
* Bootstrap / Entiy setup async

* Cleanup add_job stuff / return task/future object

* Address paulus comments / part 1

* fix install pip

* Cleanup bootstrap / move config stuff to config.py

* Make demo async

* Further bootstrap improvement

* Address Martin's comments

* Fix initial tests

* Fix final tests

* Fix bug with prepare loader

* Remove no longer needed things

* Log error when invalid config

* More cleanup

* Cleanups platform events & fix lint

* Use a non blocking add_entities callback for platform

* Fix Autoamtion is setup befor entity is ready

* Better automation fix

* Address paulus comments

* Typo

* fix lint

* rename functions

* fix tests

* fix test

* change exceptions

* fix spell
2017-02-28 20:33:19 -08:00
Pascal Vizeli b0d3bbed79 Convert mqtt platforms to async (#6145)
* Convert mqtt platforms to async

* fix lint

* add more platforms

* convert mqtt_eventstream

* fix lint / add mqtt_room

* fix lint

* fix test part 1

* fix test part 2

* fix out of memory bug

* address comments
2017-02-22 09:43:22 +01:00
Hermann Kraus 51810620fb Check for command topics when determinig the capabilities of an MQTT light. (#5770)
Previous code used the state topic which is obviously wrong:
- The state topic is already used to select optimistic mode.
- A light with only the state topic but no command topic would still announce the capability.
2017-02-07 01:13:00 -08:00
Pascal Vizeli bde7176b3c Migrate light component to async (#4635) 2016-11-30 13:33:38 -08:00
Fabian Affolter be272ac64a Disable too-many-* (#4107)
* Disable too-many-* and too-few-public-methods

* Remove globally disabled pylint warnings
2016-10-30 22:18:53 +01:00
Robbie Trencheny b586e80977 Squashed commit of the following:
commit 220331260e9748ac8e17b3ce776330c1dfb7725b
Merge: 73d93e5 c891820
Author: Robbie Trencheny <me@robbiet.us>
Date:   Sun Oct 2 17:57:24 2016 -0700

    Merge branch 'color_temp_for_mqtt_light' of https://github.com/alterscape/home-assistant into alterscape-color_temp_for_mqtt_light

commit c89182008a
Author: Ryan Spicer <ryanspicer@gmail.com>
Date:   Sun Sep 18 23:06:34 2016 -0700

    fix missing docstring.

commit e61dda4dd3
Author: Ryan Spicer <ryanspicer@gmail.com>
Date:   Sun Sep 18 22:43:04 2016 -0700

    fix pep8 errors and typos in tests.

commit 559d1752d2
Author: Ryan Spicer <ryanspicer@gmail.com>
Date:   Sun Sep 18 21:41:07 2016 -0700

    add tests for mqtt color temp support

commit 702defb932
Author: Ryan Spicer <ryanspicer@gmail.com>
Date:   Sun Sep 18 20:55:07 2016 -0700

    Add color temp support to mqtt lights.
2016-10-02 18:04:00 -07:00
Paulus Schoutsen 00e298206e Optimize template 2 (#3521)
* Enforce compiling templates

* Refactor templates

* Add template validator to Logbook service

* Some more fixes

* Lint

* Allow easy skipping of rfxtrx tests

* Fix template bug in AND & OR conditions

* add entities extractor

Conflicts:
	tests/helpers/test_template.py

* fix unittest

* Convert template to be async

* Fix Farcy

* Lint fix

* Limit template updates to related entities

* Make template automation async
2016-09-27 21:29:55 -07:00
Fabian Affolter ad2dea939b Fix lint issues (#3492) 2016-09-23 12:20:22 +02:00
Fabian Affolter aed1348411 Use constants and update ordering (#3274) 2016-09-11 09:25:19 +02:00
Assaf Inbal 72ad1d8d7c Added support for exposing light features (#2828) 2016-08-15 23:07:07 -07:00
Jan Harkes a7016e4b32 Move CONF_STATE_TOPIC, CONF_COMMAND_TOPIC and CONF_RETAIN to mqtt component. 2016-04-06 22:51:39 -04:00
Jan Harkes 3383854506 Move CONF_OPTIMISTIC to homeassistant.const. 2016-04-06 22:51:39 -04:00
Jan Harkes 29a8403741 Config validation for MQTT light platform. 2016-04-06 22:51:38 -04:00
Paulus Schoutsen 025713ee41 Type checks for MQTT config 2016-03-10 21:42:17 -08:00
Fabian Affolter 7e8e91ef3c Fix PEP257 issues 2016-03-07 22:08:21 +01:00
Paulus Schoutsen b47f1c3a96 MQTT Light: fix brightness issues 2016-03-07 08:54:08 -08:00
St. John Johnson e525b6e0a5 Add brightness scale support for MQTT Lights.
Converts 0..255 values that HA expects into a device 0..SCALE value
Example:
  HA considers "hall light" at 25 brightness or 10% of 255
  Device considers "hall light" at 100 brightness or 10% of 1000

This allows our existing MQTT devices to not change their data format to be used in HA
2016-02-26 10:38:07 -08:00
Fabian Affolter 582394bc3b Modify import of template and PEP257 2016-02-23 21:19:22 +01:00
Paulus Schoutsen 8f70630790 MQTT Light to expose assumed_state if optimistic 2016-02-20 17:17:22 -08:00
Paulus Schoutsen e80309c03c Fix imports (using isort) 2016-02-18 21:27:50 -08:00
Paulus Schoutsen 177590fd65 Simplify MQTT light code 2015-12-19 19:45:28 -08:00
Paulus Schoutsen 90c705354a Add template support to MQTT lights 2015-12-19 19:15:05 -08:00
Paulus Schoutsen 90eab17ea6 Fix MQTT light bugs 2015-11-29 23:23:27 -08:00
Paulus Schoutsen 957b09707d Fixes for MQTT light with RGB colors 2015-11-28 12:46:35 -08:00
Nolan Gilley 776324807e last PR was dumb. this fix is better. 2015-11-13 14:58:49 -05:00
Nolan Gilley d68a4b52f1 Remove rgb color if it's not an rgb bulb. 2015-11-13 14:32:47 -05:00
Fabian Affolter d993f4014e Add link to docs 2015-11-13 08:29:54 +01:00
hexxter 31826ab263 redesigned mqtt light an first steps with the unittest system 2015-10-31 19:26:03 +01:00
root b66e4f1e15 two different demo lights on without RGB and one with RGB support.
and code cleanup more pylint aligned
2015-10-26 15:05:01 +01:00
root a8c2cc4c33 rework for flake8 errors done 2015-10-25 23:38:24 +01:00
root 538f8545f7 fix a bug after the pylint rework 2015-10-25 23:04:43 +01:00
root 7cfce94dfb pylint rework for light/mqtt 2015-10-25 22:58:07 +01:00
root 469d0619ba mqtt light component 2015-10-25 21:48:01 +01:00