Commit Graph

53 Commits (896dd1a36bffae2a4181a4bb24d3898f44de70f3)

Author SHA1 Message Date
epenet bb174780b9
Apply registry type hints on mqtt platform tests (#87758)
Apply registry fixture types on platform tests
2023-02-09 11:53:56 +01:00
Jan Bouwhuis df76e31cdf
Apply MQTT fixture types on platform tests (#87722)
* Apply MQTT fixture types on platform tests

* Add caplog type hint

* Add hass_ws_client type hint

* Add tmp_path type hint

* Add hass_client_no_auth type hint
2023-02-09 09:48:22 +01:00
Jan Bouwhuis 1a414f1433
Add hass and `None` return type on MQTT platform tests (#87713)
Add hass and `None` return type on MQTT tests
2023-02-08 18:08:03 +01:00
Jan Bouwhuis ee66ffc8de
Do not depend MQTT CI tests on debug logs (#84783)
* Do not depend MQTT CI tests on debug logs

* Leave Clean up expire as debug message
2022-12-29 18:29:28 +01:00
Jan Bouwhuis 7c2e7863d2
Remove legacy YAML support from MQTT (#82102) 2022-11-17 22:55:31 +01:00
Jan Bouwhuis 9a4c8f5f0e
Refactor common MQTT tests to use modern schema (#77583)
* Common tests availability

* Common tests attributes

* Common tests unique id

* Common tests discovery

* Common tests encoding

* Common tests device info

* Common tests entity_id updated

* Common tests entity debug info

* Common test entity category

* Common tests setup reload unload+corrections

* Cleanup sweep

* Comments from curent change

* Cleanup

* Remove unused legacy config
2022-09-09 11:15:48 +02:00
Jan Bouwhuis a4792998a2
Refactor MQTT tests to use modern platform schema part 1 (#77387)
* Tests alarm_control_panel

* Tests binary_sensor

* Tests button

* Tests camera

* Tests Climate + corrections default config

* Tests cover

* Tests device_tracker

* Tests fan

* Tests humidifier

* Fix test_supported_features test fan

* Tests init

* Tests legacy vacuum

* Derive DEFAULT_CONFIG_LEGACY from DEFAULT_CONFIG

* Commit suggestion comment changes
2022-09-06 11:02:15 +02:00
Jan Bouwhuis 5930f056a8
Mqtt support config_entry unload (#70149)
* squashed commits for rebase

* Flake

* Fix reloading issue manual legacy items

* Improve ACS sync for unsubscribe at disconnect

* Processed review comments

* Update homeassistant/components/mqtt/client.py

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

* No need to await entry setup

* Remove complication is_connected

* Update homeassistant/components/mqtt/__init__.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-07-12 11:07:18 +02:00
J. Nick Koston 51b4d15c8c
Speed up mqtt tests (#73423)
Co-authored-by: jbouwh <jan@jbsoft.nl>
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2022-06-13 10:17:10 -10:00
Jan Bouwhuis 657e7f9a4c
Simplify MQTT test for setup manual mqtt item from yaml (#72916)
simplify test setup manual mqtt item from yaml
2022-06-13 13:44:12 +02:00
Jan Bouwhuis 52561ce076
Update MQTT tests to use the config entry setup (#72373)
* New testframework and tests for fan platform

* Merge test_common_new to test_common

* Add alarm_control_panel

* Add binary_sensor

* Add button

* Add camera

* Add climate

* Add config_flow

* Add cover

* Add device_tracker_disovery

* Add device_trigger

* Add diagnostics

* Add discovery

* Add humidifier

* Add init

* Add lecacy_vacuum

* Add light_json

* Add light_template

* Add light

* Add lock

* Add number

* Add scene

* Add select

* Add sensor

* Add siren

* Add state_vacuum

* Add subscription

* Add switch

* Add tag

* Add trigger

* Add missed tests

* Add another missed test

* Add device_tracker

* Remove commented out code

* Correct tests according comments

* Improve mqtt_mock_entry and recover tests

* Split fixtures with and without yaml setup

* Update fixtures manual_mqtt

* Update fixtures mqtt_json

* Fix test tasmota

* Update fixture mqtt_room

* Revert fixture changes, improve test

* re-add test
2022-06-02 14:24:46 +02:00
Jan Bouwhuis ed1c2ea2b8
Move manual configuration of MQTT fan and light to the integration key (#71676)
* 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
J. Nick Koston 723dcbafca
Complete fan speed transition from #59781 (#67743) 2022-03-09 10:38:12 +01:00
Erik Montnemery fe38e6ba87
Drop MQTT import flow (#66160)
* Drop MQTT import flow

* Reload manually configured MQTT entities when config entry is setup

* Address review comments

* Actually remove the import flow
2022-02-10 21:09:57 +01:00
Erik Montnemery 8245ff7473
Log transmitted MQTT messages (#65550) 2022-02-04 17:35:32 +01:00
Jan Bouwhuis 711bd7169e
Add Mqtt Fan unknown state support (#65301)
* Add Mqtt Fan unknown state support

* Update homeassistant/components/mqtt/fan.py

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

* Adjust default state in tests

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-02-03 16:48:03 +01:00
Jan Bouwhuis dd0193052c
Add MQTT encoding parameter for all subscribed topics (#62263)
* 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 061ce0c187
Fix mqtt reloading and rework tests (#62950)
* Improve mqtt reloading/tests and fix issues

* Cleanup fixture for reloading test

* isort and black remove replaced test_reloadable
2022-01-03 15:14:50 +01:00
Jan Bouwhuis d0c4f0fec4
Add mqtt encoding support for publishing (#62739)
* 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
Erik Montnemery 640a7fee9d
Allow extra keys in MQTT discovery messages (#58390)
* Allow extra keys in MQTT discovery messages

* Remove extra keys
2021-10-25 13:47:06 +02:00
Jan Bouwhuis 5bb9aa8f3d
Remove MQTT Fan legacy speeds (#54768)
* Remove MQTT Fan legacy speeds

* deprecated attibutes are not disruptive
2021-08-24 11:21:35 +02:00
Erik Montnemery e0f7987544
Filter MQTT fan JSON attributes (#52283) 2021-06-29 11:18:50 +02:00
Jan Bouwhuis 9abf43f95f
Mqtt fan feature for resetting current speed `percentage` or `preset_mode` (#50565)
* Mqtt fan resetting speed percentage or preset_mode

* tests reset payload is working with val templates

* Remove duplicate line for CONF_PAYLOAD_HIGH_SPEED
2021-05-18 08:24:42 +02:00
Jan Bouwhuis 7ab505633d
Ignore empty output from MQTT fan's value template (#50122)
* Allow empty payload

* Add tests for ignoring empty payload

* logging on empty state and osccilation with tests

* Improve warning log when invalid value is received
2021-05-07 13:22:08 +02:00
Jan Bouwhuis 74d7293ab8
mqtt fan percentage to speed_range and received speed_state fix (#49060)
* percentage to speed_range and get speed state fix

* Update homeassistant/components/mqtt/fan.py

* Update homeassistant/components/mqtt/fan.py

* Update homeassistant/components/mqtt/fan.py

* Update homeassistant/components/mqtt/fan.py

Co-authored-by: J. Nick Koston <nick@koston.org>
2021-04-11 13:53:07 -10:00
Jan Bouwhuis 28ad5b5514
Implement percentage_step and preset_mode is not not speed fix for MQTT fan (#48951) 2021-04-09 16:14:48 -07:00
Jan Bouwhuis d8a4cf63f4
Command template support for MQTT fan (#48413)
* Command template support

* Fix typo in abbreviations

* Update homeassistant/components/mqtt/fan.py

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

* Fix initialize templates

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-03-29 20:41:51 +02:00
Jan Bouwhuis 5b17aaf9d5
Percentage and preset mode support for MQTT fan (#47944)
* git push --all origin

* Fix percentage to ordered list conversion

* Tests for mqtt fan and fixes

* Improve tests and error handling base config

* Additional tests

* Tests completed, small fixes

* Allow preset mode and percentages combined

* Remove raise in setup and update tests

* Alignment with fan entity mode

* Fix pylint for len-as-condition

* Remove python binary cache file from PR

* Additional tests on async_turn_on and fix

* Added comments for deprecation of speeds

* Schema checks before init

* Optimize pre schema checks

* Correct schema checks

* Update homeassistant/components/mqtt/abbreviations.py

Comment speeds for mqtt fan are deprecated not needed here

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

* Update homeassistant/components/mqtt/fan.py

Comment speeds for mqtt fan are deprecated not needed here

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

* Update homeassistant/components/mqtt/fan.py

Comment speeds for mqtt fan are deprecated not needed here

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

* Update homeassistant/components/mqtt/fan.py

Comment speeds for mqtt fan are deprecated not needed here

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

* Update homeassistant/components/mqtt/fan.py

Comment speeds for mqtt fan are deprecated not needed here

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

* Warnings for exceptions - testing speed_range

* Update homeassistant/components/mqtt/abbreviations.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/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/fan.py

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

* Update homeassistant/components/mqtt/fan.py

* Save with black

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-03-26 08:37:47 +01:00
J. Nick Koston 954ad854fb
Remove the ability for mqtt to set speeds that are not in the speed_list (#45445) 2021-01-23 06:24:06 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Erik Montnemery 4ed1f8023b
Suppress MQTT discovery updates without changes (#38568) 2020-08-06 10:43:47 +02:00
Erik Montnemery 280f49540e
Drop use of async_mock_mqtt_component (#37011) 2020-06-22 23:59:50 +02:00
definitio ad5101c5c0
Set state for MQTT entities to 'unavailable' when no connection to broker (#36479)
* Report 'unavailable' state when not connected

to MQTT broker

* Fix tests

* Rewrite to remove the polling

* Add tests

* Add some fixes
2020-06-07 09:21:16 +02:00
Paulus Schoutsen 276f3afb00
Do async_setup_platform in background (#36244)
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-31 22:18:30 -07:00
Erik Montnemery f1ecac92df
Fail tests if wrapped callbacks or coroutines throw (#35010) 2020-05-06 14:14:57 -07:00
Erik Montnemery 4e6fd19624
Improve MQTT test coverage and remove dead code (#33584)
* Improve MQTT tests and remove dead code

* Remove useless test.

* Add more test
2020-04-03 09:05:58 -07:00
Erik Montnemery fbd197146a
Add MQTT debug info for remaining MQTT integrations (#33506) 2020-04-01 11:48:32 -07:00
Erik Montnemery 9508c51403
Fix change of entity_id for discovered MQTT entities (#33444) 2020-03-30 14:26:59 -07:00
Erik Montnemery 86d48c608e
Deduplicate MQTT tests (#32874) 2020-03-17 02:09:19 -05:00
Erik Montnemery 8bc542776b
Cleanup entity and device registry on MQTT discovery removal (#32693)
* Cleanup entity and device registry on MQTT discovery removal.

* Review comments
2020-03-11 18:00:47 -07:00
Erik Montnemery f7ddbc7e1e
Remove duplicated config from MQTT tests (#32689) 2020-03-11 09:34:19 -07:00
Erik Montnemery 4bb9f1800d
Deduplicate MQTT mixin tests (#32563)
* Deduplicate MQTT mixin tests

* Remove test of not yet merged function
2020-03-09 09:40:00 -07:00
Jc2k 8257ea30c0 Set required_features field when registering fan services (#30516)
* Set required_features on fan services

* Fix mqtt fan test

* Update fan.py
2020-01-06 17:10:51 +01:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Erik Montnemery 5376e15286 Convert some test helpers to coroutines and adjust tests (#23352)
* Convert some test helpers to coroutines

* Fix tests
2019-04-25 10:14:16 +02:00
Erik Montnemery a89c7f8feb Improve MQTT tests (#23296)
* Improve MQTT tests

* Tweak
2019-04-22 08:48:50 -04:00
Erik Montnemery 28c411c742 Drop unnecessary block_till_done for MQTT fan tests (#23253) 2019-04-19 14:58:44 -07:00
Erik Montnemery 7a84cfb0be Fix optimistic mode + other bugs, tests (#22976) 2019-04-18 20:59:41 -07:00
emontnemery ce1fe06193 Write state directly in all MQTT platforms (#21971) 2019-03-12 14:46:48 -07: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