Use DeviceInfo in spider (#58575)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
3e4d388491
commit
b175f424d6
3 changed files with 28 additions and 26 deletions
|
@ -8,6 +8,7 @@ from homeassistant.components.climate.const import (
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
SUPPORT_TARGET_TEMPERATURE,
|
||||||
)
|
)
|
||||||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
|
@ -46,14 +47,14 @@ class SpiderThermostat(ClimateEntity):
|
||||||
self.support_hvac.append(SPIDER_STATE_TO_HA[operation_value])
|
self.support_hvac.append(SPIDER_STATE_TO_HA[operation_value])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return the device_info of the device."""
|
"""Return the device_info of the device."""
|
||||||
return {
|
return DeviceInfo(
|
||||||
"identifiers": {(DOMAIN, self.thermostat.id)},
|
identifiers={(DOMAIN, self.thermostat.id)},
|
||||||
"name": self.thermostat.name,
|
manufacturer=self.thermostat.manufacturer,
|
||||||
"manufacturer": self.thermostat.manufacturer,
|
model=self.thermostat.model,
|
||||||
"model": self.thermostat.model,
|
name=self.thermostat.name,
|
||||||
}
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
|
|
|
@ -42,12 +42,12 @@ class SpiderPowerPlugEnergy(SensorEntity):
|
||||||
@property
|
@property
|
||||||
def device_info(self) -> DeviceInfo:
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return the device_info of the device."""
|
"""Return the device_info of the device."""
|
||||||
return {
|
return DeviceInfo(
|
||||||
"identifiers": {(DOMAIN, self.power_plug.id)},
|
identifiers={(DOMAIN, self.power_plug.id)},
|
||||||
"name": self.power_plug.name,
|
manufacturer=self.power_plug.manufacturer,
|
||||||
"manufacturer": self.power_plug.manufacturer,
|
model=self.power_plug.model,
|
||||||
"model": self.power_plug.model,
|
name=self.power_plug.name,
|
||||||
}
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self) -> str:
|
def unique_id(self) -> str:
|
||||||
|
@ -84,12 +84,12 @@ class SpiderPowerPlugPower(SensorEntity):
|
||||||
@property
|
@property
|
||||||
def device_info(self) -> DeviceInfo:
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return the device_info of the device."""
|
"""Return the device_info of the device."""
|
||||||
return {
|
return DeviceInfo(
|
||||||
"identifiers": {(DOMAIN, self.power_plug.id)},
|
identifiers={(DOMAIN, self.power_plug.id)},
|
||||||
"name": self.power_plug.name,
|
manufacturer=self.power_plug.manufacturer,
|
||||||
"manufacturer": self.power_plug.manufacturer,
|
model=self.power_plug.model,
|
||||||
"model": self.power_plug.model,
|
name=self.power_plug.name,
|
||||||
}
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self) -> str:
|
def unique_id(self) -> str:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
"""Support for Spider switches."""
|
"""Support for Spider switches."""
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
|
@ -24,14 +25,14 @@ class SpiderPowerPlug(SwitchEntity):
|
||||||
self.power_plug = power_plug
|
self.power_plug = power_plug
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return the device_info of the device."""
|
"""Return the device_info of the device."""
|
||||||
return {
|
return DeviceInfo(
|
||||||
"identifiers": {(DOMAIN, self.power_plug.id)},
|
identifiers={(DOMAIN, self.power_plug.id)},
|
||||||
"name": self.power_plug.name,
|
manufacturer=self.power_plug.manufacturer,
|
||||||
"manufacturer": self.power_plug.manufacturer,
|
model=self.power_plug.model,
|
||||||
"model": self.power_plug.model,
|
name=self.power_plug.name,
|
||||||
}
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue