Commit graph

68 commits

Author SHA1 Message Date
Jan Bouwhuis
4335b0db25
Clean up or correct from removed deprecation for MQTT platform ()
Clean up or correct from removed deprecation
2022-11-25 16:11:22 +01:00
Jan Bouwhuis
fb909d694f
Improve type hints MQTT light schema json ()
* Improve type hints schema json

* Add hint for brightness

* Follow up comments

* Follow up missed comments

* Correct hint on flash arg

* hints on one line
2022-11-18 12:12:27 +01:00
Jan Bouwhuis
3d00923665
Improve MQTT type hints / refactor part 9 - light ()
* Improve type hints light base

* improve type hints light schema basic

* Improve type hints light schema json

* Use MQTT Template models with light template

* Addtional type hints for template light

* Improve template hints for schema template

* Use strict type hints for templates

* MyPy corrections

* Follow up comments

* Follow up comments

* Revert changes schema_json

* Revert changes schema template

* Hints setup_entity_json and setup_entity_template

* Remove type hint on setup_entity JSON
2022-11-17 10:22:25 +01:00
Jan Bouwhuis
d66d079330
Use _attr_ for MQTT light ()
* Schema basic

* Schema json

* Schema template

* add color_mode - follow up comments

* Fix regression

* Follow up comments 2

* Fix mypy errors

* Update homeassistant/components/mqtt/light/schema_template.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-11-08 10:16:05 +01:00
Jan Bouwhuis
8aa30cce26
Fix state saving when sharing topics for MQTT entities ()
* Do not write old state sharing availability topic

* Add a test

* Support for all availability topics

* delay async_write_ha_state till last callback

* Process write req after processing callback jobs

* Do not count subscription callbacks

* Simplify

* Stale docsting

* No topic needed for delays state write

* No need to clear when reloading

* Move test to test_mixins.py

* Only set up sensor platform for test
2022-10-11 10:49:54 +02:00
Jan Bouwhuis
d53d59eb6c
Improve warning messages on invalid received modes () 2022-09-09 11:12:09 +02:00
Erik Montnemery
b21f8c9ea8
Remove use of deprecated SUPPORT_* constants from MQTT light ()
* Remove use of deprecated SUPPORT_* constants from MQTT light

* Refactor
2022-09-08 11:21:46 +02:00
Jan Bouwhuis
90aba6c523
Add cv.deprecated to MQTT modern schema's too ()
Add cv.deprcated to modern schema too
2022-08-19 11:12:47 +02:00
Erik Montnemery
60c8d95a77
Remove white_value support from light () 2022-08-18 08:21:05 -04:00
Erik Montnemery
4cc1428eea
Add support for color_mode white to MQTT JSON light () 2022-08-17 13:07:50 +02:00
Erik Montnemery
73001e29ff
Remove deprecated white_value support from MQTT light ()
* Remove deprecated white_value support from MQTT light

* Remove deprecated white_value support from MQTT JSON light

* Remove deprecated white_value support from MQTT template light
2022-08-16 16:47:21 +02:00
J. Nick Koston
2742bf86e3
Switch mqtt to use json helper ()
* Switch mqtt to use json helper

* whitespace
2022-06-23 14:29:09 +02:00
Erik Montnemery
635d7085cf
Move MQTT config schemas and client to separate modules ()
* Move MQTT config schemas and client to separate modules

* Update integrations depending on MQTT
2022-05-31 09:32:44 +02:00
Jan Bouwhuis
ed1c2ea2b8
Move manual configuration of MQTT fan and light to the integration key ()
* Processing yaml config through entry setup

* Setup all platforms

* Update homeassistant/components/mqtt/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* adjust mock_mqtt - reference config from cache

* Fix test config entry override

* Add tests yaml setup

* additional tests

* Introduce PLATFORM_SCHEMA_MODERN

* recover temporary MQTT_BASE_PLATFORM_SCHEMA

