Commit Graph

790 Commits (7cbe49520e7ff8c038ceb35d75b37dc788f9f6cd)

Author SHA1 Message Date
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
Jan Bouwhuis e0457590d1
Fix mqtt text text min max config params can not be equal (#107738)
Fix mqtt text text min max kan not be equal
2024-01-11 07:17:48 +01:00
Jan Bouwhuis 9ad3c8dbc9
Remove MQTT legacy vacuum support (#107274) 2024-01-08 09:22:43 +01:00
Jan Bouwhuis f0ec1235b1
Remove naming warnings and work-a-rounds for incorrectly configured MQTT entities (#107188)
* Remove naming warnings for MQTT entities

* Remove unused const
2024-01-05 09:32:22 +01:00
Jan Bouwhuis c7b6c9da31
Remove work-a-round for mqtt sensors with an entity_category set to `config` (#107199)
* Remove work-a-round for mqtt sensors with an entity_category set to `config`

* Cleanup strings
2024-01-05 09:24:52 +01:00
G Johansson 83f4d3af5c
Implement mode validation in Climate entity component (#105745)
* Implement mode validation in Climate entity component

* Fix some tests

* more tests

* Fix translations

* fix deconz tests

* Fix switcher_kis tests

* not None

* Fix homematicip_cloud test

* Always validate

* Fix shelly

* reverse logic in validation

* modes_str

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2023-12-27 14:51:39 +01:00
Jan Bouwhuis dae8c0fc38
Fix MQTT retained event messages should be discarded (#106425) 2023-12-27 12:48:53 +01:00
Jan Bouwhuis 6da2f98d34
Fix mqtt valve is not resetting opening or closing state (#106240)
* Fix mqtt valve is not resetting opening or closing state

* Require state or position attr in JSON state update

* Do not change `_attr_is_closed` if valve reports a position

* Add comment, use tuple

* Call _update_state
2023-12-23 15:18:44 +01:00
Jan Bouwhuis f8f31627ce
Refactor ranging utils for mqtt cover (#105739)
* Refactor ranging utils for mqtt cover

* Use literals for default min and max percentage
2023-12-21 11:54:05 +01:00
Jan Bouwhuis 65d3f7e1c7
Improve error mqtt valve error logging (#106129)
* Improve error mqtt valve error logging

* Update homeassistant/components/mqtt/valve.py

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

* Update homeassistant/components/mqtt/valve.py

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

* Update homeassistant/components/mqtt/valve.py

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

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-12-20 21:18:30 +01:00
Jan Bouwhuis c7f6ab2457
Add MQTT valve platform (#105766)
* Add mqtt valve platform

* No stop topic-reports_position and validation

* Do not allow state_open, state_closed with position reporing valve

* Allow open/close feature to be disabled

* Follow up comments

* Rename

* Apply defaults in validator

* Update docstr
2023-12-20 07:49:49 +01:00
Jan Bouwhuis 3f2fc2fce9
Fix mqtt tests modifying globals (#105774) 2023-12-15 08:15:10 +01:00
Jan-Philipp Benecke ff85d0c290
Migrate mqtt tests to use freezegun (#105414) 2023-12-10 09:25:16 +01:00
Jan Bouwhuis e5a115ce1f
Fix mqtt json light state updates using deprecated color handling (#105283) 2023-12-08 16:54:02 +01:00
Jan Bouwhuis 4bf88b1690
Improve MQTT json light brightness scaling (#104510)
* Improve MQTT json light brightness scaling

* Revert unrelated changes

* Format
2023-11-29 16:42:10 +01:00
Jan Bouwhuis 82264a0d6b
Fix mqtt cover state is open after receiving stopped payload (#104726) 2023-11-29 16:29:42 +01:00
Jan Bouwhuis 953a212dd6
Use ServiceValidationError for invalid fan preset_mode and move check to fan entity component (#104560)
* Use ServiceValidationError for fan preset_mode

* Use _valid_preset_mode_or_raise to raise

* Move preset_mode validation to entity component

* Fix bond fan and comments

* Fixes baf, fjaraskupan and template

* More integration adjustments

* Add custom components mock and test code

* Make NotValidPresetModeError subclass

* Update homeassistant/components/fan/strings.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Keep bond has_action validation

* Move demo test asserts outside context block

* Follow up comment

* Update homeassistant/components/fan/strings.json

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* Fix demo tests

* Remove pylint disable

* Remove unreachable code

* Update homeassistant/components/fan/__init__.py

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* Use NotValidPresetModeError, Final methods

* Address comments

* Correct docst

* Follow up comments

* Update homeassistant/components/fan/__init__.py

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

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-11-29 13:56:51 +01:00
Martin Hjelmare b3211fa5ee
Clean mqtt patch.dict config entries (#104449) 2023-11-24 10:56:17 +01:00
Jan Bouwhuis 68f8b2cab5
Fix mqtt json light allows to set brightness value >255 (#104220) 2023-11-19 19:50:25 +01:00
Erik Montnemery 4536fb3541
Remove mock_entity_platform test helper (#104073) 2023-11-16 16:55:08 +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 db97e7588b
Fix entity category for binary_sensor fails setup (#103511) 2023-11-08 14:10:24 +01:00
Jan Bouwhuis cbccdbc6fa
Fix entity category for sensor fails mqtt sensor platform setup (#103449) 2023-11-08 00:03:47 +01:00
Jan Bouwhuis 4a4d2ad743
Fix mqtt config validation error handling (#103210)
* Fix MQTT config check

* Fix handling invalid enity_category for sensors

* Improve docstr

* Update comment

* Use correct util for yaml dump
2023-11-02 10:57:00 +01:00
Jan Bouwhuis daee5baef6
Fix mqtt is not reloading without yaml config (#103159) 2023-11-01 09:25:56 +01:00
Jan Bouwhuis d6a0f9b5a0
Give mqtt test more time to process subscriptions (#103006) 2023-10-30 06:02:03 +01:00
Jan Bouwhuis 485c52568d
Fix error handling on subscribe when mqtt is not initialized (#101832) 2023-10-20 15:16:45 +02:00
Jan Bouwhuis fe8fb8928c
Improve test creating mqtt certificate files (#102380)
* Improve test creating mqtt certificate files

* Split tests

* Cleanup and de-duplicate

* Update tests/components/mqtt/test_util.py
2023-10-20 14:49:33 +02: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 1efbba2631
Do not fail MQTT setup if covers configured via yaml can't be validated (#102304)
Add cover
2023-10-20 10:51:42 +02:00
Jan Bouwhuis 12c4a10cfc
Do not fail MQTT setup if numbers configured via yaml can't be validated (#102316)
Add number
2023-10-20 10:51:14 +02:00