mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Add current and voltage for plugs to switchbot_cloud (#135458)
SwitchBot Cloud: Adding current and voltage for plugs
This commit is contained in:
parent
61ea732caa
commit
559c411dd2
@ -91,6 +91,8 @@ def make_device_data(
|
||||
"MeterPro",
|
||||
"MeterPro(CO2)",
|
||||
"Relay Switch 1PM",
|
||||
"Plug Mini (US)",
|
||||
"Plug Mini (JP)",
|
||||
]:
|
||||
devices_data.sensors.append(
|
||||
prepare_device(hass, api, device, coordinators_by_id)
|
||||
|
@ -61,20 +61,27 @@ POWER_DESCRIPTION = SensorEntityDescription(
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
)
|
||||
|
||||
VOLATGE_DESCRIPTION = SensorEntityDescription(
|
||||
VOLTAGE_DESCRIPTION = SensorEntityDescription(
|
||||
key=SENSOR_TYPE_VOLTAGE,
|
||||
device_class=SensorDeviceClass.VOLTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
||||
)
|
||||
|
||||
CURRENT_DESCRIPTION = SensorEntityDescription(
|
||||
CURRENT_DESCRIPTION_IN_MA = SensorEntityDescription(
|
||||
key=SENSOR_TYPE_CURRENT,
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.MILLIAMPERE,
|
||||
)
|
||||
|
||||
CURRENT_DESCRIPTION_IN_A = SensorEntityDescription(
|
||||
key=SENSOR_TYPE_CURRENT,
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
)
|
||||
|
||||
CO2_DESCRIPTION = SensorEntityDescription(
|
||||
key=SENSOR_TYPE_CO2,
|
||||
device_class=SensorDeviceClass.CO2,
|
||||
@ -100,8 +107,16 @@ SENSOR_DESCRIPTIONS_BY_DEVICE_TYPES = {
|
||||
),
|
||||
"Relay Switch 1PM": (
|
||||
POWER_DESCRIPTION,
|
||||
VOLATGE_DESCRIPTION,
|
||||
CURRENT_DESCRIPTION,
|
||||
VOLTAGE_DESCRIPTION,
|
||||
CURRENT_DESCRIPTION_IN_MA,
|
||||
),
|
||||
"Plug Mini (US)": (
|
||||
VOLTAGE_DESCRIPTION,
|
||||
CURRENT_DESCRIPTION_IN_A,
|
||||
),
|
||||
"Plug Mini (JP)": (
|
||||
VOLTAGE_DESCRIPTION,
|
||||
CURRENT_DESCRIPTION_IN_A,
|
||||
),
|
||||
"Hub 2": (
|
||||
TEMPERATURE_DESCRIPTION,
|
||||
|
Loading…
x
Reference in New Issue
Block a user