1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add suggested_area to MQTT discovery (#47903)

* Add suggested_area to MQTT Discovery

This adds suggested_area to MQTT discovery, so that the discovered devices could be automatically added to the proper area.

* Add abbreviation for MQTT suggested_area

* Remove extra whitespace

* Remove extra whitespace #2

* Added tests for MQTT Dicovery of suggested_area

* Fix test for MQTT suggested_area

* Better tests of MQTT suggested_area

Changes made as per feedback from @emontnemery
This commit is contained in:
RadekHvizdos
2021-03-15 20:02:02 +01:00
committed by GitHub
parent 07c197687f
commit 9f4c2f6260
4 changed files with 12 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ DEFAULT_CONFIG_DEVICE_INFO_ID = {
"name": "Beer",
"model": "Glass",
"sw_version": "0.1-beta",
"suggested_area": "default_area",
}
DEFAULT_CONFIG_DEVICE_INFO_MAC = {
@@ -28,6 +29,7 @@ DEFAULT_CONFIG_DEVICE_INFO_MAC = {
"name": "Beer",
"model": "Glass",
"sw_version": "0.1-beta",
"suggested_area": "default_area",
}
@@ -739,6 +741,7 @@ async def help_test_entity_device_info_with_identifier(hass, mqtt_mock, domain,
assert device.name == "Beer"
assert device.model == "Glass"
assert device.sw_version == "0.1-beta"
assert device.suggested_area == "default_area"
async def help_test_entity_device_info_with_connection(hass, mqtt_mock, domain, config):
@@ -764,6 +767,7 @@ async def help_test_entity_device_info_with_connection(hass, mqtt_mock, domain,
assert device.name == "Beer"
assert device.model == "Glass"
assert device.sw_version == "0.1-beta"
assert device.suggested_area == "default_area"
async def help_test_entity_device_info_remove(hass, mqtt_mock, domain, config):