* Allow extra key in light base schema, restore test

* Fix test for exception on platform key

* One deprecation message per platform

* Remove deprecation checks from modern schema

* Update homeassistant/components/mqtt/fan.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/mqtt/fan.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/mqtt/light/__init__.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/mqtt/light/__init__.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/mqtt/light/schema_json.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/mqtt/light/schema_template.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/mqtt/mixins.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* rename validate_modern_schema

* Do not fail platform if a single config is broken

* Update homeassistant/components/mqtt/__init__.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Fix tests on asserting log

* Update log. Make helper transparant, remove patch

* Perform parallel processing

* Update tests/components/mqtt/test_init.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/mqtt/mixins.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* black

* Fix tests and add #new_format anchor

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-05-19 15:04:53 +02:00
epenet
09d61edd9f
Use LightEntityFeature enum in mqtt () 2022-04-29 22:47:26 +03:00
Erik Montnemery
2f9beb4a4a
Deprecate white_value support in MQTT light () 2022-04-29 08:37:49 +02:00
epenet
38d86fc7b1
Use ColorMode enum in mqtt () 2022-04-24 09:06:56 -10:00
Jan Bouwhuis
678e56b8b7
Mqtt move to .const () 2022-02-10 09:18:35 +01:00
Erik Montnemery
8245ff7473
Log transmitted MQTT messages () 2022-02-04 17:35:32 +01:00
Jan Bouwhuis
cf52357229
Add MQTT light unknown state support ()
* Add MQTT light unknown sate support

* Update homeassistant/components/mqtt/light/schema_basic.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/mqtt/light/schema_json.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/mqtt/light/schema_template.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update tests for default unknown state

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-02-03 16:49:57 +01:00
Erik Montnemery
f3a89de71f
Fix race when handling updated MQTT discovery data () 2022-02-02 17:12:22 -08:00
Jan Bouwhuis
dd0193052c
Add MQTT encoding parameter for all subscribed topics ()
* Add encoding parameter for all subscribable topics

* test setup encoding incoming payload

* remove support for device_tracker and tag+tests
2022-01-03 16:08:07 +01:00
Jan Bouwhuis
d0c4f0fec4
Add mqtt encoding support for publishing ()
* encoding support for mqtt publishing - todo tests

* signature allows None values for qos and retain

* common test for mqtt publishing encoding

* better test with command templates

* more tests

* fix tests alarm control panel+tests light basic

* tests light json and template

* add tests vacuum and fix tests light_template
2022-01-03 09:03:47 +01:00
Damien Duboeuf
67c2747027
Add MQTT object_id option ()
* Add MQTT object_id option

* Add MQTT object_id option

* Add MQTT object_id option

* Add MQTT object_id option - Fix light and vacuum

* Add MQTT object_id option - Fix light and vacuum

* Add MQTT object_id option - Fix lock

* Add MQTT object_id option - Fix device

* Add MQTT object_id option - Fix device

* Update tests/components/mqtt/test_discovery.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Change deprecated method

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-11-08 14:02:18 +01:00
Erik Montnemery
0456a896e3
Avoid service call in MQTT async_publish function ()
* Avoid service call in MQTT async_publish function

* Tweak

* Fix integrations + tests
2021-10-28 08:13:32 +02:00
Erik Montnemery
640a7fee9d
Allow extra keys in MQTT discovery messages ()
* Allow extra keys in MQTT discovery messages

* Remove extra keys
2021-10-25 13:47:06 +02:00
Jan Bouwhuis
879144b48d
MQTT rework constants ()
* reference CONF_TOPIC to .const

