Commit Graph

678 Commits (345df715d60968c250381607ccff55f77be3de42)

Author SHA1 Message Date
Franck Nijhof 86708b5590
Update ruff to v0.0.280 (#97102) 2023-07-23 22:00:26 +02:00
Jan Bouwhuis 1b8e03bb66
Add MQTT event entity platform (#96876)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2023-07-23 14:42:14 +02:00
Jan Bouwhuis 9a5774a95d
Apply common entity schema for MQTT Scene (#96949) 2023-07-22 18:00:27 +02: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 b504665b56
Do not override extra_state_attributes property for MqttEntity (#96890) 2023-07-21 06:35:58 +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 efcaad1179
Fix handling MQTT light brightness from zero rgb (#96286)
* Fix handling MQTT light brightness from zero rgb

* Fix log message
2023-07-11 14:22:12 -04:00
Jan Bouwhuis f3e55e96f4
Improve test coverage mqtt vacuum (#96288) 2023-07-11 10:16:00 +02:00
Jan Bouwhuis beff19f93c
Improve mqtt tag schema logging and avoid tests that use xfail (#95711)
Improve schema logging and tests
2023-07-11 10:12:31 +02:00
Jan Bouwhuis 30578d6236
Deprecate mqtt vacuum with legacy schema (#95836)
* Deprecate mqtt vacuum with legacy schema

* Consistent comments

* Correct comment

* Remove persistence option

* Adjust string, mention restart

* Update deprecation comment
2023-07-11 09:54:28 +02:00
Erik Montnemery 96c71b214f
Check supported features in calls to vacuum services (#95833)
* Check supported features in vacuum services

* Update tests

* Add comment
2023-07-10 13:05:47 +02:00
Erik Montnemery 2ca648584d
Update mqtt vacuum supported features (#95830)
* Update mqtt vacuum supported features

* Update test
2023-07-04 14:18:42 +02:00
Jan Bouwhuis 0856121046
Add action topic to MQTT humidifier (#95212)
* Add action topic to MQTT humidifier

* Add tests
2023-06-28 14:21:15 +02:00
Franck Nijhof 3e85a29b86
Move overlapping pylint rules to ruff, disable mypy overlap (#94359) 2023-06-27 17:42:46 +02:00
Erik Montnemery e9eb366f3b
Improve MQTT image tests (#95359) 2023-06-27 13:53:38 +02:00
Jan Bouwhuis 4d05a3ae79
Add url support for mqtt image platform (#95249)
* Add url support for mqtt image platform

* Refactor url fetch code to use base platform

* Update after rebase

---------

Co-authored-by: Erik <erik@montnemery.com>
2023-06-27 12:49:31 +02:00
Jan Bouwhuis 1029bcbbd3
Add mqtt image platform (#94769)
* Add mqtt image platform

* Follow up comments

* Use separate topics

* Set last_ image to `None` on error

* Fix encoding and schema validation

* Assing None to last_image when get image fails

* Follow up comment

* Remove content_type validation

* Add validation

* Rename options according suggestions

* Remove url_topic / template feature from PR

* Always set content_type
2023-06-26 14:42:24 +02:00
Jan Bouwhuis 3c86497bc8
Improve mqtt climate turn_on and turn_off service (#94832)
* Improve mqtt climate turn_on and turn_off service

* Remove POWER_COMMAND_TOPIC when mode is changed

* Call super
2023-06-22 13:46:14 +02:00
Jan Bouwhuis 31f845bfe0
Add current_humidity attribute to mqtt humidifier (#94955) 2023-06-21 19:19:26 +02:00
Jan Bouwhuis 4def901ecc
Ignore empty status update for mqtt number (#94800) 2023-06-20 23:04:01 +02:00
Erik Montnemery fd822bce56
Replace assert_lists_same with pytest_unordered in integrations h-m (#94901) 2023-06-20 20:16:25 +02:00
Franck Nijhof be05a749c5
Add preheating HVAC action to climate (#94677)
* Add preheating HVAC action to climate

* Fix MQTT tests
2023-06-15 22:16:12 -04:00
Jan Bouwhuis 82b9a31ea7
Improve logging of mqtt discovery message errors (#94491)
* Improve logging on mqtt discovery message errors

* Create shared helper

* Apply suggestion

* Catch base class vol.Invalid
2023-06-12 21:28:28 +02:00
Jan Bouwhuis c756c7aceb
Cleanup help_setup_helper in common mqtt tests (#94482) 2023-06-12 20:18:05 +02: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
hookedonunix 18cbc9b4c3
Add Water Heater platform to MQTT integration (#93644)
* Add Water Heater entity to MQTT

* Adding tests for Water Heater

* Remove duplicate line and unneeded var declaration

* Remove target temp range and away mode

* Move common Temperature Control conf to const

* Remove unnecessary platform schema and temp check

* Add common value template key test

* Use MqttTemperatureControl in Water Heater

* Move operation mode out of MqttTemperatureControl

* Remove unecessary attribute declaration

* Remove default min/max temp and auto init attr

* Fix mqtt water heater initial temp conversion

* Make async_set_temperature common

* Fix init temp comment

* Merge value_template_keys into get_with_templates

* Remove unnecessary operation_mode overriding

* Add async_set_temperature to water heater

* Fix docstring comments
2023-06-08 17:38:30 +02:00
Jan Bouwhuis 437de7c2a3
Fix mqtt climate initial temperature conversion and precision (#93965)
* Fix mqtt climate initial temperature conversion

* Avoid changing hass temperature_unit

* Update comment
2023-06-05 17:02:31 +02:00
Jan Bouwhuis 661aedde90
Remove MQTT platform schema warnings (#93785) 2023-05-31 09:02:48 +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 c44a7fe358
Do not trigger reload when unloading or reloading MQTT entry (#93588)
* Do not trigger reload when unloading MQTT entry

* More cleanup

* cleanup async_reload_manual_mqtt_items

* Add test

* Improve test

* Remove unuse mocks from test

* Add discovery item in test
2023-05-29 15:44:09 +02:00
Jan Bouwhuis d852ba8b09
Remove redundant stub_blueprint_populate fixture for MQTT integration (#93570)
Remove redundant stub_blueprint_populate fixture
2023-05-26 08:13:45 +02:00
Jan Bouwhuis ec98e22330
Add type hints for stub_blueprint_populate fixture (#93568)
Add typehints for stub_blueprint_populate fixture
2023-05-26 08:13:13 +02:00
Erik Montnemery 3cca338c6e
Improve blueprint test fixtures (#93519) 2023-05-25 13:45:19 +02:00
Jan Bouwhuis a81fe517c1
Make mqtt device_tracker state_topic optional when json_attribute_topic is used (#93322)
* Make device_tracker state_topic optional

* No state_topic needed
2023-05-22 15:49:18 +02:00
Jan Bouwhuis a05c20a498
Filter replaying unrelated retained MQTT messages when subscribing to share topics (#88826)
* Do not replay already processed retained subscr.

* Add tests

* Always replay wildcards

* Update tests for debouncer

* Rework for retained topics

* Fix test

* Correct comment

* Add cleanup and test

* Fix key error

* Correct helper

* Rename mock

* Add comment on function _retained_init

* Always replay initial retained payload

* Apply suggestion moving msg.retain to outer check

* Improve test on edge case

* Improve comment formatting

* Follow up comment - improve comments on test

* Update homeassistant/components/mqtt/client.py

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

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-05-12 15:23:05 +02:00
Jan Bouwhuis 25549eed85
Debounce and group mqtt unsubscribes (#92201)
* Debounce MQTT unsubscribes and merge to one call

* Make _async_unsubscribe a callback

* Make sure unsubscribes are processed

* Move debug log out of lock

* Reduce calls and raise outside lock

* Cancel any unsubscribe when queing

* Copy pending unsubscribes

* Only convert topics to list once

* No copy needed

* Typo in comment
2023-05-09 16:36:19 +02:00
Jan Bouwhuis 689c6fbef7
Merge pending MQTT subscribes to a single call to the paho client (#92172)
* Merge mqtt subscribes in one call

* Cleanup

* cleanup, log outside of lock

* Remove function wrapper

* Add test that we bundle subscriptions
2023-05-08 15:37:25 +02:00
Jan Bouwhuis cff7829a8d
Fix mqtt subscribe debouncer initial delay too long when birth message is disabled (#92188)
Fix mqtt subscribe deboucer initial delay
2023-04-28 18:56:22 +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
rubenbe 2f1a5942ab
Add MQTT fan direction support (#91700)
* Add MQTT fan direction support

* Add MQTT fan direction abbreviations

* Add MQTT fan direction tests

* Shorten MQTT fan test payloads
2023-04-24 11:48:00 +02:00
Jan Bouwhuis 9197316b57
Add tests mqtt light with single supported color_mode (#91811) 2023-04-22 13:55:43 +02:00
Jan Bouwhuis 0bcda9fe9c
Make sure MQTT client is available when starting depending platforms (#91164)
* Make sure MQTT is available starting mqtt_json

* Wait for mqtt client

* Sync client connect

* Simplify

* Addiitional tests async_wait_for_mqtt_client

* Improve comment waiting for mqtt

* Improve docstr

* Do not wait unless the MQTT client is in setup

* Handle entry errors during setup

* More comments - do not clear event

* Add snips and mqtt_room

* Add manual_mqtt

* Update homeassistant/components/mqtt/__init__.py

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

* Use a fixture, improve tests

* Simplify

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2023-04-20 08:07:35 +02:00
Jan Bouwhuis 4132f08146
Remove check on remove deprecated call back for mqtt subscribe (#91464)
Remove check on deprecated callback wrapper
2023-04-18 16:02:24 +02:00
Jan Bouwhuis f37b1fc9f8
Improve tests subscribe connection for mqtt status (#91463)
Improve test_subscribe_connection_status
2023-04-15 15:29:31 -04:00
Jan Bouwhuis fc8c5f1bbd
Do not allow mqtt lights to set brightness to zero (#91296)
* Do not allow mqtt lights to set brightness to zero

* Loglevel to debug

* Typo
2023-04-14 09:01:29 +02: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 aa68d1d617
Cleanup mqtt CONFIG_SCHEMA_ENTRY (#90791) 2023-04-11 17:41:38 +02:00