Commit graph

86 commits

Author SHA1 Message Date
Franck Nijhof
be05a749c5
Add preheating HVAC action to climate ()
* Add preheating HVAC action to climate

* Fix MQTT tests
2023-06-15 22:16:12 -04:00
hookedonunix
18cbc9b4c3
Add Water Heater platform to MQTT integration ()
* 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 ()
* Fix mqtt climate initial temperature conversion

* Avoid changing hass temperature_unit

* Update comment
2023-06-05 17:02:31 +02:00
Jan Bouwhuis
bb15923968
Rename MQTT entry mock and cleanup ()
Rename to mqtt_mock_entry and cleanup
2023-04-12 09:43:03 +02:00
Jan Bouwhuis
8fd88d6703
Prepare MQTT platform tests part2 ()
* Tests button

* Tests camera

* Tests climate
2023-03-23 19:13:36 +01:00
Jan Bouwhuis
d865440012
Prepare MQTT common tests part3 () 2023-03-21 09:19:20 +01:00
Jan Bouwhuis
fe49861e26
Prepare MQTT common tests part4 ()
* 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) ()
* 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
Jan Bouwhuis
c81a38effb
Mqtt prepare test base part1 ()
* 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
03e9dff327
Allow resetting MQTT climate attributes and ignore empty values ()
Allow reseting MQTT climate attributes
2023-02-15 16:31:49 +01:00
Franck Nijhof
ed79265843
Enable Ruff PT006 ()
* 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 ()
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 ()
* 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 ()
Add hass and `None` return type on MQTT tests
2023-02-08 18:08:03 +01:00
Franck Nijhof
e50a531cd9
Code styling tweaks to the tests - Part 2 ()
Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
2023-01-26 01:23:53 +01:00
Jan Bouwhuis
64e235285d
Deprecate power_command_topic for MQTT climate ()
* Deprecate mode_command_topic for MQTT climate

* Correct deprecation and remove support release inf

* Do not use future tense for comment

* Extend deprecation period to 6 months
2023-01-12 09:49:14 +01:00
Jan Bouwhuis
b29c96639b
Correct initial config of MQTT climate ()
* Do not reset MQTT climate state on re-config

* More corrections

* Correct startup behavior in optimistic mode
2023-01-04 10:29:02 +01:00
Mike K
799d527fb5
Add MQTT climate setting for current humidity ()
* MQTT Climate: Add support for setting the current humidity via MQTT

* MQTT Climate: Add configuration constants related to setting the target humidity

* MQTT Climate: Add support for setting the humidity's state topic & template

* MQTT Climate: Add support for setting the initial humidity

* MQTT Climate: Add support for setting the humidity's command topic & template

* MQTT Climate: Add support for setting the min/max humidity

* MQTT Climate: Fix style & tests

* MQTT Climate: Set the initial humidity to None

* MQTT Climate: Rename _set_mqtt_attribute to _set_climate_attribute and handle_temperature_received to handle_climate_attribute_received

* MQTT Climate: Copy humidity range validation from MQTT Humidifier

* MQTT Climate: Remove CONF_HUMIDITY_INITIAL

* MQTT Climate: Only enable support for TARGET_HUMIDITY when the command topic is set

* MQTT Climate: Check if setting the target humidity is supported before actually setting it

* MQTT Climate: Make sure that CONF_HUMIDITY_COMMAND_TOPIC has been configured when setting CONF_HUMIDITY_STATE_TOPIC

* MQTT Climate: Fix broken tests

* MQTT Climate: Add test for optimistically setting the target humidity

* MQTT Climate: Remove references to "temperature" in handle_climate_attribute_received

* MQTT Climate: Add additional humidity-related tests

* MQTT Climate: Remove supported feature check in handle_target_humidity_received

It's not needed because this is covered by the `valid_humidity_state_configuration` validation.

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

* MQTT Climate: Remove supported feature check in async_set_humidity

It is covered by the base Climate entity.

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

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2023-01-03 22:57:20 +01:00
Jan Bouwhuis
9cf86b234b
Add optimistic option for MQTT climate () 2023-01-02 11:39:42 +01:00
Jan Bouwhuis
ee66ffc8de
Do not depend MQTT CI tests on debug logs ()
* 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
4335b0db25
Clean up or correct from removed deprecation for MQTT platform ()
Clean up or correct from removed deprecation
2022-11-25 16:11:22 +01:00
Jan Bouwhuis
7c2e7863d2
Remove legacy YAML support from MQTT () 2022-11-17 22:55:31 +01:00
epenet
0d696b84b2
Cleanup root component imports in tests () 2022-09-21 06:57:41 -10:00
Jan Bouwhuis
9a4c8f5f0e
Refactor common MQTT tests to use modern schema ()
* 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
a4792998a2
Refactor MQTT tests to use modern platform schema part 1 ()
* Tests alarm_control_panel

* Tests binary_sensor

* Tests button

* Tests camera

* Tests Climate + corrections default config

* Tests cover

* Tests device_tracker

* Tests fan

* Tests humidifier

* Fix test_supported_features test fan

* Tests init

* Tests legacy vacuum

