Remove power and energy from sensors that are not true power (#2628)

This commit is contained in:
Jesse Hills 2021-10-26 21:55:20 +13:00
parent 91999a38ca
commit c6adaaea97
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A
5 changed files with 11 additions and 25 deletions

View file

@ -75,14 +75,14 @@ CONFIG_SCHEMA = cv.Schema(
UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, UNIT_KILOVOLT_AMPS_REACTIVE_HOURS,
ICON_EMPTY, ICON_EMPTY,
3, 3,
DEVICE_CLASS_ENERGY, DEVICE_CLASS_EMPTY,
STATE_CLASS_NONE, STATE_CLASS_NONE,
), ),
cv.Optional("total_exported_energy"): sensor.sensor_schema( cv.Optional("total_exported_energy"): sensor.sensor_schema(
UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, UNIT_KILOVOLT_AMPS_REACTIVE_HOURS,
ICON_EMPTY, ICON_EMPTY,
3, 3,
DEVICE_CLASS_ENERGY, DEVICE_CLASS_EMPTY,
STATE_CLASS_NONE, STATE_CLASS_NONE,
), ),
cv.Optional("power_delivered"): sensor.sensor_schema( cv.Optional("power_delivered"): sensor.sensor_schema(
@ -166,42 +166,42 @@ CONFIG_SCHEMA = cv.Schema(
UNIT_KILOVOLT_AMPS_REACTIVE, UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY, ICON_EMPTY,
3, 3,
DEVICE_CLASS_POWER, DEVICE_CLASS_EMPTY,
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
), ),
cv.Optional("reactive_power_delivered_l2"): sensor.sensor_schema( cv.Optional("reactive_power_delivered_l2"): sensor.sensor_schema(
UNIT_KILOVOLT_AMPS_REACTIVE, UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY, ICON_EMPTY,
3, 3,
DEVICE_CLASS_POWER, DEVICE_CLASS_EMPTY,
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
), ),
cv.Optional("reactive_power_delivered_l3"): sensor.sensor_schema( cv.Optional("reactive_power_delivered_l3"): sensor.sensor_schema(
UNIT_KILOVOLT_AMPS_REACTIVE, UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY, ICON_EMPTY,
3, 3,
DEVICE_CLASS_POWER, DEVICE_CLASS_EMPTY,
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
), ),
cv.Optional("reactive_power_returned_l1"): sensor.sensor_schema( cv.Optional("reactive_power_returned_l1"): sensor.sensor_schema(
UNIT_KILOVOLT_AMPS_REACTIVE, UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY, ICON_EMPTY,
3, 3,
DEVICE_CLASS_POWER, DEVICE_CLASS_EMPTY,
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
), ),
cv.Optional("reactive_power_returned_l2"): sensor.sensor_schema( cv.Optional("reactive_power_returned_l2"): sensor.sensor_schema(
UNIT_KILOVOLT_AMPS_REACTIVE, UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY, ICON_EMPTY,
3, 3,
DEVICE_CLASS_POWER, DEVICE_CLASS_EMPTY,
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
), ),
cv.Optional("reactive_power_returned_l3"): sensor.sensor_schema( cv.Optional("reactive_power_returned_l3"): sensor.sensor_schema(
UNIT_KILOVOLT_AMPS_REACTIVE, UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY, ICON_EMPTY,
3, 3,
DEVICE_CLASS_POWER, DEVICE_CLASS_EMPTY,
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
), ),
cv.Optional("voltage_l1"): sensor.sensor_schema( cv.Optional("voltage_l1"): sensor.sensor_schema(

View file

@ -93,13 +93,12 @@ PV_SENSORS = {
CONF_VOLTAGE_SAMPLED_BY_SECONDARY_CPU: sensor.sensor_schema( CONF_VOLTAGE_SAMPLED_BY_SECONDARY_CPU: sensor.sensor_schema(
unit_of_measurement=UNIT_VOLT, unit_of_measurement=UNIT_VOLT,
accuracy_decimals=0, accuracy_decimals=0,
device_class=DEVICE_CLASS_POWER, device_class=DEVICE_CLASS_VOLTAGE,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
CONF_INSULATION_OF_P_TO_GROUND: sensor.sensor_schema( CONF_INSULATION_OF_P_TO_GROUND: sensor.sensor_schema(
unit_of_measurement=UNIT_KOHM, unit_of_measurement=UNIT_KOHM,
accuracy_decimals=0, accuracy_decimals=0,
device_class=DEVICE_CLASS_POWER,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
} }
@ -135,7 +134,6 @@ CONFIG_SCHEMA = (
cv.Optional(CONF_REACTIVE_POWER): sensor.sensor_schema( cv.Optional(CONF_REACTIVE_POWER): sensor.sensor_schema(
unit_of_measurement=UNIT_VOLT_AMPS_REACTIVE, unit_of_measurement=UNIT_VOLT_AMPS_REACTIVE,
accuracy_decimals=2, accuracy_decimals=2,
device_class=DEVICE_CLASS_POWER,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_ENERGY_PRODUCTION_DAY): sensor.sensor_schema( cv.Optional(CONF_ENERGY_PRODUCTION_DAY): sensor.sensor_schema(

View file

@ -89,7 +89,7 @@ TYPES = {
UNIT_AMPERE, ICON_EMPTY, 1, DEVICE_CLASS_CURRENT UNIT_AMPERE, ICON_EMPTY, 1, DEVICE_CLASS_CURRENT
), ),
CONF_AC_OUTPUT_RATING_APPARENT_POWER: sensor.sensor_schema( CONF_AC_OUTPUT_RATING_APPARENT_POWER: sensor.sensor_schema(
UNIT_VOLT_AMPS, ICON_EMPTY, 1, DEVICE_CLASS_POWER UNIT_VOLT_AMPS, ICON_EMPTY, 1, DEVICE_CLASS_EMPTY
), ),
CONF_AC_OUTPUT_RATING_ACTIVE_POWER: sensor.sensor_schema( CONF_AC_OUTPUT_RATING_ACTIVE_POWER: sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 1, DEVICE_CLASS_POWER UNIT_WATT, ICON_EMPTY, 1, DEVICE_CLASS_POWER
@ -159,7 +159,7 @@ TYPES = {
UNIT_HERTZ, ICON_CURRENT_AC, 1, DEVICE_CLASS_EMPTY UNIT_HERTZ, ICON_CURRENT_AC, 1, DEVICE_CLASS_EMPTY
), ),
CONF_AC_OUTPUT_APPARENT_POWER: sensor.sensor_schema( CONF_AC_OUTPUT_APPARENT_POWER: sensor.sensor_schema(
UNIT_VOLT_AMPS, ICON_EMPTY, 1, DEVICE_CLASS_POWER UNIT_VOLT_AMPS, ICON_EMPTY, 1, DEVICE_CLASS_EMPTY
), ),
CONF_AC_OUTPUT_ACTIVE_POWER: sensor.sensor_schema( CONF_AC_OUTPUT_ACTIVE_POWER: sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 1, DEVICE_CLASS_POWER UNIT_WATT, ICON_EMPTY, 1, DEVICE_CLASS_POWER

View file

@ -64,13 +64,11 @@ PHASE_SENSORS = {
CONF_APPARENT_POWER: sensor.sensor_schema( CONF_APPARENT_POWER: sensor.sensor_schema(
unit_of_measurement=UNIT_VOLT_AMPS, unit_of_measurement=UNIT_VOLT_AMPS,
accuracy_decimals=2, accuracy_decimals=2,
device_class=DEVICE_CLASS_POWER,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
CONF_REACTIVE_POWER: sensor.sensor_schema( CONF_REACTIVE_POWER: sensor.sensor_schema(
unit_of_measurement=UNIT_VOLT_AMPS_REACTIVE, unit_of_measurement=UNIT_VOLT_AMPS_REACTIVE,
accuracy_decimals=2, accuracy_decimals=2,
device_class=DEVICE_CLASS_POWER,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
CONF_POWER_FACTOR: sensor.sensor_schema( CONF_POWER_FACTOR: sensor.sensor_schema(
@ -115,13 +113,11 @@ CONFIG_SCHEMA = (
cv.Optional(CONF_IMPORT_REACTIVE_ENERGY): sensor.sensor_schema( cv.Optional(CONF_IMPORT_REACTIVE_ENERGY): sensor.sensor_schema(
unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS,
accuracy_decimals=2, accuracy_decimals=2,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=STATE_CLASS_TOTAL_INCREASING,
), ),
cv.Optional(CONF_EXPORT_REACTIVE_ENERGY): sensor.sensor_schema( cv.Optional(CONF_EXPORT_REACTIVE_ENERGY): sensor.sensor_schema(
unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS,
accuracy_decimals=2, accuracy_decimals=2,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=STATE_CLASS_TOTAL_INCREASING,
), ),
} }

View file

@ -71,25 +71,21 @@ SENSORS = {
CONF_TOTAL_REACTIVE_ENERGY: sensor.sensor_schema( CONF_TOTAL_REACTIVE_ENERGY: sensor.sensor_schema(
unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS,
accuracy_decimals=2, accuracy_decimals=2,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=STATE_CLASS_TOTAL_INCREASING,
), ),
CONF_IMPORT_REACTIVE_ENERGY: sensor.sensor_schema( CONF_IMPORT_REACTIVE_ENERGY: sensor.sensor_schema(
unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS,
accuracy_decimals=2, accuracy_decimals=2,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=STATE_CLASS_TOTAL_INCREASING,
), ),
CONF_EXPORT_REACTIVE_ENERGY: sensor.sensor_schema( CONF_EXPORT_REACTIVE_ENERGY: sensor.sensor_schema(
unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS, unit_of_measurement=UNIT_KILOVOLT_AMPS_REACTIVE_HOURS,
accuracy_decimals=2, accuracy_decimals=2,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=STATE_CLASS_TOTAL_INCREASING,
), ),
CONF_APPARENT_ENERGY: sensor.sensor_schema( CONF_APPARENT_ENERGY: sensor.sensor_schema(
unit_of_measurement=UNIT_KILOVOLT_AMPS_HOURS, unit_of_measurement=UNIT_KILOVOLT_AMPS_HOURS,
accuracy_decimals=2, accuracy_decimals=2,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=STATE_CLASS_TOTAL_INCREASING,
), ),
CONF_ACTIVE_POWER: sensor.sensor_schema( CONF_ACTIVE_POWER: sensor.sensor_schema(
@ -101,13 +97,11 @@ SENSORS = {
CONF_REACTIVE_POWER: sensor.sensor_schema( CONF_REACTIVE_POWER: sensor.sensor_schema(
unit_of_measurement=UNIT_VOLT_AMPS_REACTIVE, unit_of_measurement=UNIT_VOLT_AMPS_REACTIVE,
accuracy_decimals=3, accuracy_decimals=3,
device_class=DEVICE_CLASS_POWER,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
CONF_APPARENT_POWER: sensor.sensor_schema( CONF_APPARENT_POWER: sensor.sensor_schema(
unit_of_measurement=UNIT_VOLT_AMPS, unit_of_measurement=UNIT_VOLT_AMPS,
accuracy_decimals=3, accuracy_decimals=3,
device_class=DEVICE_CLASS_POWER,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
CONF_VOLTAGE: sensor.sensor_schema( CONF_VOLTAGE: sensor.sensor_schema(
@ -142,13 +136,11 @@ SENSORS = {
CONF_MAXIMUM_DEMAND_REACTIVE_POWER: sensor.sensor_schema( CONF_MAXIMUM_DEMAND_REACTIVE_POWER: sensor.sensor_schema(
unit_of_measurement=UNIT_VOLT_AMPS_REACTIVE, unit_of_measurement=UNIT_VOLT_AMPS_REACTIVE,
accuracy_decimals=3, accuracy_decimals=3,
device_class=DEVICE_CLASS_POWER,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
CONF_MAXIMUM_DEMAND_APPARENT_POWER: sensor.sensor_schema( CONF_MAXIMUM_DEMAND_APPARENT_POWER: sensor.sensor_schema(
unit_of_measurement=UNIT_VOLT_AMPS, unit_of_measurement=UNIT_VOLT_AMPS,
accuracy_decimals=3, accuracy_decimals=3,
device_class=DEVICE_CLASS_POWER,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
} }