Correct decimals in Growatt energy reporting (#4277)

fixes https://github.com/esphome/issues/issues/3888
This commit is contained in:
Robin Pronk 2023-01-10 04:21:55 +01:00 committed by GitHub
parent 75dff1e102
commit b1f1329cee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,7 +52,7 @@ GrowattSolar = growatt_solar_ns.class_(
PHASE_SENSORS = { PHASE_SENSORS = {
CONF_VOLTAGE: sensor.sensor_schema( CONF_VOLTAGE: sensor.sensor_schema(
unit_of_measurement=UNIT_VOLT, unit_of_measurement=UNIT_VOLT,
accuracy_decimals=2, accuracy_decimals=1,
device_class=DEVICE_CLASS_VOLTAGE, device_class=DEVICE_CLASS_VOLTAGE,
), ),
CONF_CURRENT: sensor.sensor_schema( CONF_CURRENT: sensor.sensor_schema(
@ -71,7 +71,7 @@ PHASE_SENSORS = {
PV_SENSORS = { PV_SENSORS = {
CONF_VOLTAGE: sensor.sensor_schema( CONF_VOLTAGE: sensor.sensor_schema(
unit_of_measurement=UNIT_VOLT, unit_of_measurement=UNIT_VOLT,
accuracy_decimals=2, accuracy_decimals=1,
device_class=DEVICE_CLASS_VOLTAGE, device_class=DEVICE_CLASS_VOLTAGE,
), ),
CONF_CURRENT: sensor.sensor_schema( CONF_CURRENT: sensor.sensor_schema(
@ -135,13 +135,13 @@ CONFIG_SCHEMA = (
), ),
cv.Optional(CONF_ENERGY_PRODUCTION_DAY): sensor.sensor_schema( cv.Optional(CONF_ENERGY_PRODUCTION_DAY): sensor.sensor_schema(
unit_of_measurement=UNIT_KILOWATT_HOURS, unit_of_measurement=UNIT_KILOWATT_HOURS,
accuracy_decimals=2, accuracy_decimals=1,
device_class=DEVICE_CLASS_ENERGY, device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=STATE_CLASS_TOTAL_INCREASING,
), ),
cv.Optional(CONF_TOTAL_ENERGY_PRODUCTION): sensor.sensor_schema( cv.Optional(CONF_TOTAL_ENERGY_PRODUCTION): sensor.sensor_schema(
unit_of_measurement=UNIT_KILOWATT_HOURS, unit_of_measurement=UNIT_KILOWATT_HOURS,
accuracy_decimals=0, accuracy_decimals=1,
device_class=DEVICE_CLASS_ENERGY, device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=STATE_CLASS_TOTAL_INCREASING,
), ),