mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
switchbot_cloud: Add firmware information (#143693)
This commit is contained in:
parent
d924f0b1d6
commit
bdd9099294
@ -29,11 +29,15 @@ class SwitchBotCloudEntity(CoordinatorEntity[SwitchBotCoordinator]):
|
||||
super().__init__(coordinator)
|
||||
self._api = api
|
||||
self._attr_unique_id = device.device_id
|
||||
_sw_version = None
|
||||
if self.coordinator.data is not None:
|
||||
_sw_version = self.coordinator.data.get("version")
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, device.device_id)},
|
||||
name=device.device_name,
|
||||
manufacturer="SwitchBot",
|
||||
model=device.device_type,
|
||||
sw_version=_sw_version,
|
||||
)
|
||||
|
||||
async def send_api_command(
|
||||
|
@ -19,6 +19,7 @@ async def test_pressmode_bot(
|
||||
"""Test press."""
|
||||
mock_list_devices.return_value = [
|
||||
Device(
|
||||
version="V1.0",
|
||||
deviceId="bot-id-1",
|
||||
deviceName="bot-1",
|
||||
deviceType="Bot",
|
||||
@ -51,6 +52,7 @@ async def test_switchmode_bot_no_button_entity(
|
||||
"""Test a switchMode bot isn't added as a button."""
|
||||
mock_list_devices.return_value = [
|
||||
Device(
|
||||
version="V1.0",
|
||||
deviceId="bot-id-1",
|
||||
deviceName="bot-1",
|
||||
deviceType="Bot",
|
||||
|
@ -33,30 +33,35 @@ async def test_setup_entry_success(
|
||||
"""Test successful setup of entry."""
|
||||
mock_list_devices.return_value = [
|
||||
Remote(
|
||||
version="V1.0",
|
||||
deviceId="air-conditonner-id-1",
|
||||
deviceName="air-conditonner-name-1",
|
||||
remoteType="Air Conditioner",
|
||||
hubDeviceId="test-hub-id",
|
||||
),
|
||||
Device(
|
||||
version="V1.0",
|
||||
deviceId="plug-id-1",
|
||||
deviceName="plug-name-1",
|
||||
deviceType="Plug",
|
||||
hubDeviceId="test-hub-id",
|
||||
),
|
||||
Remote(
|
||||
version="V1.0",
|
||||
deviceId="plug-id-2",
|
||||
deviceName="plug-name-2",
|
||||
remoteType="DIY Plug",
|
||||
hubDeviceId="test-hub-id",
|
||||
),
|
||||
Remote(
|
||||
version="V1.0",
|
||||
deviceId="meter-pro-1",
|
||||
deviceName="meter-pro-name-1",
|
||||
deviceType="MeterPro(CO2)",
|
||||
hubDeviceId="test-hub-id",
|
||||
),
|
||||
Remote(
|
||||
version="V1.0",
|
||||
deviceId="hub2-1",
|
||||
deviceName="hub2-name-1",
|
||||
deviceType="Hub 2",
|
||||
@ -104,6 +109,7 @@ async def test_setup_entry_fails_when_refreshing(
|
||||
"""Test error handling in get_status in setup of entry."""
|
||||
mock_list_devices.return_value = [
|
||||
Device(
|
||||
version="V1.0",
|
||||
deviceId="test-id",
|
||||
deviceName="test-name",
|
||||
deviceType="Plug",
|
||||
|
@ -17,6 +17,7 @@ async def test_lock(hass: HomeAssistant, mock_list_devices, mock_get_status) ->
|
||||
"""Test locking and unlocking."""
|
||||
mock_list_devices.return_value = [
|
||||
Device(
|
||||
version="V1.0",
|
||||
deviceId="lock-id-1",
|
||||
deviceName="lock-1",
|
||||
deviceType="Smart Lock",
|
||||
|
@ -26,6 +26,7 @@ async def test_meter(
|
||||
|
||||
mock_list_devices.return_value = [
|
||||
Device(
|
||||
version="V1.0",
|
||||
deviceId="meter-id-1",
|
||||
deviceName="meter-1",
|
||||
deviceType="Meter",
|
||||
@ -50,6 +51,7 @@ async def test_meter_no_coordinator_data(
|
||||
"""Test meter sensors are unknown without coordinator data."""
|
||||
mock_list_devices.return_value = [
|
||||
Device(
|
||||
version="V1.0",
|
||||
deviceId="meter-id-1",
|
||||
deviceName="meter-1",
|
||||
deviceType="Meter",
|
||||
|
@ -25,6 +25,7 @@ async def test_relay_switch(
|
||||
"""Test turn on and turn off."""
|
||||
mock_list_devices.return_value = [
|
||||
Device(
|
||||
version="V1.0",
|
||||
deviceId="relay-switch-id-1",
|
||||
deviceName="relay-switch-1",
|
||||
deviceType="Relay Switch 1",
|
||||
@ -59,6 +60,7 @@ async def test_switchmode_bot(
|
||||
"""Test turn on and turn off."""
|
||||
mock_list_devices.return_value = [
|
||||
Device(
|
||||
version="V1.0",
|
||||
deviceId="bot-id-1",
|
||||
deviceName="bot-1",
|
||||
deviceType="Bot",
|
||||
@ -93,6 +95,7 @@ async def test_pressmode_bot_no_switch_entity(
|
||||
"""Test a pressMode bot isn't added as a switch."""
|
||||
mock_list_devices.return_value = [
|
||||
Device(
|
||||
version="V1.0",
|
||||
deviceId="bot-id-1",
|
||||
deviceName="bot-1",
|
||||
deviceType="Bot",
|
||||
|
Loading…
x
Reference in New Issue
Block a user