* Derive DEFAULT_CONFIG_LEGACY from DEFAULT_CONFIG

* Commit suggestion comment changes
2022-09-06 11:02:15 +02:00
Jan Bouwhuis
161e533c5f
Remove MQTT climate support for hold and away modes ()
Remove support for hold and away modes
2022-08-15 08:27:37 +02:00
Jan Bouwhuis
741efb89d5
Remove deprecated send_if_off option for MQTT climate ()
* Remove `send_if_off` option for mqtt climate

* Use cv.remove()
2022-08-05 13:17:46 +02:00
Jan Bouwhuis
5930f056a8
Mqtt support config_entry unload ()
* 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 ()
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 ()
simplify test setup manual mqtt item from yaml
2022-06-13 13:44:12 +02:00
Jan Bouwhuis
52561ce076
Update MQTT tests to use the config entry setup ()
* 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
e8664ce1ae
Move manual configuration of MQTT climate to the integration key ()
Add climate

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-05-22 11:28:10 +02:00
epenet
1be2438ef6
Use climate enums in mqtt () 2022-05-09 08:15:11 +02:00
Franck Nijhof
bfc82b030f
Replace Climate CURRENT_HVAC_* constants with HVACAction enum () 2022-04-20 13:41:05 -07:00
Franck Nijhof
a22f36178f
Replace Climate HVAC_MODE_* constants with HVACMode enum ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-04-20 13:20:53 +02:00
Jan Bouwhuis
98adeb6070
Fix false positive MQTT climate deprecation warnings for defaults ()
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-03-07 15:38:33 +01:00
Jan Bouwhuis
83846bb5cc
MQTT climate preset_modes rework ()
* MQTT climate preset_modes rework

* Set deprection date to 2022.9 (6 months)

* add valid_preset_mode_configuration for discovery

* Update deprecation date
2022-02-17 13:51:35 +01:00
Erik Montnemery
fe38e6ba87
Drop MQTT import flow ()
* 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 () 2022-02-04 17:35:32 +01:00
Jan Bouwhuis
0cabf3e577
Fix MQTT climate action null warnings () 2022-01-27 08:41:27 +01:00
Jan Bouwhuis
aa73e5bd72
Fix MQTT climate optimistic preset modes ()
* Always publish when preset_mode is set

* Revert "Fixed isort error"

This reverts commit 1a3c5e6460.

* isort
2022-01-11 17:08:26 +01:00
Jan Bouwhuis
dd0193052c
Add MQTT encoding parameter for all subscribed topics ()
* Add encoding parameter for all subscribable topics

* test setup encoding incoming payload

* remove support for device_tracker and tag+tests
2022-01-03 16:08:07 +01:00
Jan Bouwhuis
061ce0c187
Fix mqtt reloading and rework tests ()
* Improve mqtt reloading/tests and fix issues

* Cleanup fixture for reloading test

* isort and black remove replaced test_reloadable
2022-01-03 15:14:50 +01:00
Jan Bouwhuis
d0c4f0fec4
Add mqtt encoding support for publishing ()
* encoding support for mqtt publishing - todo tests

* signature allows None values for qos and retain

* common test for mqtt publishing encoding

* better test with command templates

* more tests

* fix tests alarm control panel+tests light basic

* tests light json and template

* add tests vacuum and fix tests light_template
2022-01-03 09:03:47 +01:00
Till Skrodzki
635d875b1d
Only accept valid hvac actions sent via mqtt ()
* Only accept valid hvac actions sent via mqtt

* Only accept valid hvac actions sent via mqtt

* Fix existing action test and remove old one

* Remote None as valid hvac action being accepted

* Change loglevel of wrong hvac action received
2021-11-25 15:53:34 +01:00
Erik Montnemery
640a7fee9d
Allow extra keys in MQTT discovery messages ()
* Allow extra keys in MQTT discovery messages

* Remove extra keys
2021-10-25 13:47:06 +02:00
Erik Montnemery
040c88f982
Filter MQTT climate JSON attributes () 2021-06-29 11:13:58 +02:00
radovanbauer
baab9b9a81
Added command templates for the mqtt climate component. ()
This allows integrating with devices which require more complex payloads to be posted when updating their values.

Old feature request: https://github.com/home-assistant/core/issues/11496
There are numerous posts requesting this feature, example: https://community.home-assistant.io/t/need-help-with-value-template-for-mqtt-hvac/73395/68https://community.home-assistant.io/t/need-help-with-value-template-for-mqtt-hvac/73395/68

Command templates have been added for the following:
- fan_mode
- hold
- mode
- swing_mode
- temperature
- temperature high/low

This doesn't add templates for aux, away mode, power since these already accept custom payload_on/off (although they all share the same payload). It should be straightforward to add templates for them as well if needed.
2021-01-26 16:12:33 +01:00
Franck Nijhof
65cf2fcb6f
Drop asynctest () 2021-01-01 22:31:56 +01:00
Philip Allgaier
18736dbebf
Bump voluptuous to 0.12.1 ()
* Bump voluptuous to 0.12.1

* Adjust MQTT climate test to new error msg
2020-12-07 02:49:36 +01:00