Commit Graph

820 Commits (2ec588d2a6e391089687bffce307d64c07e2aaa6)

Author SHA1 Message Date
Sid 3efee10b95
Enable Ruff RUF013 (#115333) 2024-04-10 08:55:59 +02:00
epenet 0b01326f9f
Use is in ConfigEntryState enum comparison in tests (A-M) (#114925) 2024-04-05 17:16:55 +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
Sid d5f883fbf0
Unignore Ruff PLR in tests (#114470)
* Unignore Ruff PLR in tests

* Address review comments

* review comments

* fix import

* Update test_api.py

* Update test_api.py

* Update test_api.py
2024-04-01 11:11:59 +02:00
Jan Bouwhuis 5e3ce80488
Remove stale test for mqtt climate (#114443) 2024-03-29 16:01:50 +01:00
Marc Mueller 443bfee16d
Replace partial annotations (#114177) 2024-03-28 18:33:39 +01:00
Jan-Philipp Benecke 22b14d83e8
Use `setup_test_component_platform` helper for sensor entity component tests instead of `hass.components` (#114316)
* Use `setup_test_component_platform` helper for sensor entity component tests instead of `hass.components`

* Missing file

* Fix import

* Remove invalid device class
2024-03-28 12:07:55 +01: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
Jan Bouwhuis 18174ad47d
Improve test coverage mqtt discovery test (#114188) 2024-03-25 22:41:11 +01:00
Marc Mueller 9b7cc088be
Fix spelling [runtime] (#114169) 2024-03-25 11:32:50 +01:00
Erik Montnemery 426f73b1f4
Add State.last_reported (#113511)
* Add State.last_reported

* Update tests

* Update test snapshots

* Call state_reported listeners when firing state_changed event

* Add tests
2024-03-20 21:05:07 +01:00
Jan Bouwhuis 3dc8df2403
Get ServiceValidationError message from translation cache only (#113704)
* Get ServiceValidationError message from translation cache only

* Remove message for NotValidPresetModeError
2024-03-18 14:42:21 +01:00
Sid d5fd005db8
Add ruff rule PIE808 (#113621) 2024-03-17 09:56:26 +01:00
Sid b261f124d6
fix mqtt siren test asserts (#113550) 2024-03-15 21:59:30 +01:00
soonsouth cfc2f17f35
Remove repetitive words in comments and docstrings (#113529)
chore: remove repetitive words

Signed-off-by: soonsouth <cuibuwei@163.com>
2024-03-15 18:11:12 +01:00
J. Nick Koston c1f5c7c4b7
Remove usage of async_add_job in tests (#113259) 2024-03-13 19:33:33 -10:00
Joost Lekkerkerker 595d07f1c6
Improve lists in integrations [L-M] (#113227)
* Improve lists in integrations [L-M]

* Update homeassistant/components/mailbox/__init__.py

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

* Fix

---------

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-03-13 21:28:21 +01:00
Jan Bouwhuis 488dae43d4
Improve lists for MQTT integration (#113184)
* Improve lists for MQTT integration

* Extra diagnostics tests

* Revert changes where the original version was probably faster

* Revert change to gather and await in series
2024-03-13 11:04:59 +01:00
Jan Bouwhuis e28d4f0eae
Validate state_class with last_reset_value_template for mqtt sensors (#113099) 2024-03-12 09:08:03 +01:00
Joost Lekkerkerker cddce0ce0d
Enable more SIM ruff rules (#113015)
* SIM101 SIM103

* SIM107 SIM109

* SIM110

* SIM112 SIM113

* SIM115

* SIM116

* Fix

* Fix

* Fix
2024-03-10 23:20:37 -04:00
Jan Bouwhuis 02ef7ba134
Remove not needed hass.async_block_till_done in test (#113002) 2024-03-10 09:46:25 -10:00
Jan Bouwhuis c608d1cb85
Fix mqtt platform setup race (#112888) 2024-03-10 08:36:17 -10:00
Jan Bouwhuis caaa03536b
Cleanup mqtt PLATFORMS constant and CI-test platform filters (#112847) 2024-03-09 23:48:54 +01:00
Jan Bouwhuis 3b0ea52167
Allow Just-in-Time platform setup for mqtt (#112720)
* Allow Just-in-Time platform setup for mqtt

* Only forward the setup of new platforms

* Fix new  platforms being setup at reload + test

* Revert not related changes

* Remove unused partial

* Address comments, only import plaforms if needed

* Apply suggestions from code review

* Add multipl platform discovery test

* Improve test

* Use a lock per platform
2024-03-09 21:55:00 +01:00
Jan Bouwhuis 6534943837
Revert "Cleanup mqtt discovery code" (#112818)
Revert "Cleanup mqtt discovery code (#112749)"

This reverts commit 87318c9111.
2024-03-09 12:54:10 +01:00
Jan Bouwhuis 87318c9111
Cleanup mqtt discovery code (#112749)
* Cleanup mqtt discovery code

* Cleanup mqtt discovery code
2024-03-09 11:54:27 +01:00
Marc Mueller 959826c4b4
Update byte string formatting (#112752) 2024-03-08 20:32:40 +01:00
Marc Mueller 32f3f46542
Add empty line after module docstring (2) [tests.components] (#112737) 2024-03-08 19:16:21 +01:00
Marc Mueller 1722e23df8
Add empty line after module docstring [tests l-p] (#112710) 2024-03-08 14:55:15 +01:00
Jan Bouwhuis 0c2cf881ac
Deprecate old config options for MQTT json light (#111676)
* add deprecaction

* Deprecate old config options for mqtt json light

* Do not deprecate brightness flag

* Enable brightness support by default

* Keep `false` as default for brightness flag

* Add warnings and register issue

* log warning and register on use of color_mode flag

* Remove redundant cv.deprecated logging + follow up comments
2024-03-05 08:49:05 +01:00
Jan Bouwhuis c13231fc00
Improve mqtt value template error logging (#110492)
* Refactor mqtt value template error logging

* Remove import
2024-03-04 08:49:12 +01:00
Jan Bouwhuis 1b2e669302
Improve handling mqtt command template exceptions (#110499)
* Improve handling mqtt command template exceptions

* Fix test

* Cleanup stale exception handler

* Throw on topic template exception
2024-02-26 11:04:55 +01:00
J. Nick Koston 5b8591ec7e
Avoid reschedule churn in Storage.async_delay_save (#111091)
* Avoid circular import in Storage.async_delay_save

We call Storage.async_delay_save for every entity being added or removed
from the registry. The late import took more time than everything else
in the function.

* Avoid reschedule churn in Storage.async_delay_save

When we are adding or removing entities we will call async_delay_save
quite often which has to add and remove a TimerHandle on the event loop
which can add up when there are a lot of registry items changing.

If the timer handle still has 80% of the time remaining on it
we will avoid resceduling and let it fire at the time the
original async_delay_save call was made. This ensures we
do not force the event loop to rebuild its heapq because
too many timer handlers were cancelled at once

* div0

* add coverage for 0 since we had none

* fix bad conflict

* tweaks

* tweaks

* tweaks

* tweaks

* tweaks

* tweaks

* more test fixes

* mqtt tests rely on event loop overhead
2024-02-24 08:46:00 +01:00
Jan Bouwhuis c048b840fc
Do not directly call async_setup_entry in MQTT tests (#111010) 2024-02-21 07:47:30 +01:00
Jan Bouwhuis f4fd3633b4
Improve timing mqtt integration discovery test (#110960)
* Improve timing mqtt integration discovery test

* Remove condition
2024-02-19 20:16:06 +01:00
J. Nick Koston b35d7a348b
Fix mqtt discovery subscribe unsubscribe test with one less task (#110914)
This test currently relies on event loop overhead and since #110899
will remove another task in the config entry init flow, it needs
another async_block_till_done. In the future it should be refactored
to have better synchronization without having to rely on iterations
of the event loop.
2024-02-19 07:36:32 +01:00
Artur Pragacz 3392660537
Add toggle service to climate (#100418)
* Add toggle service to climate

* Fix mqtt test

* Add comments

* Fix rebase

* Remove not needed properties

* Fix toggle service

* Fix test

* Test

* Mod mqtt test

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
2024-02-16 15:53:48 +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
J. Nick Koston 04dccc7ec6
Migrate mqtt to use async_update_entry to alter config entries (#110407) 2024-02-12 21:38:13 +01:00
Jan Bouwhuis 6ca002a6f4
Improve tests of mqtt device triggers (#108318)
Improve tests on mqtt device triggers
2024-02-06 09:38:15 +01:00
Jan Bouwhuis 00947b708f
Remove aux heat support from mqtt climate (#109513) 2024-02-06 09:37:39 +01:00
Marc Mueller a9147cf3dd
Use builtin TimeoutError [k-n] (#109681) 2024-02-05 12:08:18 +01:00
Jan Bouwhuis 04f0128a1c
Simplify MQTT device triggers in automations (#108309)
* Simplify MQTT device trigger

* Add test non unique trigger_id

* Adjust deprecation warning

* Make discovery_id optional

* refactor double if

* Improve validation, add tests and deprecation comments

* Avoid breaking change

* Inmprove error message

* Match on discovery_id instead of discovery_info

* Revert an unrelated change

* follow up comments

* Add comment and test on device update with non unique trigger

* Update homeassistant/components/mqtt/device_trigger.py

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

* Update homeassistant/components/mqtt/device_trigger.py

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

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-01-30 20:50:39 +01:00
Jan Bouwhuis 6023980c2e
Set TURN_ON and TURN_OFF feature on MQTT climate entities (#109146) 2024-01-30 19:35:46 +01:00
G Johansson bc720b48b4
Add TURN_OFF and TURN_ON to ClimateEntityFeature (#101673)
* Add ClimateEntityFeature.TURN_OFF

* Fixes

* Fixes

* wording

* Change to services

* Fixing

* Fixing

* Last bits

* Review comments

* Add hvac_modes checks

* Fixes

* Add tests

* Review comments

* Update snapshots

* balboa

* coolmaster

* ecobee

* mqtt

* nest

* plugwise

* smarttub

* whirlpool

* zwave_js

* fix test climate

* test climate

* zwave

* nexia

* nuheat

* venstar

* tado

* smartthings

* self.hvac_modes not None

* more tests

* homekit_controller

* homekit controller snapshot
2024-01-30 15:07:47 +01:00
Robert Resch 6fdad44941
Improve invalid error messages in the config flows (#108075) 2024-01-30 12:24:19 +01:00
Jan Bouwhuis 7bec5ef6bc
Use unknown color_mode for MQTT json lights if color mode is not set (#108909) 2024-01-26 14:42:47 +01:00
J. Nick Koston c399cab427
Small speed up to checking core state (#107845) 2024-01-18 08:41:32 -10:00
Jan Bouwhuis 26058bf922
Add serial_number attribute to MQTT device properties (#108105) 2024-01-16 14:02:34 +01:00