mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 10:14:13 +01:00
Fix SDM energy units to be KILO... (#2206)
This commit is contained in:
parent
39cd2838df
commit
3be56fd502
2 changed files with 8 additions and 6 deletions
|
@ -28,12 +28,12 @@ from esphome.const import (
|
||||||
UNIT_AMPERE,
|
UNIT_AMPERE,
|
||||||
UNIT_DEGREES,
|
UNIT_DEGREES,
|
||||||
UNIT_HERTZ,
|
UNIT_HERTZ,
|
||||||
|
UNIT_KILOVOLT_AMPS_REACTIVE_HOURS,
|
||||||
|
UNIT_KILOWATT_HOURS,
|
||||||
UNIT_VOLT,
|
UNIT_VOLT,
|
||||||
UNIT_VOLT_AMPS,
|
UNIT_VOLT_AMPS,
|
||||||
UNIT_VOLT_AMPS_REACTIVE,
|
UNIT_VOLT_AMPS_REACTIVE,
|
||||||
UNIT_VOLT_AMPS_REACTIVE_HOURS,
|
|
||||||
UNIT_WATT,
|
UNIT_WATT,
|
||||||
UNIT_WATT_HOURS,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
AUTO_LOAD = ["modbus"]
|
AUTO_LOAD = ["modbus"]
|
||||||
|
@ -101,28 +101,28 @@ CONFIG_SCHEMA = (
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
cv.Optional(CONF_IMPORT_ACTIVE_ENERGY): sensor.sensor_schema(
|
cv.Optional(CONF_IMPORT_ACTIVE_ENERGY): sensor.sensor_schema(
|
||||||
unit_of_measurement=UNIT_WATT_HOURS,
|
unit_of_measurement=UNIT_KILOWATT_HOURS,
|
||||||
accuracy_decimals=2,
|
accuracy_decimals=2,
|
||||||
device_class=DEVICE_CLASS_ENERGY,
|
device_class=DEVICE_CLASS_ENERGY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
last_reset_type=LAST_RESET_TYPE_AUTO,
|
last_reset_type=LAST_RESET_TYPE_AUTO,
|
||||||
),
|
),
|
||||||
cv.Optional(CONF_EXPORT_ACTIVE_ENERGY): sensor.sensor_schema(
|
cv.Optional(CONF_EXPORT_ACTIVE_ENERGY): sensor.sensor_schema(
|
||||||
unit_of_measurement=UNIT_WATT_HOURS,
|
unit_of_measurement=UNIT_KILOWATT_HOURS,
|
||||||
accuracy_decimals=2,
|
accuracy_decimals=2,
|
||||||
device_class=DEVICE_CLASS_ENERGY,
|
device_class=DEVICE_CLASS_ENERGY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
last_reset_type=LAST_RESET_TYPE_AUTO,
|
last_reset_type=LAST_RESET_TYPE_AUTO,
|
||||||
),
|
),
|
||||||
cv.Optional(CONF_IMPORT_REACTIVE_ENERGY): sensor.sensor_schema(
|
cv.Optional(CONF_IMPORT_REACTIVE_ENERGY): sensor.sensor_schema(
|
||||||
unit_of_measurement=UNIT_VOLT_AMPS_REACTIVE_HOURS,
|
unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS,
|
||||||
accuracy_decimals=2,
|
accuracy_decimals=2,
|
||||||
device_class=DEVICE_CLASS_ENERGY,
|
device_class=DEVICE_CLASS_ENERGY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
last_reset_type=LAST_RESET_TYPE_AUTO,
|
last_reset_type=LAST_RESET_TYPE_AUTO,
|
||||||
),
|
),
|
||||||
cv.Optional(CONF_EXPORT_REACTIVE_ENERGY): sensor.sensor_schema(
|
cv.Optional(CONF_EXPORT_REACTIVE_ENERGY): sensor.sensor_schema(
|
||||||
unit_of_measurement=UNIT_VOLT_AMPS_REACTIVE_HOURS,
|
unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS,
|
||||||
accuracy_decimals=2,
|
accuracy_decimals=2,
|
||||||
device_class=DEVICE_CLASS_ENERGY,
|
device_class=DEVICE_CLASS_ENERGY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
|
|
|
@ -768,6 +768,8 @@ UNIT_KELVIN = "K"
|
||||||
UNIT_KILOGRAM = "kg"
|
UNIT_KILOGRAM = "kg"
|
||||||
UNIT_KILOMETER = "km"
|
UNIT_KILOMETER = "km"
|
||||||
UNIT_KILOMETER_PER_HOUR = "km/h"
|
UNIT_KILOMETER_PER_HOUR = "km/h"
|
||||||
|
UNIT_KILOVOLT_AMPS_REACTIVE_HOURS = "kVArh"
|
||||||
|
UNIT_KILOWATT_HOURS = "kWh"
|
||||||
UNIT_LUX = "lx"
|
UNIT_LUX = "lx"
|
||||||
UNIT_METER = "m"
|
UNIT_METER = "m"
|
||||||
UNIT_METER_PER_SECOND_SQUARED = "m/s²"
|
UNIT_METER_PER_SECOND_SQUARED = "m/s²"
|
||||||
|
|
Loading…
Reference in a new issue