Add entity translations to SmartThings (#139342)

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* Refactor SmartThings

* fix

* fix

* Add AC tests

* Add thermostat tests

* Add cover tests

* Add device tests

* Add light tests

* Add rest of the tests

* Add oauth

* Add oauth tests

* Add oauth tests

* Add oauth tests

* Add oauth tests

* Bump version

* Add rest of the tests

* Finalize

* Finalize

* Finalize

* Finalize

* Finalize

* Finalize

* Finalize

* Finalize

* Finalize

* Finalize

* Iterate over entities instead

* use set

* use const

* uncomment

* fix handler

* Fix device info

* Fix device info

* Fix lib

* Fix lib

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Add fake fan

* Fix

* Add entity translations to SmartThings

* Fix
This commit is contained in:
Joost Lekkerkerker 2025-02-26 15:48:51 +01:00 committed by GitHub
parent 5324f3e542
commit 2826198d5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 1517 additions and 1341 deletions

View File

@ -33,6 +33,7 @@ CAPABILITY_TO_SENSORS: dict[
Capability.ACCELERATION_SENSOR: {
Attribute.ACCELERATION: SmartThingsBinarySensorEntityDescription(
key=Attribute.ACCELERATION,
translation_key="acceleration",
device_class=BinarySensorDeviceClass.MOVING,
is_on_key="active",
)
@ -47,6 +48,7 @@ CAPABILITY_TO_SENSORS: dict[
Capability.FILTER_STATUS: {
Attribute.FILTER_STATUS: SmartThingsBinarySensorEntityDescription(
key=Attribute.FILTER_STATUS,
translation_key="filter_status",
device_class=BinarySensorDeviceClass.PROBLEM,
is_on_key="replace",
)
@ -75,7 +77,7 @@ CAPABILITY_TO_SENSORS: dict[
Capability.TAMPER_ALERT: {
Attribute.TAMPER: SmartThingsBinarySensorEntityDescription(
key=Attribute.TAMPER,
device_class=BinarySensorDeviceClass.PROBLEM,
device_class=BinarySensorDeviceClass.TAMPER,
is_on_key="detected",
entity_category=EntityCategory.DIAGNOSTIC,
)
@ -83,6 +85,7 @@ CAPABILITY_TO_SENSORS: dict[
Capability.VALVE: {
Attribute.VALVE: SmartThingsBinarySensorEntityDescription(
key=Attribute.VALVE,
translation_key="valve",
device_class=BinarySensorDeviceClass.OPENING,
is_on_key="open",
)
@ -133,7 +136,6 @@ class SmartThingsBinarySensor(SmartThingsEntity, BinarySensorEntity):
self._attribute = attribute
self.capability = capability
self.entity_description = entity_description
self._attr_name = f"{device.device.label} {attribute}"
self._attr_unique_id = f"{device.device.device_id}.{attribute}"
@property

View File

@ -135,6 +135,8 @@ async def async_setup_entry(
class SmartThingsThermostat(SmartThingsEntity, ClimateEntity):
"""Define a SmartThings climate entities."""
_attr_name = None
def __init__(self, client: SmartThings, device: FullDevice) -> None:
"""Init the class."""
super().__init__(
@ -322,6 +324,7 @@ class SmartThingsThermostat(SmartThingsEntity, ClimateEntity):
class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity):
"""Define a SmartThings Air Conditioner."""
_attr_name = None
_attr_preset_mode = None
def __init__(self, client: SmartThings, device: FullDevice) -> None:

View File

@ -51,6 +51,7 @@ async def async_setup_entry(
class SmartThingsCover(SmartThingsEntity, CoverEntity):
"""Define a SmartThings cover."""
_attr_name = None
_state: CoverState | None = None
def __init__(

View File

@ -17,6 +17,7 @@ class SmartThingsEntity(Entity):
"""Defines a SmartThings entity."""
_attr_should_poll = False
_attr_has_entity_name = True
def __init__(
self, client: SmartThings, device: FullDevice, capabilities: set[Capability]
@ -30,7 +31,6 @@ class SmartThingsEntity(Entity):
if capability in device.status[MAIN]
}
self.device = device
self._attr_name = device.device.label
self._attr_unique_id = device.device.device_id
self._attr_device_info = DeviceInfo(
configuration_url="https://account.smartthings.com",

View File

@ -48,6 +48,7 @@ async def async_setup_entry(
class SmartThingsFan(SmartThingsEntity, FanEntity):
"""Define a SmartThings Fan."""
_attr_name = None
_attr_speed_count = int_states_in_range(SPEED_RANGE)
def __init__(self, client: SmartThings, device: FullDevice) -> None:

View File

@ -56,6 +56,7 @@ def convert_scale(
class SmartThingsLight(SmartThingsEntity, LightEntity):
"""Define a SmartThings Light."""
_attr_name = None
_attr_supported_color_modes: set[ColorMode]
# SmartThings does not expose this attribute, instead it's

View File

@ -42,6 +42,8 @@ async def async_setup_entry(
class SmartThingsLock(SmartThingsEntity, LockEntity):
"""Define a SmartThings lock."""
_attr_name = None
async def async_lock(self, **kwargs: Any) -> None:
"""Lock the device."""
await self.execute_device_command(

View File

@ -69,7 +69,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.LIGHTING_MODE: [
SmartThingsSensorEntityDescription(
key=Attribute.LIGHTING_MODE,
name="Activity Lighting Mode",
translation_key="lighting_mode",
entity_category=EntityCategory.DIAGNOSTIC,
)
]
@ -78,7 +78,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.AIR_CONDITIONER_MODE: [
SmartThingsSensorEntityDescription(
key=Attribute.AIR_CONDITIONER_MODE,
name="Air Conditioner Mode",
translation_key="air_conditioner_mode",
entity_category=EntityCategory.DIAGNOSTIC,
capability_ignore_list=[
{
@ -93,7 +93,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.AIR_QUALITY: [
SmartThingsSensorEntityDescription(
key=Attribute.AIR_QUALITY,
name="Air Quality",
translation_key="air_quality",
native_unit_of_measurement="CAQI",
state_class=SensorStateClass.MEASUREMENT,
)
@ -103,7 +103,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.ALARM: [
SmartThingsSensorEntityDescription(
key=Attribute.ALARM,
name="Alarm",
translation_key="alarm",
)
]
},
@ -111,7 +111,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.VOLUME: [
SmartThingsSensorEntityDescription(
key=Attribute.VOLUME,
name="Volume",
translation_key="audio_volume",
native_unit_of_measurement=PERCENTAGE,
)
]
@ -120,7 +120,6 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.BATTERY: [
SmartThingsSensorEntityDescription(
key=Attribute.BATTERY,
name="Battery",
native_unit_of_measurement=PERCENTAGE,
device_class=SensorDeviceClass.BATTERY,
entity_category=EntityCategory.DIAGNOSTIC,
@ -132,7 +131,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.BMI_MEASUREMENT: [
SmartThingsSensorEntityDescription(
key=Attribute.BMI_MEASUREMENT,
name="Body Mass Index",
translation_key="body_mass_index",
native_unit_of_measurement=f"{UnitOfMass.KILOGRAMS}/{UnitOfArea.SQUARE_METERS}",
state_class=SensorStateClass.MEASUREMENT,
)
@ -143,7 +142,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.BODY_WEIGHT_MEASUREMENT: [
SmartThingsSensorEntityDescription(
key=Attribute.BODY_WEIGHT_MEASUREMENT,
name="Body Weight",
translation_key="body_weight",
native_unit_of_measurement=UnitOfMass.KILOGRAMS,
device_class=SensorDeviceClass.WEIGHT,
state_class=SensorStateClass.MEASUREMENT,
@ -155,7 +154,6 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.CARBON_DIOXIDE: [
SmartThingsSensorEntityDescription(
key=Attribute.CARBON_DIOXIDE,
name="Carbon Dioxide",
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
device_class=SensorDeviceClass.CO2,
state_class=SensorStateClass.MEASUREMENT,
@ -167,7 +165,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.CARBON_MONOXIDE: [
SmartThingsSensorEntityDescription(
key=Attribute.CARBON_MONOXIDE,
name="Carbon Monoxide Detector",
translation_key="carbon_monoxide_detector",
)
]
},
@ -176,7 +174,6 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.CARBON_MONOXIDE_LEVEL: [
SmartThingsSensorEntityDescription(
key=Attribute.CARBON_MONOXIDE_LEVEL,
name="Carbon Monoxide Level",
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
device_class=SensorDeviceClass.CO,
state_class=SensorStateClass.MEASUREMENT,
@ -187,19 +184,19 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.MACHINE_STATE: [
SmartThingsSensorEntityDescription(
key=Attribute.MACHINE_STATE,
name="Dishwasher Machine State",
translation_key="dishwasher_machine_state",
)
],
Attribute.DISHWASHER_JOB_STATE: [
SmartThingsSensorEntityDescription(
key=Attribute.DISHWASHER_JOB_STATE,
name="Dishwasher Job State",
translation_key="dishwasher_job_state",
)
],
Attribute.COMPLETION_TIME: [
SmartThingsSensorEntityDescription(
key=Attribute.COMPLETION_TIME,
name="Dishwasher Completion Time",
translation_key="completion_time",
device_class=SensorDeviceClass.TIMESTAMP,
value_fn=dt_util.parse_datetime,
)
@ -210,7 +207,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.DRYER_MODE: [
SmartThingsSensorEntityDescription(
key=Attribute.DRYER_MODE,
name="Dryer Mode",
translation_key="dryer_mode",
entity_category=EntityCategory.DIAGNOSTIC,
)
]
@ -219,19 +216,19 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.MACHINE_STATE: [
SmartThingsSensorEntityDescription(
key=Attribute.MACHINE_STATE,
name="Dryer Machine State",
translation_key="dryer_machine_state",
)
],
Attribute.DRYER_JOB_STATE: [
SmartThingsSensorEntityDescription(
key=Attribute.DRYER_JOB_STATE,
name="Dryer Job State",
translation_key="dryer_job_state",
)
],
Attribute.COMPLETION_TIME: [
SmartThingsSensorEntityDescription(
key=Attribute.COMPLETION_TIME,
name="Dryer Completion Time",
translation_key="completion_time",
device_class=SensorDeviceClass.TIMESTAMP,
value_fn=dt_util.parse_datetime,
)
@ -241,14 +238,14 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.DUST_LEVEL: [
SmartThingsSensorEntityDescription(
key=Attribute.DUST_LEVEL,
name="Dust Level",
translation_key="dust_level",
state_class=SensorStateClass.MEASUREMENT,
)
],
Attribute.FINE_DUST_LEVEL: [
SmartThingsSensorEntityDescription(
key=Attribute.FINE_DUST_LEVEL,
name="Fine Dust Level",
translation_key="fine_dust_level",
state_class=SensorStateClass.MEASUREMENT,
)
],
@ -257,7 +254,6 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.ENERGY: [
SmartThingsSensorEntityDescription(
key=Attribute.ENERGY,
name="Energy Meter",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
@ -269,7 +265,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.EQUIVALENT_CARBON_DIOXIDE_MEASUREMENT: [
SmartThingsSensorEntityDescription(
key=Attribute.EQUIVALENT_CARBON_DIOXIDE_MEASUREMENT,
name="Equivalent Carbon Dioxide Measurement",
translation_key="equivalent_carbon_dioxide",
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
device_class=SensorDeviceClass.CO2,
state_class=SensorStateClass.MEASUREMENT,
@ -281,7 +277,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.FORMALDEHYDE_LEVEL: [
SmartThingsSensorEntityDescription(
key=Attribute.FORMALDEHYDE_LEVEL,
name="Formaldehyde Measurement",
translation_key="formaldehyde",
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
state_class=SensorStateClass.MEASUREMENT,
)
@ -292,7 +288,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.GAS_METER: [
SmartThingsSensorEntityDescription(
key=Attribute.GAS_METER,
name="Gas Meter",
translation_key="gas_meter",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
@ -301,13 +297,13 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.GAS_METER_CALORIFIC: [
SmartThingsSensorEntityDescription(
key=Attribute.GAS_METER_CALORIFIC,
name="Gas Meter Calorific",
translation_key="gas_meter_calorific",
)
],
Attribute.GAS_METER_TIME: [
SmartThingsSensorEntityDescription(
key=Attribute.GAS_METER_TIME,
name="Gas Meter Time",
translation_key="gas_meter_time",
device_class=SensorDeviceClass.TIMESTAMP,
value_fn=dt_util.parse_datetime,
)
@ -315,7 +311,6 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.GAS_METER_VOLUME: [
SmartThingsSensorEntityDescription(
key=Attribute.GAS_METER_VOLUME,
name="Gas Meter Volume",
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
device_class=SensorDeviceClass.GAS,
state_class=SensorStateClass.MEASUREMENT,
@ -327,7 +322,6 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.ILLUMINANCE: [
SmartThingsSensorEntityDescription(
key=Attribute.ILLUMINANCE,
name="Illuminance",
native_unit_of_measurement=LIGHT_LUX,
device_class=SensorDeviceClass.ILLUMINANCE,
state_class=SensorStateClass.MEASUREMENT,
@ -339,7 +333,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.INFRARED_LEVEL: [
SmartThingsSensorEntityDescription(
key=Attribute.INFRARED_LEVEL,
name="Infrared Level",
translation_key="infrared_level",
native_unit_of_measurement=PERCENTAGE,
state_class=SensorStateClass.MEASUREMENT,
)
@ -349,7 +343,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.INPUT_SOURCE: [
SmartThingsSensorEntityDescription(
key=Attribute.INPUT_SOURCE,
name="Media Input Source",
translation_key="media_input_source",
)
]
},
@ -358,7 +352,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.PLAYBACK_REPEAT_MODE: [
SmartThingsSensorEntityDescription(
key=Attribute.PLAYBACK_REPEAT_MODE,
name="Media Playback Repeat",
translation_key="media_playback_repeat",
)
]
},
@ -367,7 +361,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.PLAYBACK_SHUFFLE: [
SmartThingsSensorEntityDescription(
key=Attribute.PLAYBACK_SHUFFLE,
name="Media Playback Shuffle",
translation_key="media_playback_shuffle",
)
]
},
@ -375,7 +369,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.PLAYBACK_STATUS: [
SmartThingsSensorEntityDescription(
key=Attribute.PLAYBACK_STATUS,
name="Media Playback Status",
translation_key="media_playback_status",
)
]
},
@ -383,7 +377,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.ODOR_LEVEL: [
SmartThingsSensorEntityDescription(
key=Attribute.ODOR_LEVEL,
name="Odor Sensor",
translation_key="odor_sensor",
)
]
},
@ -391,7 +385,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.OVEN_MODE: [
SmartThingsSensorEntityDescription(
key=Attribute.OVEN_MODE,
name="Oven Mode",
translation_key="oven_mode",
entity_category=EntityCategory.DIAGNOSTIC,
)
]
@ -400,19 +394,19 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.MACHINE_STATE: [
SmartThingsSensorEntityDescription(
key=Attribute.MACHINE_STATE,
name="Oven Machine State",
translation_key="oven_machine_state",
)
],
Attribute.OVEN_JOB_STATE: [
SmartThingsSensorEntityDescription(
key=Attribute.OVEN_JOB_STATE,
name="Oven Job State",
translation_key="oven_job_state",
)
],
Attribute.COMPLETION_TIME: [
SmartThingsSensorEntityDescription(
key=Attribute.COMPLETION_TIME,
name="Oven Completion Time",
translation_key="completion_time",
)
],
},
@ -420,7 +414,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.OVEN_SETPOINT: [
SmartThingsSensorEntityDescription(
key=Attribute.OVEN_SETPOINT,
name="Oven Set Point",
translation_key="oven_setpoint",
)
]
},
@ -428,7 +422,6 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.POWER_CONSUMPTION: [
SmartThingsSensorEntityDescription(
key="energy_meter",
name="energy",
state_class=SensorStateClass.TOTAL_INCREASING,
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
@ -436,7 +429,6 @@ CAPABILITY_TO_SENSORS: dict[
),
SmartThingsSensorEntityDescription(
key="power_meter",
name="power",
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.POWER,
native_unit_of_measurement=UnitOfPower.WATT,
@ -445,7 +437,7 @@ CAPABILITY_TO_SENSORS: dict[
),
SmartThingsSensorEntityDescription(
key="deltaEnergy_meter",
name="deltaEnergy",
translation_key="energy_difference",
state_class=SensorStateClass.TOTAL_INCREASING,
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
@ -453,7 +445,7 @@ CAPABILITY_TO_SENSORS: dict[
),
SmartThingsSensorEntityDescription(
key="powerEnergy_meter",
name="powerEnergy",
translation_key="power_energy",
state_class=SensorStateClass.TOTAL_INCREASING,
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
@ -461,7 +453,7 @@ CAPABILITY_TO_SENSORS: dict[
),
SmartThingsSensorEntityDescription(
key="energySaved_meter",
name="energySaved",
translation_key="energy_saved",
state_class=SensorStateClass.TOTAL_INCREASING,
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
@ -473,7 +465,6 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.POWER: [
SmartThingsSensorEntityDescription(
key=Attribute.POWER,
name="Power Meter",
native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
@ -485,7 +476,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.POWER_SOURCE: [
SmartThingsSensorEntityDescription(
key=Attribute.POWER_SOURCE,
name="Power Source",
translation_key="power_source",
entity_category=EntityCategory.DIAGNOSTIC,
)
]
@ -495,7 +486,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.REFRIGERATION_SETPOINT: [
SmartThingsSensorEntityDescription(
key=Attribute.REFRIGERATION_SETPOINT,
name="Refrigeration Setpoint",
translation_key="refrigeration_setpoint",
device_class=SensorDeviceClass.TEMPERATURE,
)
]
@ -504,7 +495,6 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.HUMIDITY: [
SmartThingsSensorEntityDescription(
key=Attribute.HUMIDITY,
name="Relative Humidity Measurement",
native_unit_of_measurement=PERCENTAGE,
device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT,
@ -515,7 +505,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.ROBOT_CLEANER_CLEANING_MODE: [
SmartThingsSensorEntityDescription(
key=Attribute.ROBOT_CLEANER_CLEANING_MODE,
name="Robot Cleaner Cleaning Mode",
translation_key="robot_cleaner_cleaning_mode",
entity_category=EntityCategory.DIAGNOSTIC,
)
],
@ -524,7 +514,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.ROBOT_CLEANER_MOVEMENT: [
SmartThingsSensorEntityDescription(
key=Attribute.ROBOT_CLEANER_MOVEMENT,
name="Robot Cleaner Movement",
translation_key="robot_cleaner_movement",
)
]
},
@ -532,7 +522,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.ROBOT_CLEANER_TURBO_MODE: [
SmartThingsSensorEntityDescription(
key=Attribute.ROBOT_CLEANER_TURBO_MODE,
name="Robot Cleaner Turbo Mode",
translation_key="robot_cleaner_turbo_mode",
entity_category=EntityCategory.DIAGNOSTIC,
)
]
@ -542,7 +532,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.LQI: [
SmartThingsSensorEntityDescription(
key=Attribute.LQI,
name="LQI Signal Strength",
translation_key="link_quality",
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
)
@ -550,7 +540,6 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.RSSI: [
SmartThingsSensorEntityDescription(
key=Attribute.RSSI,
name="RSSI Signal Strength",
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
@ -562,7 +551,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.SMOKE: [
SmartThingsSensorEntityDescription(
key=Attribute.SMOKE,
name="Smoke Detector",
translation_key="smoke_detector",
)
]
},
@ -570,7 +559,6 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.TEMPERATURE: [
SmartThingsSensorEntityDescription(
key=Attribute.TEMPERATURE,
name="Temperature Measurement",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
)
@ -580,7 +568,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.COOLING_SETPOINT: [
SmartThingsSensorEntityDescription(
key=Attribute.COOLING_SETPOINT,
name="Thermostat Cooling Setpoint",
translation_key="thermostat_cooling_setpoint",
device_class=SensorDeviceClass.TEMPERATURE,
capability_ignore_list=[
{
@ -598,7 +586,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.THERMOSTAT_FAN_MODE: [
SmartThingsSensorEntityDescription(
key=Attribute.THERMOSTAT_FAN_MODE,
name="Thermostat Fan Mode",
translation_key="thermostat_fan_mode",
entity_category=EntityCategory.DIAGNOSTIC,
capability_ignore_list=[THERMOSTAT_CAPABILITIES],
)
@ -609,7 +597,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.HEATING_SETPOINT: [
SmartThingsSensorEntityDescription(
key=Attribute.HEATING_SETPOINT,
name="Thermostat Heating Setpoint",
translation_key="thermostat_heating_setpoint",
device_class=SensorDeviceClass.TEMPERATURE,
entity_category=EntityCategory.DIAGNOSTIC,
capability_ignore_list=[THERMOSTAT_CAPABILITIES],
@ -621,7 +609,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.THERMOSTAT_MODE: [
SmartThingsSensorEntityDescription(
key=Attribute.THERMOSTAT_MODE,
name="Thermostat Mode",
translation_key="thermostat_mode",
entity_category=EntityCategory.DIAGNOSTIC,
capability_ignore_list=[THERMOSTAT_CAPABILITIES],
)
@ -632,7 +620,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.THERMOSTAT_OPERATING_STATE: [
SmartThingsSensorEntityDescription(
key=Attribute.THERMOSTAT_OPERATING_STATE,
name="Thermostat Operating State",
translation_key="thermostat_operating_state",
capability_ignore_list=[THERMOSTAT_CAPABILITIES],
)
]
@ -642,7 +630,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.THERMOSTAT_SETPOINT: [
SmartThingsSensorEntityDescription(
key=Attribute.THERMOSTAT_SETPOINT,
name="Thermostat Setpoint",
translation_key="thermostat_setpoint",
device_class=SensorDeviceClass.TEMPERATURE,
entity_category=EntityCategory.DIAGNOSTIC,
)
@ -652,19 +640,19 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.THREE_AXIS: [
SmartThingsSensorEntityDescription(
key="X Coordinate",
name="X Coordinate",
translation_key="x_coordinate",
unique_id_separator=" ",
value_fn=lambda value: value[0],
),
SmartThingsSensorEntityDescription(
key="Y Coordinate",
name="Y Coordinate",
translation_key="y_coordinate",
unique_id_separator=" ",
value_fn=lambda value: value[1],
),
SmartThingsSensorEntityDescription(
key="Z Coordinate",
name="Z Coordinate",
translation_key="z_coordinate",
unique_id_separator=" ",
value_fn=lambda value: value[2],
),
@ -674,13 +662,13 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.TV_CHANNEL: [
SmartThingsSensorEntityDescription(
key=Attribute.TV_CHANNEL,
name="Tv Channel",
translation_key="tv_channel",
)
],
Attribute.TV_CHANNEL_NAME: [
SmartThingsSensorEntityDescription(
key=Attribute.TV_CHANNEL_NAME,
name="Tv Channel Name",
translation_key="tv_channel_name",
)
],
},
@ -689,7 +677,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.TVOC_LEVEL: [
SmartThingsSensorEntityDescription(
key=Attribute.TVOC_LEVEL,
name="Tvoc Measurement",
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS_PARTS,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
state_class=SensorStateClass.MEASUREMENT,
)
@ -700,7 +688,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.ULTRAVIOLET_INDEX: [
SmartThingsSensorEntityDescription(
key=Attribute.ULTRAVIOLET_INDEX,
name="Ultraviolet Index",
translation_key="uv_index",
state_class=SensorStateClass.MEASUREMENT,
)
]
@ -709,7 +697,6 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.VOLTAGE: [
SmartThingsSensorEntityDescription(
key=Attribute.VOLTAGE,
name="Voltage Measurement",
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
)
@ -720,7 +707,7 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.WASHER_MODE: [
SmartThingsSensorEntityDescription(
key=Attribute.WASHER_MODE,
name="Washer Mode",
translation_key="washer_mode",
entity_category=EntityCategory.DIAGNOSTIC,
)
]
@ -729,19 +716,19 @@ CAPABILITY_TO_SENSORS: dict[
Attribute.MACHINE_STATE: [
SmartThingsSensorEntityDescription(
key=Attribute.MACHINE_STATE,
name="Washer Machine State",
translation_key="washer_machine_state",
)
],
Attribute.WASHER_JOB_STATE: [
SmartThingsSensorEntityDescription(
key=Attribute.WASHER_JOB_STATE,
name="Washer Job State",
translation_key="washer_job_state",
)
],
Attribute.COMPLETION_TIME: [
SmartThingsSensorEntityDescription(
key=Attribute.COMPLETION_TIME,
name="Washer Completion Time",
translation_key="completion_time",
device_class=SensorDeviceClass.TIMESTAMP,
value_fn=dt_util.parse_datetime,
)
@ -795,7 +782,6 @@ class SmartThingsSensor(SmartThingsEntity, SensorEntity):
) -> None:
"""Init the class."""
super().__init__(client, device, {capability})
self._attr_name = f"{device.device.label} {entity_description.name}"
self._attr_unique_id = f"{device.device.device_id}{entity_description.unique_id_separator}{entity_description.key}"
self._attribute = attribute
self.capability = capability

View File

@ -25,5 +25,188 @@
"reauth_account_mismatch": "Authenticated account does not match the account to be reauthenticated. Please log in with the correct account and pick the right location.",
"reauth_location_mismatch": "Authenticated location does not match the location to be reauthenticated. Please log in with the correct account and pick the right location."
}
},
"entity": {
"binary_sensor": {
"acceleration": {
"name": "Acceleration"
},
"filter_status": {
"name": "Filter status"
},
"valve": {
"name": "Valve"
}
},
"sensor": {
"lighting_mode": {
"name": "Activity lighting mode"
},
"air_conditioner_mode": {
"name": "Air conditioner mode"
},
"air_quality": {
"name": "Air quality"
},
"alarm": {
"name": "Alarm"
},
"audio_volume": {
"name": "Volume"
},
"body_mass_index": {
"name": "Body mass index"
},
"body_weight": {
"name": "Body weight"
},
"carbon_monoxide_detector": {
"name": "Carbon monoxide detector"
},
"dishwasher_machine_state": {
"name": "Machine state"
},
"dishwasher_job_state": {
"name": "Job state"
},
"completion_time": {
"name": "Completion time"
},
"dryer_mode": {
"name": "Dryer mode"
},
"dryer_machine_state": {
"name": "[%key:component::smartthings::entity::sensor::dishwasher_machine_state::name%]"
},
"dryer_job_state": {
"name": "[%key:component::smartthings::entity::sensor::dishwasher_job_state::name%]"
},
"dust_level": {
"name": "Dust level"
},
"fine_dust_level": {
"name": "Fine dust level"
},
"equivalent_carbon_dioxide": {
"name": "Equivalent carbon dioxide"
},
"formaldehyde": {
"name": "Formaldehyde"
},
"gas_meter": {
"name": "Gas meter"
},
"gas_meter_calorific": {
"name": "Gas meter calorific"
},
"gas_meter_time": {
"name": "Gas meter time"
},
"infrared_level": {
"name": "Infrared level"
},
"media_input_source": {
"name": "Media input source"
},
"media_playback_repeat": {
"name": "Media playback repeat"
},
"media_playback_shuffle": {
"name": "Media playback shuffle"
},
"media_playback_status": {
"name": "Media playback status"
},
"odor_sensor": {
"name": "Odor sensor"
},
"oven_mode": {
"name": "Oven mode"
},
"oven_machine_state": {
"name": "[%key:component::smartthings::entity::sensor::dishwasher_machine_state::name%]"
},
"oven_job_state": {
"name": "[%key:component::smartthings::entity::sensor::dishwasher_job_state::name%]"
},
"oven_setpoint": {
"name": "Set point"
},
"energy_difference": {
"name": "Energy difference"
},
"power_energy": {
"name": "Power energy"
},
"energy_saved": {
"name": "Energy saved"
},
"power_source": {
"name": "Power source"
},
"refrigeration_setpoint": {
"name": "[%key:component::smartthings::entity::sensor::oven_setpoint::name%]"
},
"robot_cleaner_cleaning_mode": {
"name": "Cleaning mode"
},
"robot_cleaner_movement": {
"name": "Movement"
},
"robot_cleaner_turbo_mode": {
"name": "Turbo mode"
},
"link_quality": {
"name": "Link quality"
},
"smoke_detector": {
"name": "Smoke detector"
},
"thermostat_cooling_setpoint": {
"name": "Cooling set point"
},
"thermostat_fan_mode": {
"name": "Fan mode"
},
"thermostat_heating_setpoint": {
"name": "Heating set point"
},
"thermostat_mode": {
"name": "Mode"
},
"thermostat_operating_state": {
"name": "Operating state"
},
"thermostat_setpoint": {
"name": "[%key:component::smartthings::entity::sensor::oven_setpoint::name%]"
},
"x_coordinate": {
"name": "X coordinate"
},
"y_coordinate": {
"name": "Y coordinate"
},
"z_coordinate": {
"name": "Z coordinate"
},
"tv_channel": {
"name": "TV channel"
},
"tv_channel_name": {
"name": "TV channel name"
},
"uv_index": {
"name": "UV index"
},
"washer_mode": {
"name": "Washer mode"
},
"washer_machine_state": {
"name": "[%key:component::smartthings::entity::sensor::dishwasher_machine_state::name%]"
},
"washer_job_state": {
"name": "[%key:component::smartthings::entity::sensor::dishwasher_job_state::name%]"
}
}
}
}

View File

@ -48,6 +48,8 @@ async def async_setup_entry(
class SmartThingsSwitch(SmartThingsEntity, SwitchEntity):
"""Define a SmartThings switch."""
_attr_name = None
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the switch off."""
await self.execute_device_command(

View File

@ -13,7 +13,7 @@
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.2nd_floor_hallway_motion',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -24,7 +24,7 @@
}),
'original_device_class': <BinarySensorDeviceClass.MOTION: 'motion'>,
'original_icon': None,
'original_name': '2nd Floor Hallway motion',
'original_name': 'Motion',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -37,7 +37,7 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'motion',
'friendly_name': '2nd Floor Hallway motion',
'friendly_name': '2nd Floor Hallway Motion',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.2nd_floor_hallway_motion',
@ -61,7 +61,7 @@
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.2nd_floor_hallway_sound',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -72,7 +72,7 @@
}),
'original_device_class': <BinarySensorDeviceClass.SOUND: 'sound'>,
'original_icon': None,
'original_name': '2nd Floor Hallway sound',
'original_name': 'Sound',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -85,7 +85,7 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'sound',
'friendly_name': '2nd Floor Hallway sound',
'friendly_name': '2nd Floor Hallway Sound',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.2nd_floor_hallway_sound',
@ -95,7 +95,7 @@
'state': 'off',
})
# ---
# name: test_all_entities[contact_sensor][binary_sensor.front_door_open_closed_sensor_contact-entry]
# name: test_all_entities[contact_sensor][binary_sensor.front_door_open_closed_sensor_door-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
@ -108,8 +108,8 @@
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.front_door_open_closed_sensor_contact',
'has_entity_name': False,
'entity_id': 'binary_sensor.front_door_open_closed_sensor_door',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -120,7 +120,7 @@
}),
'original_device_class': <BinarySensorDeviceClass.DOOR: 'door'>,
'original_icon': None,
'original_name': '.Front Door Open/Closed Sensor contact',
'original_name': 'Door',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -129,21 +129,21 @@
'unit_of_measurement': None,
})
# ---
# name: test_all_entities[contact_sensor][binary_sensor.front_door_open_closed_sensor_contact-state]
# name: test_all_entities[contact_sensor][binary_sensor.front_door_open_closed_sensor_door-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'door',
'friendly_name': '.Front Door Open/Closed Sensor contact',
'friendly_name': '.Front Door Open/Closed Sensor Door',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.front_door_open_closed_sensor_contact',
'entity_id': 'binary_sensor.front_door_open_closed_sensor_door',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_all_entities[da_ref_normal_000001][binary_sensor.refrigerator_contact-entry]
# name: test_all_entities[da_ref_normal_000001][binary_sensor.refrigerator_door-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
@ -156,8 +156,8 @@
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.refrigerator_contact',
'has_entity_name': False,
'entity_id': 'binary_sensor.refrigerator_door',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -168,7 +168,7 @@
}),
'original_device_class': <BinarySensorDeviceClass.DOOR: 'door'>,
'original_icon': None,
'original_name': 'Refrigerator contact',
'original_name': 'Door',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -177,14 +177,14 @@
'unit_of_measurement': None,
})
# ---
# name: test_all_entities[da_ref_normal_000001][binary_sensor.refrigerator_contact-state]
# name: test_all_entities[da_ref_normal_000001][binary_sensor.refrigerator_door-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'door',
'friendly_name': 'Refrigerator contact',
'friendly_name': 'Refrigerator Door',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.refrigerator_contact',
'entity_id': 'binary_sensor.refrigerator_door',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
@ -205,7 +205,7 @@
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.child_bedroom_motion',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -216,7 +216,7 @@
}),
'original_device_class': <BinarySensorDeviceClass.MOTION: 'motion'>,
'original_icon': None,
'original_name': 'Child Bedroom motion',
'original_name': 'Motion',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -229,7 +229,7 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'motion',
'friendly_name': 'Child Bedroom motion',
'friendly_name': 'Child Bedroom Motion',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.child_bedroom_motion',
@ -253,7 +253,7 @@
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.child_bedroom_presence',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -264,7 +264,7 @@
}),
'original_device_class': <BinarySensorDeviceClass.PRESENCE: 'presence'>,
'original_icon': None,
'original_name': 'Child Bedroom presence',
'original_name': 'Presence',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -277,7 +277,7 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'presence',
'friendly_name': 'Child Bedroom presence',
'friendly_name': 'Child Bedroom Presence',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.child_bedroom_presence',
@ -301,7 +301,7 @@
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.iphone_presence',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -312,7 +312,7 @@
}),
'original_device_class': <BinarySensorDeviceClass.PRESENCE: 'presence'>,
'original_icon': None,
'original_name': 'iPhone presence',
'original_name': 'Presence',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -325,7 +325,7 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'presence',
'friendly_name': 'iPhone presence',
'friendly_name': 'iPhone Presence',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.iphone_presence',
@ -349,7 +349,7 @@
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.deck_door_acceleration',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -360,11 +360,11 @@
}),
'original_device_class': <BinarySensorDeviceClass.MOVING: 'moving'>,
'original_icon': None,
'original_name': 'Deck Door acceleration',
'original_name': 'Acceleration',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': None,
'translation_key': 'acceleration',
'unique_id': '7d246592-93db-4d72-a10d-5a51793ece8c.acceleration',
'unit_of_measurement': None,
})
@ -373,7 +373,7 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'moving',
'friendly_name': 'Deck Door acceleration',
'friendly_name': 'Deck Door Acceleration',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.deck_door_acceleration',
@ -383,7 +383,7 @@
'state': 'off',
})
# ---
# name: test_all_entities[multipurpose_sensor][binary_sensor.deck_door_contact-entry]
# name: test_all_entities[multipurpose_sensor][binary_sensor.deck_door_door-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
@ -396,8 +396,8 @@
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.deck_door_contact',
'has_entity_name': False,
'entity_id': 'binary_sensor.deck_door_door',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -408,7 +408,7 @@
}),
'original_device_class': <BinarySensorDeviceClass.DOOR: 'door'>,
'original_icon': None,
'original_name': 'Deck Door contact',
'original_name': 'Door',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -417,14 +417,14 @@
'unit_of_measurement': None,
})
# ---
# name: test_all_entities[multipurpose_sensor][binary_sensor.deck_door_contact-state]
# name: test_all_entities[multipurpose_sensor][binary_sensor.deck_door_door-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'door',
'friendly_name': 'Deck Door contact',
'friendly_name': 'Deck Door Door',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.deck_door_contact',
'entity_id': 'binary_sensor.deck_door_door',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
@ -445,7 +445,7 @@
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.volvo_valve',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -456,11 +456,11 @@
}),
'original_device_class': <BinarySensorDeviceClass.OPENING: 'opening'>,
'original_icon': None,
'original_name': 'volvo valve',
'original_name': 'Valve',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': None,
'translation_key': 'valve',
'unique_id': '612ab3c2-3bb0-48f7-b2c0-15b169cb2fc3.valve',
'unit_of_measurement': None,
})
@ -469,7 +469,7 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'opening',
'friendly_name': 'volvo valve',
'friendly_name': 'volvo Valve',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.volvo_valve',
@ -479,7 +479,7 @@
'state': 'off',
})
# ---
# name: test_all_entities[virtual_water_sensor][binary_sensor.asd_water-entry]
# name: test_all_entities[virtual_water_sensor][binary_sensor.asd_moisture-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
@ -492,8 +492,8 @@
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.asd_water',
'has_entity_name': False,
'entity_id': 'binary_sensor.asd_moisture',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -504,7 +504,7 @@
}),
'original_device_class': <BinarySensorDeviceClass.MOISTURE: 'moisture'>,
'original_icon': None,
'original_name': 'asd water',
'original_name': 'Moisture',
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -513,14 +513,14 @@
'unit_of_measurement': None,
})
# ---
# name: test_all_entities[virtual_water_sensor][binary_sensor.asd_water-state]
# name: test_all_entities[virtual_water_sensor][binary_sensor.asd_moisture-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'moisture',
'friendly_name': 'asd water',
'friendly_name': 'asd Moisture',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.asd_water',
'entity_id': 'binary_sensor.asd_moisture',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,

View File

@ -35,7 +35,7 @@
'domain': 'climate',
'entity_category': None,
'entity_id': 'climate.ac_office_granit',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -46,7 +46,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'AC Office Granit',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': <ClimateEntityFeature: 441>,
@ -140,7 +140,7 @@
'domain': 'climate',
'entity_category': None,
'entity_id': 'climate.aire_dormitorio_principal',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -151,7 +151,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Aire Dormitorio Principal',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': <ClimateEntityFeature: 441>,
@ -234,7 +234,7 @@
'domain': 'climate',
'entity_category': None,
'entity_id': 'climate.main_floor',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -245,7 +245,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Main Floor',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': <ClimateEntityFeature: 395>,
@ -307,7 +307,7 @@
'domain': 'climate',
'entity_category': None,
'entity_id': 'climate.asd',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -318,7 +318,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'asd',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': <ClimateEntityFeature: 395>,

View File

@ -13,7 +13,7 @@
'domain': 'cover',
'entity_category': None,
'entity_id': 'cover.curtain_1a',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -24,7 +24,7 @@
}),
'original_device_class': <CoverDeviceClass.SHADE: 'shade'>,
'original_icon': None,
'original_name': 'Curtain 1A',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': <CoverEntityFeature: 7>,
@ -63,7 +63,7 @@
'domain': 'cover',
'entity_category': None,
'entity_id': 'cover.microwave',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -74,7 +74,7 @@
}),
'original_device_class': <CoverDeviceClass.DOOR: 'door'>,
'original_icon': None,
'original_name': 'Microwave',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': <CoverEntityFeature: 3>,

View File

@ -21,7 +21,7 @@
'domain': 'fan',
'entity_category': None,
'entity_id': 'fan.fake_fan',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -32,7 +32,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Fake fan',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': <FanEntityFeature: 57>,

View File

@ -17,7 +17,7 @@
'domain': 'light',
'entity_category': None,
'entity_id': 'light.dimmer_debian',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -28,7 +28,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Dimmer Debian',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': <LightEntityFeature: 32>,
@ -74,7 +74,7 @@
'domain': 'light',
'entity_category': None,
'entity_id': 'light.basement_exit_light',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -85,7 +85,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Basement Exit Light',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': <LightEntityFeature: 32>,
@ -135,7 +135,7 @@
'domain': 'light',
'entity_category': None,
'entity_id': 'light.bathroom_spot',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -146,7 +146,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Bathroom spot',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': <LightEntityFeature: 32>,
@ -216,7 +216,7 @@
'domain': 'light',
'entity_category': None,
'entity_id': 'light.standing_light',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -227,7 +227,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Standing light',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': <LightEntityFeature: 32>,

View File

@ -13,7 +13,7 @@
'domain': 'lock',
'entity_category': None,
'entity_id': 'lock.basement_door_lock',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -24,7 +24,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Basement Door Lock',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.2nd_floor_hallway',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -24,7 +24,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': '2nd Floor Hallway',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -60,7 +60,7 @@
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.microwave',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -71,7 +71,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Microwave',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -107,7 +107,7 @@
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.robot_vacuum',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -118,7 +118,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Robot vacuum',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -154,7 +154,7 @@
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.dishwasher',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -165,7 +165,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Dishwasher',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -201,7 +201,7 @@
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.dryer',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -212,7 +212,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Dryer',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -248,7 +248,7 @@
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.washer',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -259,7 +259,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Washer',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -295,7 +295,7 @@
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.office',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -306,7 +306,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Office',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -342,7 +342,7 @@
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.arlo_beta_basestation',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -353,7 +353,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Arlo Beta Basestation',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -389,7 +389,7 @@
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.soundbar_living',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -400,7 +400,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Soundbar Living',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,
@ -436,7 +436,7 @@
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.tv_samsung_8_series_49',
'has_entity_name': False,
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
@ -447,7 +447,7 @@
}),
'original_device_class': None,
'original_icon': None,
'original_name': '[TV] Samsung 8 Series (49)',
'original_name': None,
'platform': 'smartthings',
'previous_unique_id': None,
'supported_features': 0,

View File

@ -39,7 +39,7 @@ async def test_state_update(
"""Test state update."""
await setup_integration(hass, mock_config_entry)
assert hass.states.get("binary_sensor.refrigerator_contact").state == STATE_OFF
assert hass.states.get("binary_sensor.refrigerator_door").state == STATE_OFF
await trigger_update(
hass,
@ -50,4 +50,4 @@ async def test_state_update(
"open",
)
assert hass.states.get("binary_sensor.refrigerator_contact").state == STATE_ON
assert hass.states.get("binary_sensor.refrigerator_door").state == STATE_ON

View File

@ -37,10 +37,7 @@ async def test_state_update(
"""Test state update."""
await setup_integration(hass, mock_config_entry)
assert (
hass.states.get("sensor.aeotec_energy_monitor_energy_meter").state
== "19978.536"
)
assert hass.states.get("sensor.aeotec_energy_monitor_energy_2").state == "19978.536"
await trigger_update(
hass,
@ -51,6 +48,4 @@ async def test_state_update(
20000.0,
)
assert (
hass.states.get("sensor.aeotec_energy_monitor_energy_meter").state == "20000.0"
)
assert hass.states.get("sensor.aeotec_energy_monitor_energy_2").state == "20000.0"