Commit Graph

61 Commits

Author SHA1 Message Date
Jan Bouwhuis 18132916fa
Mask current password in MQTT option flow (#116098)
* Mask current password in MQTT option flow

* Update docstr

* Typo
2024-04-24 13:29:42 +02:00
Jan Bouwhuis 31d11b2362
Add re-auth flow for MQTT broker username and password (#116011)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-04-23 22:26:01 +02:00
Joost Lekkerkerker b9281327c4
Use FlowResultType enum in config flow tests A-M (#114681) 2024-04-03 09:21:17 +02:00
Joost Lekkerkerker 5d500cb74b
Use is in enum comparison in config flow tests K-O (#114672) 2024-04-02 11:21:42 -10:00
Joost Lekkerkerker 6bb4e7d62c
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Marc Mueller 1722e23df8
Add empty line after module docstring [tests l-p] (#112710) 2024-03-08 14:55:15 +01:00
J. Nick Koston 04dccc7ec6
Migrate mqtt to use async_update_entry to alter config entries (#110407) 2024-02-12 21:38:13 +01:00
Robert Resch 6fdad44941
Improve invalid error messages in the config flows (#108075) 2024-01-30 12:24:19 +01:00
Jan Bouwhuis c3841f8734
Rework on mqtt certificate tests (#99503)
* Shared fixture on TEMP_DIR_NAME mock in MQTT tests

* Improve mqtt certificate file tests

* Update tests/components/mqtt/test_util.py

Co-authored-by: J. Nick Koston <nick@koston.org>

* Update tests/components/mqtt/conftest.py

Co-authored-by: J. Nick Koston <nick@koston.org>

* Avoid blocking code

* typo in sub function

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2023-09-02 19:26:11 +02:00
Marc Mueller 37885400c9
Fix mqtt test DeprecationWarnings (#97734) 2023-08-04 09:21:36 +02:00
Jan Bouwhuis aab7dffdb9
Only expose MQTT advanced settings in advanced mode (#91996) 2023-04-25 22:23:17 +02:00
Erik Montnemery 63f3767a29
Include UUID in hassio discovery data (#91970) 2023-04-25 09:48:47 +02:00
Jan Bouwhuis bb15923968
Rename MQTT entry mock and cleanup (#91223)
Rename to mqtt_mock_entry and cleanup
2023-04-12 09:43:03 +02:00
Jan Bouwhuis 4a0d3e881a
Rework MQTT config merging and adding defaults (#90529)
* Cleanup config merging and adding defaults

* Optimize and update tests

* Do not mix entry and yaml config

* Make sure hass.data is initilized

* remove check on get_mqtt_data

* Tweaks to MQTT client

* Remove None assigment mqtt client and fix mock
2023-04-04 18:12:18 +02:00
Jan Bouwhuis 14ffda9758
Remove dependency on async_setup from mqtt integration (#87987)
* Remove async_setup from mqtt integration

* Final update common tests

* Related tests init

* Related tests diagnostics

* Related tests config_flow

* Cleanup and correct test

* Keep websockets_api commands in async_setup
2023-03-28 09:37:07 +02:00
Franck Nijhof ed79265843
Enable Ruff PT006 (#88165)
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
Franck Nijhof 9030ca05b1
Enable Ruff SIM118 (#87772) 2023-02-15 12:39:12 +01:00
Jan Bouwhuis a244f9b202
Add type hints tests MQTT config_flow (#87783) 2023-02-09 16:47:28 +01:00
Jan Bouwhuis dc5f35a85e
Add missed type hints on MQTT platform tests (#87781) 2023-02-09 15:22:30 +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
Franck Nijhof 57cf11f067
Enable Ruff PT015 (#86775) 2023-01-27 11:10:29 +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 32d68f375b
Add Mqtt WebSockets support (#82078)
* Add Mqtt WebSockets support

* Fix tests

* Add testing websockets options

* Add tests transport settings

* Do not use templates for ws_headers

* Use json helper - small corrections
2022-11-23 15:03:31 +01:00
Jan Bouwhuis b717da879f
Add support for Mqtt protocol version 5 (#82260) 2022-11-17 21:12:27 +01:00
Jan Bouwhuis 5e7f571f01
Move advanced MQTT options to entry (#79351)
* Move advanced broker settings to entry

* Add repair issue for deprecated settings

* Split CONFIG_SCHEMA

* Do not store certificate UI flags in entry

* Keep entered password in next dialog

* Do not process yaml config in flow

* Correct typo
2022-10-24 09:58:23 +02:00
Martin Hjelmare 62c4cd3c26
Add name and slug to supervisor discovery info (#80094) 2022-10-11 16:56:45 +02:00
Jan Bouwhuis aee82e2b3b
De-duplicate MQTT config_flow code (#79369)
* De-duplicate config_flow code

* De duplicate code birth and will
2022-10-07 10:12:19 +02:00
Jan Bouwhuis 84b2c74746
Move MQTT discovery hass.data globals to dataclass (#78706)
* Add MQTT discovery hass.data globals to dataclass

* isort

* Additional rework

* Add hass.data["mqtt_tags"] to dataclass

* Follow-up comment

* Corrections
2022-09-28 14:13:44 +02:00
Jan Bouwhuis c5a58c8501
Fix MQTT setup after changing config entry flow options (#79103)
Fix issues with config flow options
2022-09-27 08:05:28 +02:00
Jan Bouwhuis 1f410e884a
Make hass.data["mqtt"] an instance of a DataClass (#77972)
* Use dataclass to reference hass.data globals

* Add discovery_registry_hooks to dataclass

* Move discovery registry hooks to dataclass

* Add device triggers to dataclass

* Cleanup DEVICE_TRIGGERS const

* Add last_discovery to data_class

* Simplify typing for class `Subscription`

* Follow up on comment

* Redo suggested typing change to sasisfy mypy

* Restore typing

* Add mypy version to CI check logging

* revert changes to ci.yaml

* Add docstr for protocol

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

* Mypy update after merging #78399

* Remove mypy ignore

* Correct return type

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2022-09-17 21:43:42 +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
Franck Nijhof 7cd68381f1
Search/replace RESULT_TYPE_* by FlowResultType enum (#74642) 2022-07-07 19:57:36 +03:00
epenet 8ef87205f9
Improve type hints in mqtt (#74247) 2022-06-30 21:11:45 +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
Erik Montnemery 84243cf560
Tweak MQTT hassio discovery flow (#72699) 2022-05-30 14:25:36 +02:00
Erik Montnemery 7e8d52e5a3
Fix race when handling rapid succession of MQTT discovery messages (#68785)
Co-authored-by: jbouwh <jan@jbsoft.nl>
2022-03-29 20:26:11 -07:00
Jan Bouwhuis 9356bf1a8e
Fix MQTT config flow with advanced parameters (#67556)
* Fix MQTT config flow with advanced parameters

* Add test
2022-03-03 21:40:15 +01:00
Jan Bouwhuis 845bf80e72
Mqtt improve test coverage (#66279)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-02-23 12:29:32 +01:00
Erik Montnemery 335a918118
Create MQTT discovery flow when manual config is present (#66248)
* Create MQTT discovery flow when manual config is present

* Change to integration_discovery flow

* Add test

* Add default handler for integration_discovery
2022-02-11 10:31:51 +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
epenet 358922db56
Use dataclass for HassioServiceInfo (#60824)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-03 14:05:56 +01:00
J. Nick Koston d7c4a669f1
Revert "Use HassioServiceInfo in mqtt tests" (#60867) 2021-12-02 10:13:41 -10:00
epenet 37200decf9
Use HassioServiceInfo in mqtt tests (#60865) 2021-12-02 10:10:50 -10:00
Erik Montnemery f548d1dba7
Prevent opening of sockets in mqtt tests (#57101) 2021-10-05 11:14:53 +02:00
Franck Nijhof 96303a1d80
Fix MQTT add-on discovery to be ignorable (#55250) 2021-08-26 11:14:42 +02:00
Ville Skyttä 153d6e891e
Use config_entries.SOURCE_* constants (#49631) 2021-04-25 11:27:40 +02:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Erik Montnemery 306ee30574
Enable MQTT discovery by default (#41361) 2020-10-07 14:51:06 +02:00
Franck Nijhof 1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00