Add device info to Hydrawise (#100828)
* Add device info to Hydrawise * Apply suggestions from code review Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Remove _attr_has_entity_name --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
parent
7b1b189f3e
commit
8ba6fd7935
6 changed files with 143 additions and 9 deletions
36
tests/components/hydrawise/test_device.py
Normal file
36
tests/components/hydrawise/test_device.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
"""Tests for Hydrawise devices."""
|
||||
|
||||
from unittest.mock import Mock
|
||||
|
||||
from homeassistant.components.hydrawise.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
||||
|
||||
def test_zones_in_device_registry(
|
||||
hass: HomeAssistant, mock_added_config_entry: ConfigEntry, mock_pydrawise: Mock
|
||||
) -> None:
|
||||
"""Test that devices are added to the device registry."""
|
||||
device_registry = dr.async_get(hass)
|
||||
|
||||
device1 = device_registry.async_get_device(identifiers={(DOMAIN, "5965394")})
|
||||
assert device1 is not None
|
||||
assert device1.name == "Zone One"
|
||||
assert device1.manufacturer == "Hydrawise"
|
||||
|
||||
device2 = device_registry.async_get_device(identifiers={(DOMAIN, "5965395")})
|
||||
assert device2 is not None
|
||||
assert device2.name == "Zone Two"
|
||||
assert device2.manufacturer == "Hydrawise"
|
||||
|
||||
|
||||
def test_controller_in_device_registry(
|
||||
hass: HomeAssistant, mock_added_config_entry: ConfigEntry, mock_pydrawise: Mock
|
||||
) -> None:
|
||||
"""Test that devices are added to the device registry."""
|
||||
device_registry = dr.async_get(hass)
|
||||
device = device_registry.async_get_device(identifiers={(DOMAIN, "52496")})
|
||||
assert device is not None
|
||||
assert device.name == "Home Controller"
|
||||
assert device.manufacturer == "Hydrawise"
|
Loading…
Add table
Add a link
Reference in a new issue