Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions homeassistant/components/smartthings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,11 @@ def device_info(self) -> DeviceInfo:
return DeviceInfo(
configuration_url="https://account.smartthings.com",
identifiers={(DOMAIN, self._device.device_id)},
manufacturer="Unavailable",
model=self._device.device_type_name,
manufacturer=self._device.status.ocf_manufacturer_name,
model=self._device.status.ocf_model_number,
name=self._device.label,
hw_version=self._device.status.ocf_hardware_version,
sw_version=self._device.status.ocf_firmware_version,
)

@property
Expand Down
16 changes: 13 additions & 3 deletions tests/components/smartthings/test_binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ async def test_entity_and_device_attributes(
"""Test the attributes of the entity are correct."""
# Arrange
device = device_factory(
"Motion Sensor 1", [Capability.motion_sensor], {Attribute.motion: "inactive"}
"Motion Sensor 1",
[Capability.motion_sensor],
{
Attribute.motion: "inactive",
Attribute.mnmo: "123",
Attribute.mnmn: "Generic manufacturer",
Attribute.mnhw: "v4.56",
Attribute.mnfv: "v7.89",
},
)
entity_registry = er.async_get(hass)
device_registry = dr.async_get(hass)
Expand All @@ -66,8 +74,10 @@ async def test_entity_and_device_attributes(
assert entry.configuration_url == "https://account.smartthings.com"
assert entry.identifiers == {(DOMAIN, device.device_id)}
assert entry.name == device.label
assert entry.model == device.device_type_name
assert entry.manufacturer == "Unavailable"
assert entry.model == "123"
assert entry.manufacturer == "Generic manufacturer"
assert entry.hw_version == "v4.56"
assert entry.sw_version == "v7.89"


async def test_update_from_signal(hass: HomeAssistant, device_factory) -> None:
Expand Down
10 changes: 8 additions & 2 deletions tests/components/smartthings/test_climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ def thermostat_fixture(device_factory):
],
Attribute.thermostat_operating_state: "idle",
Attribute.humidity: 34,
Attribute.mnmo: "123",
Attribute.mnmn: "Generic manufacturer",
Attribute.mnhw: "v4.56",
Attribute.mnfv: "v7.89",
},
)
device.status.attributes[Attribute.temperature] = Status(70, "F", None)
Expand Down Expand Up @@ -581,5 +585,7 @@ async def test_entity_and_device_attributes(hass: HomeAssistant, thermostat) ->
assert entry.configuration_url == "https://account.smartthings.com"
assert entry.identifiers == {(DOMAIN, thermostat.device_id)}
assert entry.name == thermostat.label
assert entry.model == thermostat.device_type_name
assert entry.manufacturer == "Unavailable"
assert entry.model == "123"
assert entry.manufacturer == "Generic manufacturer"
assert entry.hw_version == "v4.56"
assert entry.sw_version == "v7.89"
16 changes: 13 additions & 3 deletions tests/components/smartthings/test_cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ async def test_entity_and_device_attributes(
"""Test the attributes of the entity are correct."""
# Arrange
device = device_factory(
"Garage", [Capability.garage_door_control], {Attribute.door: "open"}
"Garage",
[Capability.garage_door_control],
{
Attribute.door: "open",
Attribute.mnmo: "123",
Attribute.mnmn: "Generic manufacturer",
Attribute.mnhw: "v4.56",
Attribute.mnfv: "v7.89",
},
)
entity_registry = er.async_get(hass)
device_registry = dr.async_get(hass)
Expand All @@ -49,8 +57,10 @@ async def test_entity_and_device_attributes(
assert entry.configuration_url == "https://account.smartthings.com"
assert entry.identifiers == {(DOMAIN, device.device_id)}
assert entry.name == device.label
assert entry.model == device.device_type_name
assert entry.manufacturer == "Unavailable"
assert entry.model == "123"
assert entry.manufacturer == "Generic manufacturer"
assert entry.hw_version == "v4.56"
assert entry.sw_version == "v7.89"


async def test_open(hass: HomeAssistant, device_factory) -> None:
Expand Down
15 changes: 12 additions & 3 deletions tests/components/smartthings/test_fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ async def test_entity_and_device_attributes(
device = device_factory(
"Fan 1",
capabilities=[Capability.switch, Capability.fan_speed],
status={Attribute.switch: "on", Attribute.fan_speed: 2},
status={
Attribute.switch: "on",
Attribute.fan_speed: 2,
Attribute.mnmo: "123",
Attribute.mnmn: "Generic manufacturer",
Attribute.mnhw: "v4.56",
Attribute.mnfv: "v7.89",
},
)
# Act
await setup_platform(hass, FAN_DOMAIN, devices=[device])
Expand All @@ -64,8 +71,10 @@ async def test_entity_and_device_attributes(
assert entry.configuration_url == "https://account.smartthings.com"
assert entry.identifiers == {(DOMAIN, device.device_id)}
assert entry.name == device.label
assert entry.model == device.device_type_name
assert entry.manufacturer == "Unavailable"
assert entry.model == "123"
assert entry.manufacturer == "Generic manufacturer"
assert entry.hw_version == "v4.56"
assert entry.sw_version == "v7.89"


async def test_turn_off(hass: HomeAssistant, device_factory) -> None:
Expand Down
17 changes: 14 additions & 3 deletions tests/components/smartthings/test_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,16 @@ async def test_entity_and_device_attributes(
) -> None:
"""Test the attributes of the entity are correct."""
# Arrange
device = device_factory("Light 1", [Capability.switch, Capability.switch_level])
device = device_factory(
"Light 1",
[Capability.switch, Capability.switch_level],
{
Attribute.mnmo: "123",
Attribute.mnmn: "Generic manufacturer",
Attribute.mnhw: "v4.56",
Attribute.mnfv: "v7.89",
},
)
entity_registry = er.async_get(hass)
device_registry = dr.async_get(hass)
# Act
Expand All @@ -124,8 +133,10 @@ async def test_entity_and_device_attributes(
assert entry.configuration_url == "https://account.smartthings.com"
assert entry.identifiers == {(DOMAIN, device.device_id)}
assert entry.name == device.label
assert entry.model == device.device_type_name
assert entry.manufacturer == "Unavailable"
assert entry.model == "123"
assert entry.manufacturer == "Generic manufacturer"
assert entry.hw_version == "v4.56"
assert entry.sw_version == "v7.89"


async def test_turn_off(hass: HomeAssistant, light_devices) -> None:
Expand Down
18 changes: 15 additions & 3 deletions tests/components/smartthings/test_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@ async def test_entity_and_device_attributes(
) -> None:
"""Test the attributes of the entity are correct."""
# Arrange
device = device_factory("Lock_1", [Capability.lock], {Attribute.lock: "unlocked"})
device = device_factory(
"Lock_1",
[Capability.lock],
{
Attribute.lock: "unlocked",
Attribute.mnmo: "123",
Attribute.mnmn: "Generic manufacturer",
Attribute.mnhw: "v4.56",
Attribute.mnfv: "v7.89",
},
)
entity_registry = er.async_get(hass)
device_registry = dr.async_get(hass)
# Act
Expand All @@ -37,8 +47,10 @@ async def test_entity_and_device_attributes(
assert entry.configuration_url == "https://account.smartthings.com"
assert entry.identifiers == {(DOMAIN, device.device_id)}
assert entry.name == device.label
assert entry.model == device.device_type_name
assert entry.manufacturer == "Unavailable"
assert entry.model == "123"
assert entry.manufacturer == "Generic manufacturer"
assert entry.hw_version == "v4.56"
assert entry.sw_version == "v7.89"


async def test_lock(hass: HomeAssistant, device_factory) -> None:
Expand Down
72 changes: 56 additions & 16 deletions tests/components/smartthings/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,17 @@ async def test_entity_and_device_attributes(
) -> None:
"""Test the attributes of the entity are correct."""
# Arrange
device = device_factory("Sensor 1", [Capability.battery], {Attribute.battery: 100})
device = device_factory(
"Sensor 1",
[Capability.battery],
{
Attribute.battery: 100,
Attribute.mnmo: "123",
Attribute.mnmn: "Generic manufacturer",
Attribute.mnhw: "v4.56",
Attribute.mnfv: "v7.89",
},
)
entity_registry = er.async_get(hass)
device_registry = dr.async_get(hass)
# Act
Expand All @@ -105,8 +115,10 @@ async def test_entity_and_device_attributes(
assert entry.configuration_url == "https://account.smartthings.com"
assert entry.identifiers == {(DOMAIN, device.device_id)}
assert entry.name == device.label
assert entry.model == device.device_type_name
assert entry.manufacturer == "Unavailable"
assert entry.model == "123"
assert entry.manufacturer == "Generic manufacturer"
assert entry.hw_version == "v4.56"
assert entry.sw_version == "v7.89"


async def test_energy_sensors_for_switch_device(
Expand All @@ -117,7 +129,15 @@ async def test_energy_sensors_for_switch_device(
device = device_factory(
"Switch_1",
[Capability.switch, Capability.power_meter, Capability.energy_meter],
{Attribute.switch: "off", Attribute.power: 355, Attribute.energy: 11.422},
{
Attribute.switch: "off",
Attribute.power: 355,
Attribute.energy: 11.422,
Attribute.mnmo: "123",
Attribute.mnmn: "Generic manufacturer",
Attribute.mnhw: "v4.56",
Attribute.mnfv: "v7.89",
},
)
entity_registry = er.async_get(hass)
device_registry = dr.async_get(hass)
Expand All @@ -136,8 +156,10 @@ async def test_energy_sensors_for_switch_device(
assert entry.configuration_url == "https://account.smartthings.com"
assert entry.identifiers == {(DOMAIN, device.device_id)}
assert entry.name == device.label
assert entry.model == device.device_type_name
assert entry.manufacturer == "Unavailable"
assert entry.model == "123"
assert entry.manufacturer == "Generic manufacturer"
assert entry.hw_version == "v4.56"
assert entry.sw_version == "v7.89"

state = hass.states.get("sensor.switch_1_power_meter")
assert state
Expand All @@ -151,8 +173,10 @@ async def test_energy_sensors_for_switch_device(
assert entry.configuration_url == "https://account.smartthings.com"
assert entry.identifiers == {(DOMAIN, device.device_id)}
assert entry.name == device.label
assert entry.model == device.device_type_name
assert entry.manufacturer == "Unavailable"
assert entry.model == "123"
assert entry.manufacturer == "Generic manufacturer"
assert entry.hw_version == "v4.56"
assert entry.sw_version == "v7.89"


async def test_power_consumption_sensor(hass: HomeAssistant, device_factory) -> None:
Expand All @@ -171,7 +195,11 @@ async def test_power_consumption_sensor(hass: HomeAssistant, device_factory) ->
"energySaved": 0,
"start": "2021-07-30T16:45:25Z",
"end": "2021-07-30T16:58:33Z",
}
},
Attribute.mnmo: "123",
Attribute.mnmn: "Generic manufacturer",
Attribute.mnhw: "v4.56",
Attribute.mnfv: "v7.89",
},
)
entity_registry = er.async_get(hass)
Expand All @@ -190,8 +218,10 @@ async def test_power_consumption_sensor(hass: HomeAssistant, device_factory) ->
assert entry.configuration_url == "https://account.smartthings.com"
assert entry.identifiers == {(DOMAIN, device.device_id)}
assert entry.name == device.label
assert entry.model == device.device_type_name
assert entry.manufacturer == "Unavailable"
assert entry.model == "123"
assert entry.manufacturer == "Generic manufacturer"
assert entry.hw_version == "v4.56"
assert entry.sw_version == "v7.89"

state = hass.states.get("sensor.refrigerator_power")
assert state
Expand All @@ -206,13 +236,21 @@ async def test_power_consumption_sensor(hass: HomeAssistant, device_factory) ->
assert entry.configuration_url == "https://account.smartthings.com"
assert entry.identifiers == {(DOMAIN, device.device_id)}
assert entry.name == device.label
assert entry.model == device.device_type_name
assert entry.manufacturer == "Unavailable"
assert entry.model == "123"
assert entry.manufacturer == "Generic manufacturer"
assert entry.hw_version == "v4.56"
assert entry.sw_version == "v7.89"

device = device_factory(
"vacuum",
[Capability.power_consumption_report],
{Attribute.power_consumption: {}},
{
Attribute.power_consumption: {},
Attribute.mnmo: "123",
Attribute.mnmn: "Generic manufacturer",
Attribute.mnhw: "v4.56",
Attribute.mnfv: "v7.89",
},
)
entity_registry = er.async_get(hass)
device_registry = dr.async_get(hass)
Expand All @@ -230,8 +268,10 @@ async def test_power_consumption_sensor(hass: HomeAssistant, device_factory) ->
assert entry.configuration_url == "https://account.smartthings.com"
assert entry.identifiers == {(DOMAIN, device.device_id)}
assert entry.name == device.label
assert entry.model == device.device_type_name
assert entry.manufacturer == "Unavailable"
assert entry.model == "123"
assert entry.manufacturer == "Generic manufacturer"
assert entry.hw_version == "v4.56"
assert entry.sw_version == "v7.89"


async def test_update_from_signal(hass: HomeAssistant, device_factory) -> None:
Expand Down
18 changes: 15 additions & 3 deletions tests/components/smartthings/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@ async def test_entity_and_device_attributes(
) -> None:
"""Test the attributes of the entity are correct."""
# Arrange
device = device_factory("Switch_1", [Capability.switch], {Attribute.switch: "on"})
device = device_factory(
"Switch_1",
[Capability.switch],
{
Attribute.switch: "on",
Attribute.mnmo: "123",
Attribute.mnmn: "Generic manufacturer",
Attribute.mnhw: "v4.56",
Attribute.mnfv: "v7.89",
},
)
entity_registry = er.async_get(hass)
device_registry = dr.async_get(hass)
# Act
Expand All @@ -36,8 +46,10 @@ async def test_entity_and_device_attributes(
assert entry.configuration_url == "https://account.smartthings.com"
assert entry.identifiers == {(DOMAIN, device.device_id)}
assert entry.name == device.label
assert entry.model == device.device_type_name
assert entry.manufacturer == "Unavailable"
assert entry.model == "123"
assert entry.manufacturer == "Generic manufacturer"
assert entry.hw_version == "v4.56"
assert entry.sw_version == "v7.89"


async def test_turn_off(hass: HomeAssistant, device_factory) -> None:
Expand Down