Commit Graph

295 Commits (9a8b945118ea49b2816ffd34f9d9b13756524e7f)

Author SHA1 Message Date
emontnemery fc81826763 Introduce Entity.async_write_ha_state() to not miss state transition (#21590)
* Copy state in schedule_update_ha_state

* Lint

* Fix broken test

* Review comment, improve docstring

* Preserve order of state updates

* Rewrite

* Break up async_update_ha_state

* Update binary_sensor.py

* Review comments

* Update docstring

* hass -> ha

* Update entity.py

* Update entity.py
2019-03-09 09:52:22 -08:00
engrbm87 76d11e4b74 fix empty TOPIC_BASE issue (#21740)
* fix empty TOPIC_BASE issue

if the value of the TOPIC_BASE is empty then we need to remove "~" from the topic value if it exists. 
by doing `if base:` on line 239 the condition will be false if the value is empty so the '~' will not be stripped from the topic value.
I simply removed the `if base:` line and added `if TOPIC_BASE in payload:`

* Update homeassistant/components/mqtt/discovery.py

Co-Authored-By: engrbm87 <engrbm87@gmail.com>
2019-03-08 16:48:54 -08:00
emontnemery c340083ba5
Add missing retain option to mqtt.climate configuration schema (#21536) 2019-02-28 18:26:54 +01:00
Marco M c3d4738649 Mqtt alarm added value_template and code_arm_required (#19558)
* Added value_template config for parsing json value from state topic

Added arm_code_required to avoid code enter when arming

* Renamed config parameter to code_arm_required

* Fix for discovery update compatibility

* Fixed lint error

* Added test
2019-02-28 17:44:23 +01:00
Paulus Schoutsen 78217fa9b0 Update translations 2019-02-27 16:34:13 -08:00
Paulus Schoutsen 3fcbc36abe Update translations 2019-02-21 16:40:25 -08:00
Joakim Plate c5de32e7b1 Climate const.py move (#20945)
* Move constants to const.py

* Import from const instead of climate
2019-02-14 20:34:43 +01:00
Paulus Schoutsen 02f207ea8e Update translations 2019-02-13 15:44:18 -08:00
Ryan Wagoner 62b2b23d0b Add night arm mode to MQTT alarm control panel (#20961)
* Add night arm mode to MQTT alarm control panel

* Add unit test for MQTT alarm night mode
2019-02-13 22:52:32 +01:00
emontnemery 22af9707ad Add support for device_class to MQTT cover (#21044) 2019-02-13 19:58:46 +00:00
emontnemery 5f7f7777a0 Fix encoding for MQTT camera (#20932) 2019-02-10 12:35:54 +01:00
emontnemery b1faad0a50 Use PLATFORM_SCHEMA_BASE as base schema for additional components. (#20578)
* Disable extra=vol.ALLOW_EXTRA for additional platforms.

* Remove PLATFORM_SCHEMA_2

* Add entity_namespace to base platform schema
2019-02-04 21:52:19 -08:00
emontnemery 79d3f533a9 Add missing abbreviations (#20741) 2019-02-04 10:54:40 -08:00
Paulus Schoutsen c2eec16721 Update translations 2019-02-02 14:12:23 -08:00
Paulus Schoutsen ec57db78b5
Consolidate config flow components (#20635)
* Consolidate config flow components

* Fix tests

* Fix tests

* Put unifi back

* Fix reqs

* Update coveragerc
2019-02-01 15:45:44 -08:00
emontnemery 89fc3b2a1b Disable extra=vol.ALLOW_EXTRA for MQTT platforms. (#20562) 2019-01-29 09:29:02 -08:00
emontnemery 3ee3acd550 Update device registry of MQTT light (#20441)
* Update device registry of MQTT light

* Move config_entry to constructor
2019-01-28 19:45:34 -08:00
emontnemery bb1583c453 Add discovery update support to MQTT camera (#20529) 2019-01-28 16:21:38 -08:00
emontnemery bb4ca1f525 Cleanup if discovered mqtt vacuum can't be added (#20549) 2019-01-28 15:56:47 -08:00
emontnemery 648adcc708 Small cleanup of MQTT platforms (#20503)
* Move CONF_UNIQUE_ID to init

* Sort imports

* Update ordering
2019-01-27 18:54:52 +01:00
emontnemery 8804f55fcc Update device registry of MQTT Vacuum (#20500) 2019-01-27 17:43:16 +01:00
emontnemery 1f93984fd5 Update device registry of MQTT Lock (#20501) 2019-01-27 17:42:45 +01:00
emontnemery 60dc337f3f Update device registry of MQTT cover (#20443)
* Update device registry of MQTT cover

* Move config_entry to constructor
2019-01-26 10:52:41 -08:00
emontnemery 85c72fbca6 Update device registry of MQTT alarm (#20439) 2019-01-26 10:48:35 -08:00
emontnemery 85ccd71d39 Update device registry of MQTT sensor (#20440) 2019-01-26 10:48:18 -08:00
Paulus Schoutsen 09cbcb74bc
Merge pull request #20442 from emontnemery/mqtt_binary_sensor_update_device_info
Update device registry of MQTT binary_sensor
2019-01-26 10:47:57 -08:00
Paulus Schoutsen 0e453fe492
Update device registry of MQTT climate (#20444) 2019-01-26 10:47:29 -08:00
emontnemery 1d16bb2cd4 Update device registry of MQTT fan (#20445) 2019-01-26 10:46:41 -08:00
emontnemery 6d2e7db123 Update device registry of MQTT climate 2019-01-26 09:04:02 +08:00
emontnemery d8e43978b7 Update device registry of MQTT binary_sensor 2019-01-26 08:58:08 +08:00
emontnemery d84cd01cbf Cleanup if discovered mqtt light can't be added (#19740)
* Cleanup if discovered mqtt light can't be added

* No bare except

* Clear ALREADY_DISCOVERED list with helper

* Use constant instead of string literal
2019-01-24 22:40:52 -08:00
emontnemery a1da6a677a Update device registry of MQTT Switch (#19540)
* MQTT Switch: Update device registry

* Move config_entry to constructor

* Remove duplicated code

* Fix merge error
2019-01-24 22:39:16 -08:00
Daniel Høyer Iversen 1bd31e3459 Change STATE_UNKOWN to None (#20337)
* Change STATE_UNKOWN to None

* Change STATE_UNKOWN to None

* tests

* tests

* tests

* tests

* tests

* style

* fix comments

* fix comments

* update fan test
2019-01-24 08:20:20 +01:00
emontnemery 3fcbcd5a38 Add JSON attribute topic to MQTT alarm (#20238) 2019-01-20 16:42:56 -08:00
emontnemery dbba3eb0d4 Add JSON attribute topic to MQTT climate (#20239) 2019-01-20 16:42:35 -08:00
emontnemery 89e9d827a2 Add JSON attribute topic to MQTT fan (#20240) 2019-01-20 16:42:17 -08:00
emontnemery ab4e4787e3 Add JSON attribute topic to MQTT lock (#20241) 2019-01-20 16:41:50 -08:00
Erik 5b8f64093b Add JSON attribute topic to MQTT vacuum 2019-01-19 11:58:21 +01:00
emontnemery f094a7369d Add JSON attribute topic to MQTT switch (#20192) 2019-01-17 10:55:22 -08:00
emontnemery 234f348ba1 Add JSON attribute topic to MQTT light (#20191) 2019-01-17 10:54:22 -08:00
emontnemery d1c6eb4f3e Add JSON attribute topic to MQTT cover (#20190)
* Add JSON attribute topic to MQTT cover

* Lint
2019-01-17 10:53:52 -08:00
emontnemery 368682647d Log exceptions thrown by MQTT message callbacks (#19977)
* Log exceptions thrown by MQTT message callbacks

* Fix tests

* Correct method for skipping wrapper in traceback

* Lint

* Simplify traceback print

* Add test

* Move wrapper to common helper function

* Typing

* Lint
2019-01-16 13:50:21 -08:00
emontnemery 0ec1401be7 Minor refactoring of MQTT availability (#20136)
* Small refactor of MQTT availability

* Use dict[key] for required config keys and keys with default values.
2019-01-15 14:26:37 -08:00
emontnemery 5b53bd6aa0
Move MQTT platforms under the component (#20050)
* Move MQTT platforms under the component
2019-01-15 17:31:06 +01:00
Paulus Schoutsen 96b8c517f0 Update translations 2019-01-13 09:38:22 -08:00
Fredrik Erlandsson b9a488912a Add support for 'via_hub' for device_info (#19454)
* Add support for 'via_hub'

* Update config schema

* add domain to via_hub

* add tests for via_hub
2019-01-11 13:11:13 -08:00
Paulus Schoutsen 9aed40a88d Update translations 2019-01-09 15:29:31 -08:00
emontnemery dd75c49796
Cleanup if discovered mqtt switch can't be added (#19721)
* Cleanup if discovered mqtt switch can't be added
2019-01-07 16:57:51 +01:00
Tommy Jonsson ccbc231d3a [2/3] vacuum mqtt-discovery (#19478)
* add discoverability to mqtt-vacuum
2019-01-06 17:05:04 +01:00
Daniel Chesterton 61d5b3028d Add support for color_temp_command_template in MQTT light component (#19675)
* Add support for color_temp_command_template in MQTT light component
2019-01-01 15:42:41 +01:00
emontnemery a8797a08c6 Improve handling of MQTT light discovery (#19436) 2018-12-24 14:28:26 +01:00
emontnemery edb7ec78f9 Fix support for base topic for empty values in MQTT discovery msg (#19501)
* Fix topic expansion for short strings

* Lint
2018-12-24 14:21:58 +01:00
emontnemery 1568de62df Correct calls to subscription.async_unsubscribe_topics (#19414)
* Correct calls to subscription.async_unsubscribe_topics

* Review comments

* Add testcases
2018-12-19 14:05:24 +01:00
Paulus Schoutsen fe2d24c240 Update translations 2018-12-10 09:54:12 +01:00
emontnemery 5ff7563070
Merge pull request #18923 from emontnemery/mqtt_binary_sensor_json_attributes_topic
Add JSON attribute topic to MQTT binary sensor
2018-12-07 07:48:55 +01:00
Paulus Schoutsen 83311df933 Add translations 2018-12-06 00:30:33 +01:00
Erik df346feb65 Review comments 2018-12-05 19:48:44 +01:00
Erik f54710c454 Fix bug when reconfiguring MQTT availability 2018-12-04 21:25:18 +01:00
Erik 21197fb968 Review comments 2018-12-04 19:56:34 +01:00
Otto Winter c8d92ce907
Fix MQTT re-subscription logic (#18953)
* Fix MQTT re-subscription logic

* Cleanup

* Lint

* Fix
2018-12-03 19:16:58 +01:00
Erik b9ad19acbf Add JSON attribute topic to MQTT binary sensor
Add MqttAttributes mixin
2018-12-02 17:00:31 +01:00
emontnemery a9990c130d Revert change to MQTT discovery_hash introduced in #18169 (#18763) 2018-11-30 13:57:17 +01:00
Adam Mills 5c3a4e3d10 Restore states through a JSON store instead of recorder (#17270)
* 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 (#18227)
* 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 3c92aa9ecb Update translations 2018-11-26 14:30:21 +01:00
Erik b198bb441a Support updated MQTT QoS when reconfiguring MQTT availability 2018-11-23 15:32:24 +01:00
emontnemery de9bac9ee3 Reconfigure MQTT binary_sensor component if discovery info is changed (#18169)
* Recreate component if discovery info is changed

* Update component instead of remove+add

* Set name and unique_id in __init__

* Update unit test

* Cleanup

* More cleanup

* Refactor according to review comments

* Change discovery_hash

* Review comments, add tests

* Fix handling of value_template
2018-11-19 16:49:04 +01:00
emontnemery 7e702d3caa Fix small issue related to topic prefix (#18512)
Fix expansion of topic prefix when discovery message contains non string-type items.
2018-11-19 09:59:07 +01:00
Paulus Schoutsen 75bb78d440 Update translations 2018-11-15 14:30:37 +01:00
emontnemery 589764900a Move more MQTT platforms to config entries (#18180)
* Move Lock MQTT platform to config entries

* Move MQTT JSON Light platform to config entries

* Review comments

* Review comments

* Revert mqtt_json changes
2018-11-06 16:09:46 +01:00
Pascal Vizeli eb0d989c88
Bugfix discovery (delete/mqtt) call for Hass.io (#18159)
* Bugfix discovery delete call for Hass.io

* Fix host

* fix tests
2018-11-04 12:19:04 +01:00
Paulus Schoutsen 20fb7b59ef Update translations 2018-10-30 11:35:40 +01:00
Paulus Schoutsen c00da509a1 Update translations 2018-10-26 10:18:10 +02:00
Ville Skyttä 43048962f2
Upgrade flake8 to 3.6.0 (#17770)
* Upgrade flake8 to 3.6.0

* flake8/pylint comment tweaks

* flake8 F841 fixes

* flake8 W605 fix

* Ignore pyflakes bug #373 false positives

https://github.com/PyCQA/pyflakes/issues/373

* pycodestyle bug #811 workaround

https://github.com/PyCQA/pycodestyle/issues/811
2018-10-25 23:15:20 +03:00
Paulus Schoutsen 398ea40189 Update translations 2018-10-23 14:04:25 +02:00
Paulus Schoutsen 355005114b Update translations 2018-10-21 20:34:28 +02:00
Paulus Schoutsen a5b9f5040f Update translations 2018-10-17 14:12:41 +02:00
Paulus Schoutsen 6971e84ddf Update translations 2018-10-12 14:58:09 +02:00
emontnemery b2789d9883 Support abbreviations in discovery topic (#16635)
* Support abbreviations in discovery topic

* Add abbreviations for all words. Add testcase.

Add missing docstring.

* Add missing abbreviations

* Support topic prefix

* Update test case

* Restrict topic prefix

* Fix merge

* Simplify abbreviations expanding, assume TOPIC_PREFIX is one character long

* Support abbreviated keys instead of words

* Remove redundant abbreviations

* Remove extra spaces in abbreviation list

* Make topic prefix less restrictive

* Make topix prefix a bit more restrictive again
2018-10-12 08:51:16 +02:00
Paulus Schoutsen d16e6c8524 Update translations 2018-10-10 14:25:21 +02:00
Otto Winter 9290f245bf Convert MQTT fan to config entry (#17247) 2018-10-08 14:59:04 +02:00
Otto Winter af2402ea59 Implement base for MQTT device registry integration (#16943)
* Implement base for MQTT device registry integration

* Lint

* Lint

* Address comments

* Lint

* Lint

* Address comments

* Only add keys if specified

See https://github.com/home-assistant/home-assistant/pull/17136#discussion_r223267185
2018-10-08 12:53:30 +02:00
Otto Winter 3f498bd042 Fix potential MQTT discovery race condition (#17208)
* Fix potential MQTT discovery race condition

* Rename data key
2018-10-08 10:59:43 +02:00
Paulus Schoutsen 2de1193fd9 Update translations 2018-10-07 23:26:46 +02:00
Paulus Schoutsen 0c770520ed Update translations 2018-10-05 17:50:00 +02:00
Paulus Schoutsen 38e2926a48 Update translations 2018-10-02 14:33:47 +02:00
cdce8p 7f0a50ce31 async_create_task (#17059)
* async_create_task

* Update google.py
2018-10-02 11:03:09 +02:00
Paulus Schoutsen c69a790ede
Add Hass.io discovery to MQTT (#16962)
* Add Hass.io discovery to MQTT

* Update en.json

* Update __init__.py

* Update config_flow.py

* Update strings.json

* Update test_config_flow.py

* Lint

* Ensure we don't send bad data in config entry
2018-10-01 14:11:21 +02:00
Otto Winter 760f822dce Fix MQTT discovery (#17004) 2018-10-01 09:01:40 +02:00
Paulus Schoutsen 0a2b266742 Fix MQTT certificates (#16999) 2018-09-30 21:36:27 +02:00
Otto Winter af89e7c50f Move more MQTT platforms to config entries (#16918)
* Move more MQTT platforms to config entries

* Address comments
2018-09-28 16:57:17 +02:00
Paulus Schoutsen bac71d3d22 Update translations 2018-09-27 23:04:28 +02:00
Otto Winter 2d104f95d7 Fix MQTT Config Entry Discovery (#16919) 2018-09-27 22:56:04 +02:00
Otto Winter d1ad2cc225 Make MQTT platforms config entries (#16904)
* Make MQTT platforms config entries

* Fix tests

* Address Comment

* Rework tests

* Undo style auto-reformat style changes
2018-09-27 16:07:56 +02:00
Paulus Schoutsen 732009c668 Update translations 2018-09-26 15:39:20 +02:00
Paulus Schoutsen c899875abb
Fix MQTT discovery (#16864)
* Fix MQTT discovery

* Update __init__.py
2018-09-26 09:38:50 +02:00
Paulus Schoutsen e4898bb05c
Allow MQTT discovery (#16842) 2018-09-25 12:22:14 +02:00
Paulus Schoutsen d4b239d1d4 Update translations 2018-09-24 12:01:01 +02:00
emontnemery 5ee4718e24 Remove discovered MQTT Switch device when discovery topic is cleared (#16605)
* Remove discovered device when discovery topic is cleared

* Move entity removal away from mqtt discovery

* Move discovery update to mixin class

* Add testcase

* Review comments
2018-09-24 10:11:49 +02:00
Fabian Affolter cba3a5b055 Upgrade paho-mqtt to 1.4.0 (#16688) 2018-09-18 14:59:39 +02:00