* Organize common mqtt constants
2021-10-12 11:26:38 +02:00
Erik Montnemery
7a4f3fe7b8
Filter MQTT light JSON attributes () 2021-06-28 14:37:26 +02:00
Erik Montnemery
80ae346318
Pass the hass object to all MQTT component constructors () 2021-06-23 15:44:18 +02:00
J. Nick Koston
3fa8ffa731
Enable mccabe complexity checks in flake8 ()
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-04-25 12:38:40 +02:00
Erik Montnemery
ec56ae2cbc
Set deprecated supported_features for MQTT JSON light ()
* Set deprecated supported_features for MQTT json light

* Update homeassistant/components/light/__init__.py

Co-authored-by: Franck Nijhof <git@frenck.dev>

Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-04-15 17:24:21 +02:00
Erik Montnemery
5e8559e3cc
Validate supported_color_modes for MQTT JSON light () 2021-04-08 12:40:48 -07:00
Erik Montnemery
9f2fb37e17
Flag brightness support for MQTT RGB lights () 2021-04-06 12:39:29 +02:00
Erik Montnemery
c7584a1f92
Add color_mode support to MQTT JSON light () 2021-03-31 11:28:45 +02:00
Franck Nijhof
6932cf9534
Use contextlib.suppress where possible () 2021-03-23 14:36:43 +01:00
Drzony
99d1e3e71d
MQTT Light: Use flash attribute in async_turn_off () 2021-03-15 11:24:07 +01:00
Kristian Heljas
9e487eb260
Hoist mqtt name property and add icon support to MqttEntity ()
* hoist common MqttEntity properties

* remove default name for MqttEntity

Default naming is sensible enough

* disable overriding common MqttEntity schema

* merge common MqttEntity schemas into MQTT_ENTITY_COMMON_SCHEMA
2021-03-11 13:42:13 +01:00
tkdrob
b85ecc0bd2
Use core constants for mqtt () 2021-02-11 13:38:33 +01:00
Erik Montnemery
411c0a9685
Improve MQTT JSON light to allow non-ambiguous states () 2021-02-02 09:36:00 +01:00
Erik Montnemery
248802efd5
Add MQTT base entity () 2021-01-09 17:46:53 +01:00
Erik Montnemery
b85efd343f
Move MQTT entity helpers to separate file ()
* Move MQTT entity helpers to separate file

* Fix imports

* Update MQTT number

* Review comments

* Fix formatting
2021-01-09 00:47:17 +01:00
Erik Montnemery
97edbaa85f
Small cleanup of MQTT ()
* Use relative imports of mqtt component in mqtt platforms

* Correct parameters to _async_setup_entity

* Lint
2020-12-10 21:30:07 +01:00
Erik Montnemery
e203896638
Align MQTT light's default color temperature () 2020-10-21 15:46:29 +02:00
Erik Montnemery
4c6960ed36
Fix discovery update of MQTT light () 2020-09-02 10:52:33 +02:00
Michaël Arnauts
d7d7ee6524
Use global CONF_UNIQUE_ID for mqtt ()
* Use global CONF_UNIQUE_ID for mqtt

* Update __init__.py

* Update __init__.py

* Update __init__.py

Co-authored-by: Chris Talkington <chris@talkingtontech.com>
2020-08-09 16:00:14 -05:00
Pieter Goetschalckx
02a36a9b68
Add min_mireds and max_mireds to MQTT Light ()
* Add min_mireds and max_mireds to MQTT Light

* Add abbreviations for min_mireds and max_mireds

* Add tests for min_mireds and max_mireds
2020-05-10 09:34:48 +02:00
Erik Montnemery
f9b420a5a5
Make sure MQTT light brightness is not rounded to 0 () 2020-05-04 15:54:49 -07:00
Michael Bisbjerg
e7fc886992
Simplify MQTT light brightness logic () 2020-05-03 18:48:24 +02:00
Erik Montnemery
e4333a7a44
Rename Light to LightEntity () 2020-04-26 18:49:41 +02:00
Erik Montnemery
fbd197146a
Add MQTT debug info for remaining MQTT integrations () 2020-04-01 11:48:32 -07:00