1014 Commits

Author SHA1 Message Date
Dionisis Toulatos
12c3d54a63
Fix MQTT device discovery when using node_id (#142784)
* Fix device discovery when using node_id

* tests

---------

Co-authored-by: jbouwh <jan@jbsoft.nl>
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2025-04-19 09:12:16 +00:00
Jan Bouwhuis
8dc21ef619
Allow max to be equal with min for mqtt number config validation (#142522) 2025-04-11 15:39:03 +00:00
Jan Bouwhuis
fa3832fbd7
Improve error handling and logging on MQTT update entity state updates when template rederings fails (#141960) 2025-04-01 19:07:10 +00:00
Ben Jones
3951c2ea66
Handle empty or missing state values for MQTT light entities using 'template' schema (#141177)
* check for empty or missing values when processing state messages for MQTT light entities using 'template' schema

* normalise warning logs

* add tests (one is still failing and I can't work out why)

* fix test

* improve test coverage after PR review

* improve test coverage after PR review
2025-04-01 18:32:50 +00:00
Jan Bouwhuis
cff0a632e8
Fix QoS schema issue in MQTT subentries (#141531) 2025-03-26 23:21:17 +00:00
Jan Bouwhuis
febc455bc5
Add switch as entity platform on MQTT subentries (#140658) 2025-03-26 16:46:44 +01:00
Jan Bouwhuis
0de3549e6e
Move QoS setting to shared device properties in MQTT device subentries configuration (#141369)
* Move QoS setting to shared device properties in MQTT device subentries configuration

* Use kwargs for validate_user_input helper
2025-03-26 15:20:08 +01:00
Jan Bouwhuis
77bf977d63
Add sensor as entity platform on MQTT subentries (#139899)
* Add sensor as entity platform on MQTT subentries

* Fix typo

* Improve device class data description

* Tweak

* Rework reconfig calculation

* Filter out last_reset_value_template if state class is not total

* Collapse expire after as advanced setting

* Update suggested_display_precision translation strings

* Make options and last_reset_template conditional, use sections for advanced settings

* Ensure options are removed properly

* Improve sensor options label, ensure UOM is set when device class has units

* Use helper to apply suggested values from component config

* Rename to `Add option`

* Fix schema builder not hiding empty sections and removing fields excluded from reconfig

* Do not hide advanced settings if values are available or are defaults

* Improve spelling and Learn more links

* Improve unit of measurement validation

* Fix UOM selector and translation strings

* Address comments from code review

* Remove stale comment

* Rename selector constant, split validator

* Simplify config validator

* Return tuple with config and errors for config validation
2025-03-26 13:34:24 +01:00
poucz
a030502489
Add MQTT cover stop tilt (#139912)
* Stop tilt move.

Stop tilt use same payload as cover - payload_stop

* Add test for STOP_TILT

* Tilt action

* Revert "Tilt action"

This reverts commit 7ce4fbb086616a900fc53277d379cbf03e9e0339.

* Update tests/components/mqtt/test_cover.py

Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>

* Update homeassistant/components/mqtt/cover.py

Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>

* Append CONF_PAYLOAD_STOP_TILT

* Update homeassistant/components/mqtt/cover.py

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

* Test for new payload

* Update tests/components/mqtt/test_cover.py

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

* Update tests/components/mqtt/test_cover.py

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

* Ruff format

* abbreviation

---------

Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2025-03-20 18:20:12 +00:00
Jan Bouwhuis
a8f1df3e55
Add availability support for MQTT subentries (#138673)
* Add availability support for MQTT subentries

* Update homeassistant/components/mqtt/config_flow.py

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

* Update homeassistant/components/mqtt/config_flow.py

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

* Update homeassistant/components/mqtt/config_flow.py

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

* Update homeassistant/components/mqtt/strings.json

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

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2025-03-14 14:56:27 +01:00
Jan Bouwhuis
bd4d0ec4b8
Add initial MQTT subentry support for notify entities (#138461)
* Add initial MQTT subentry support for notify entities

* Fix componts assigment is reset on device config. Translation tweaks

* Rephrase

* Go to summary menu when components are set up already - add test

* Fix suggested device info on config flow

* Invert

* Simplify subentry config flow and omit menu

* Use constants instead of literals

* More constants

* Teak some translations

* Only show save when the the entry is dirty

* Do not trigger an entry reload twice

* Remove encoding, entity_category

* Remove icon from mqtt subentry flow

* Separate entity settings and MQTT specific settings

* Remove object_id and refactor

* Migrate translations

* Make subconfig flow test extensible

* Make sub reconfig flow tests extensible

* Rename entity_platform_config step to mqtt_platform_config

* Make component unique ID independent from the name

* Move code for update of component data to helper

* Follow up on code review

* Skip dirty stuff

* Fix rebase issues #1

* Do not allow reconfig for entity platform/name, default QoS and refactor tests

* Add entity platform and entity name label to basic entity config dialog

* Rename to exclude_from_reconfig and make reconfig option not optional
2025-03-14 14:00:07 +01:00
epenet
593ae48aa2
Migrate mqtt tests to use unit system (#140376)
* Migrate mqtt tests to use unit system

* Fix param list

* Missed one

---------

Co-authored-by: jbouwh <jan@jbsoft.nl>
2025-03-12 09:47:34 +02:00
epenet
a13911e00e
Rename test helpers module in mqtt (#140375)
* Rename test helpers module in mqtt

* missed a file
2025-03-11 18:00:51 +01:00
Jan Bouwhuis
6284a83a34
Fix client_id not generated when connecting to the MQTT broker (#140264)
Fix client_id not generated when connecting to the MQTT broker
2025-03-10 11:04:49 +01:00
Jan Bouwhuis
1a46edffaa
Deprecate use of invalid unit of measurement for mqtt sensor (#140164)
* Deprecate use of invalid unit of measurement for mqtt sensor

* Update learn more URL to point to user docs instead

* typo
2025-03-09 14:20:31 +01:00
Jan Bouwhuis
0d3011f0fb
Revert "Check if the unit of measurement is valid before creating the entity" (#140155)
Revert "Check if the unit of measurement is valid before creating the entity …"

This reverts commit 99e1a7a676b2fc14f9f8a8db64bee2840fae4646.
2025-03-08 23:04:05 +01:00
Jan Bouwhuis
d94bdb7ecd
Fix MQTT JSON light not reporting color temp status if color is not supported (#140113) 2025-03-08 09:15:56 -10:00
Jan Bouwhuis
99e1a7a676
Check if the unit of measurement is valid before creating the entity (#139932) 2025-03-06 18:52:46 +01:00
Jan Bouwhuis
913a4ee9ba
Improve certificate handling in MQTT config flow (#137234)
* Improve mqtt broker certificate handling in config flow

* Expand test cases
2025-03-01 21:14:08 +01:00
Jan Bouwhuis
2de941bc11
Fix - Allow brightness only light MQTT json light to be set up using the brightness flag or via supported_color_modes (#139585)
* Fix - Allow brightness only light MQTT json light to be set up using the `brightness` flag or via  `supported_color_modes`

* Improve comment
2025-03-01 19:35:39 +01:00
Jan Bouwhuis
5324f3e542
Add support for swing horizontal mode for mqtt climate (#139303)
* Add support for swing horizontal mode for mqtt climate

* Fix import
2025-02-26 15:44:16 +01:00
Jan Bouwhuis
689421eddf
Move blocking code to executor job in MQTT CI test helper (#138815) 2025-02-19 06:14:07 +01:00
skobow
f8ffbf0506
Set clean_start=True on connect to MQTT broker (#136026)
* Addresses #135443: Set  on connect.

* Make clean start implementation compatible with v2 API

* Add tests

* Do not pass default value for `clean_start` on_connect

* Revert "Do not pass default value for `clean_start` on_connect"

This reverts commit 75806736cf511a6d6b6496454843de34f05f7758.

* Use partial top pass kwargs to mqtt client connect

---------

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
Co-authored-by: jbouwh <jan@jbsoft.nl>
2025-02-18 23:11:21 +01:00
Jan Bouwhuis
33df208296
Fix temp files of mqtt CI tests not cleaned up properly (#138741)
* Fix temp files of mqtt CI tests not cleaned up properly

* Do not cleanup tempfiles, patch gettempdir only
2025-02-18 08:38:43 +01:00
Jan Bouwhuis
d6b7762dd6
Upgrade paho-mqtt API to v2 (#137613)
* Upgrade paho-mqtt API to v2

* Refactor on_connect callback

* Add tests

* Fix Tasmota tests
2025-02-13 22:13:19 +01:00
Jan Bouwhuis
d3d00357aa
Allow to omit the payload attribute to MQTT publish action to allow an empty payload to be sent by default (#137595)
Allow to omit the payload attribute to MQTT publish actionto allow an empty payload to be sent by default
2025-02-06 22:11:39 +02:00
Jan Bouwhuis
7fa6f7e875
Bump paho-mqtt client to version 2.1.0 (#136130)
* Bump paho-mqtt client to version 2.1.0

* Remove commented code

* Bump pyeconet==0.1.26

* Ensure types-paho-mqtt==1.6.0.20240321 is uninstalled if test requirements are updated

* Update roombapy dependency

* Remove pyeconet from exceptions list

* Revert changes to install test requirements task
2025-02-04 20:59:28 +01:00
Jan Bouwhuis
efc515ff4e
Remove legacy color_mode support for legacy mqtt json light (#136996) 2025-02-04 12:34:36 +01:00
Marc Mueller
30c0a1492c
Update codespell to 2.4.1 (#137312) 2025-02-04 12:16:24 +01:00
Jan Bouwhuis
30af9057d1
Ensure random temp dir is used during MQTT CI tests (#137221) 2025-02-03 16:06:02 +00:00
Jan Bouwhuis
839e2881e0
Fix mqtt reconfigure does not use broker entry password when it is not changed (#137169) 2025-02-02 16:21:40 +01:00
epenet
d0a188b86d
Standardize homeassistant imports in component tests (m-z) (#136807) 2025-01-29 08:57:57 +01:00
Jan Bouwhuis
f0257fec88
Fix mqtt number state validation (#135621) 2025-01-15 10:13:27 +01:00
Jan Bouwhuis
b93aa760c5
Refactor the MQTT option and reconfigure flow (#133342)
* Move entry options to entry.options en remove broker setup from mqtt option flow

* UPdate diagnostics to export both entry data and options

* Parameterize entry options directly not depending on migration

* Update tests to use v2 entry and add separate migration test

* use start_reconfigure_flow helper

* Update quality scale comment

* Do minor entry upgrade, and do not force to upgrade entry

* Ensure options are read from older entries

* Add comment

* Follow up on code review

* Assert config entry version checking the broker connection

* Update comment
2025-01-13 19:00:18 +01:00
Jan Bouwhuis
eba090c9ef
Allow to process kelvin as color_temp for mqtt template light (#133957) 2025-01-10 11:43:36 +01:00
epenet
02956f9a83
Improve formatting in component test files (#135267)
Improve formatting in test files
2025-01-10 10:53:45 +01:00
Jan Bouwhuis
cabdae98e8
Allow to process kelvin as color_temp for mqtt json light (#133955) 2025-01-09 18:34:42 +01:00
Jan Bouwhuis
ec37e1ff8d
Allow to process kelvin as color_temp for mqtt basic light (#133953) 2025-01-09 16:31:09 +01:00
Jan Bouwhuis
85c94e6403
Calculate number of discovery topics correctly (#134393) 2025-01-01 16:55:41 +01:00
Jan Bouwhuis
8098122dfe
Ensure an entity platform is added in mqtt tests (#134331) 2024-12-31 23:01:55 +01:00
Jan Bouwhuis
7b2a5d0684
Remove mqtt publish templates after 6 months of deprecation (#134056) 2024-12-26 23:25:44 +01:00
Jan Bouwhuis
6b666b3a0f
Test color_temp updates are processed when an mqtt json light is turned off (#133715) 2024-12-21 12:44:00 +01:00
J. Nick Koston
4e316429d3
Handle WebsocketConnectionError during mqtt auto reconnect (#133697)
followup to #133610 to handle the exception in the auto reconnect
path as well

fixes #132985
2024-12-21 11:18:47 +01:00
J. Nick Koston
551a584ca6
Handle mqtt.WebsocketConnectionError when connecting to the MQTT broker (#133610)
fixes #132985
2024-12-19 21:39:39 +01:00
Jan Bouwhuis
ac6d718094
Fix mqtt reconfigure flow (#133315)
* FIx mqtt reconfigure flow

* Follow up on code review
2024-12-17 09:37:46 +01:00
Jan Bouwhuis
2003fc7ae0
Adjust MQTT tests not to assert on deprecated color_temp attribute (#133198) 2024-12-15 19:42:54 +01:00
Jan Bouwhuis
16ad2d52c7
Improve MQTT json color_temp validation (#133174)
* Improve MQTT json color_temp validation

* Revert unrelated changes and assert on logs

* Typo
2024-12-15 13:07:10 +01:00
Jan Bouwhuis
73cb3fa88d
Fix lingering mqtt device_trigger unload entry test (#133202) 2024-12-15 11:55:33 +01:00
Jan Bouwhuis
97da8481d2
Add reconfigure flow to MQTT (#132246)
* Add reconfigure flow for MQTT integration

* Add test and translation strings

* Update quality scale configuration

* Do not cache ConfigEntry in flow

* Make sorce condition explictit

* Rework from suggested changes

* Do not allow reconfigure_entry and reconfigure_entry_data to be `None`
2024-12-13 16:11:45 +01:00
epenet
2ce2765e67
Adjust light test helpers to use Kelvin, and cleanup unused helpers (#133048)
Cleanup light test helper methods
2024-12-12 16:49:25 +01:00