Jan Bouwhuis
e28d4f0eae
Validate state_class with last_reset_value_template for mqtt sensors ( #113099 )
2024-03-12 09:08:03 +01:00
Jan Bouwhuis
caaa03536b
Cleanup mqtt PLATFORMS constant and CI-test platform filters ( #112847 )
2024-03-09 23:48:54 +01:00
Marc Mueller
32f3f46542
Add empty line after module docstring (2) [tests.components] ( #112737 )
2024-03-08 19:16:21 +01:00
Jan Bouwhuis
09f1ec78a5
Handle template errors on MQTT payload handling ( #110180 )
...
* Handle template errors on MQTT payload handling (alt)
* Handle mqtt event en image template errors correctly
2024-02-13 10:59:55 +01:00
Jan-Philipp Benecke
9326ea09a5
Update m* tests to use entity & device registry fixtures ( #103980 )
2023-11-15 10:33:11 +01:00
Jan Bouwhuis
7d9014ae41
Do not fail MQTT setup if events or sensors configured via yaml can't be validated ( #102309 )
...
* Add event and sensor
* Cleanup unused code
* Schema cannot be None for supported platform
2023-10-20 12:09:52 +02:00
Jan Bouwhuis
db0c5bbbea
Fix mqtt sensor or binary_sensor state not saved after expiry ( #101670 )
...
Fix mqtt sensor state not saved after expire
2023-10-08 20:57:14 +02:00
Jan Bouwhuis
aed3ba3acd
Avoid redundant calls to `async_ha_write_state` in MQTT (binary) sensor ( #100438 )
...
* Only call `async_ha_write_state` on changes.
* Make helper class
* Use UndefinedType
* Remove del
* Integrate monitor into MqttEntity
* Track extra state attributes and availability
* Add `__slots__`
* Add monitor to MqttAttributes and MqttAvailability
* Write out loop
* Add test
* Make common test and parameterize
* Add test for last_reset attribute
* MqttMonitorEntity base class
* Rename attr and update docstr `track` method.
* correction doct
* Implement as a decorator
* Move tracking functions into decorator
* Rename decorator
* Follow up comment
2023-09-21 13:33:26 +02:00
Jan Bouwhuis
3d1efaa4ad
Freeze time for MQTT sensor expire tests ( #99496 )
2023-09-02 04:10:57 -05:00
Erik Montnemery
2e1a5ddf2b
Don't allow creating device if config entry does not exist ( #98157 )
...
* Don't allow creating device if config entry does not exist
* Fix test
* Update test
2023-08-10 22:09:13 -04:00
Jan Bouwhuis
447fbf58c9
Change naming of MQTT entities to correspond with HA guidelines ( #95159 )
...
* Set has_entity_name if device_name is set
* revert unneeded formatting change
* Add image platform
* Follow up comment
* Don't set `has_entity_name` without device name
* Only set has_entity_name if a valid name is set
* Follow device_class name and add tests
* Follow up comments add extra tests
* Move to helper - Log a warning
* fix test
* Allow to assign None as name explictly
* Refactor
* Log info messages when device name is not set
* Revert scene schema change - no device link
* Always set has_entity_name with device mapping
* Always set `_attr_has_entity_name`
* Cleanup
2023-07-21 12:52:10 +02:00
Jan Bouwhuis
7c22225cd1
Allow ADR 0007 compliant schema for mqtt ( #94305 )
...
* Enforce listed entities in MQTT yaml config
* Add tests for setup with listed items
* Fix test
* Remove validator add comment
* Update homeassistant/components/mqtt/__init__.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-07-18 14:29:45 +02:00
Erik Montnemery
7539cf25be
Don't require passing identifiers to DeviceRegistry.async_get_device ( #96479 )
...
* Require keyword arguments to DeviceRegistry.async_get_device
* Update tests
* Update tests
* Don't enforce keyword arguments
2023-07-13 13:39:25 -04:00
Jan Bouwhuis
c984604a6c
Refactor some mqtt tests not the just use schema validation ( #94330 )
...
Remove help_test_validate_platform_config
2023-06-09 12:30:26 +02:00
Jan Bouwhuis
3a7f9ab57d
Remove mqtt sensor support for `last_reset_topic` ( #93792 )
...
* Remove mqtt sensor support for `last_reset_topic`
* Add cases for empty last reset messages
2023-05-30 21:07:07 -04:00
Jan Bouwhuis
e36fd5f222
Allow None device_class and UOM for mqtt entities ( #91240 )
...
* Allow None device_class and UOM for mqtt entities
* Rever not needed changes
* Revert another unwanted change
2023-04-12 19:14:16 +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
f2b4c95a04
Prepare MQTT platform tests part7 ( #90130 )
...
* Tests select
* Tests sensor
* Deduplicate test code
2023-03-24 08:42:00 +01:00
Jan Bouwhuis
d865440012
Prepare MQTT common tests part3 ( #90022 )
2023-03-21 09:19:20 +01:00
Jan Bouwhuis
fe49861e26
Prepare MQTT common tests part4 ( #90023 )
...
* Upd test_setting_attribute_via_mqtt_json_message
* Update test_setting_attribute_with_template
* Update test_update_with_json_attrs_not_dict
* Update test_update_with_json_attrs_bad_json
2023-03-21 09:07:46 +01:00
Jan Bouwhuis
91dbda1ce7
Add mqtt common tests for availability (part2) ( #89805 )
...
* update test_availability_when_connection_lost
* Adjust test_availability_without_topic
* Update test_default_availability_payload + helper
* Update test_default_availability_list_payload
* Use helper for async_setup_component
* Update test_default_availability_list_*
* Update test_custom_availability_payload
2023-03-21 08:20:37 +01:00
epenet
ff8b91aeea
Add freezer to known test fixtures in pylint ( #89825 )
...
Add freezer to known fixtures in pylint
2023-03-16 22:39:41 -04:00
Jan Bouwhuis
c81a38effb
Mqtt prepare test base part1 ( #89796 )
...
* Refactor test_reloadable
* Refactor test_disabling_and_enabling_entry
* optimize test_unload_config_entry
* Cleanup help_test_unload_config_entry
* cleanup test_unload_entry
* Update test tls_version
* More tests to entry only
* Add validate and hassconfig patch
* Revert fixture changes patch_hass_config
* Follow up comments
2023-03-16 15:57:01 +01:00
Jan Bouwhuis
366baef7f6
Allow enum as MQTT sensor device_class ( #89391 )
2023-03-08 22:35:06 +01:00
Jan Bouwhuis
a9becd8e0e
Raise ValueError on date parsing of MQTT sensor with invalid date format ( #89036 )
...
* Suppress ValueError on date parsing of MQTT sensor
* Simplify, but not update state on invalid payload
* Still raise an an invalid date
* Make datetime state unknown on invalid format
* remove unrelated added new line
2023-03-05 17:06:48 +01: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
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
c78cae4483
Fix handling `None` or empty value for numeric MQTT sensor ( #87004 )
...
* Allow `None` for numeric sensor, ignore empty val
* Add test case with omitting a value
* Use _numeric_state_expected property
* Only respect None if numeric state is expected
2023-02-07 11:23:23 +01:00
Jan Bouwhuis
73e3b30906
Add `suggested_display_precision` config option for MQTT sensor ( #87129 )
...
* Add precision for MQTT sensor
* Correct tests
* Use _attr_suggested_display_precision
* Rename option and add abbreviation
* Make abbr more compact
2023-02-07 08:55:35 +01:00
epenet
bcef0d66ac
Remove invalid uom from mqtt tests ( #86004 )
2023-01-16 14:51:35 +01:00
Jan Bouwhuis
01e1e254e2
Use value of enum ( #85944 )
2023-01-15 19:30:29 +01:00
Michael
104f74054b
Replace the usage of unit constants by enumerations in Tests [m-n] ( #85935 )
...
* replace unit conts by enums m-n
* fix mqtt
2023-01-15 15:45:00 +01:00
Jan Bouwhuis
ee21bc5d7f
Allow MQTT device_class or state_class to be set as `None` ( #85106 )
...
* Allow MQTT device_class to be set as `None`
* Add test
* Also allow sensor state_class to be `None`
2023-01-04 15:21:07 +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
db0785827f
Revert "Do not write state if payload is `''`" for MQTT sensor ( #81347 )
...
* Revert "Do not write state if payload is ''"
This reverts commit 869c11884e
.
* Add test
2022-11-01 16:25:01 +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
13188a5c63
Refactor MQTT tests to use modern platform schema part 2 ( #77525 )
...
* Tests light json
* Tests light template
* Missed test light json
* Tests light
* Tests lock
* Tests number
* Tests scene
* Tests select
* Tests sensor
* Tests siren
* Tests state vacuuum
* Tests switch
* Derive DEFAULT_CONFIG_LEGACY from DEFAULT_CONFIG
* Suggested comment changes
2022-09-06 11:03:02 +02:00
Erik Montnemery
c55505b47b
Use mock_restore_cache in mqtt tests ( #77297 )
2022-08-25 09:27:38 +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
Erik Montnemery
b97d346df7
Fix reload of MQTT yaml config ( #72901 )
2022-06-02 11:32:31 -07: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
d0556e6dd1
Move manual configuration of MQTT sensor to the integration key ( #72276 )
...
Add sensor
2022-05-23 16:29:45 +02:00
Erik Montnemery
2abcd7cd94
Correct state restoring for MQTT temperature sensors ( #66741 )
...
* Correct state restoring for MQTT temperature sensors
* Adjust test
* Adjust test
2022-02-18 11:35:44 +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