Add new growatt_server device class constants (#38906)

This commit is contained in:
indykoning 2020-08-15 18:04:49 +02:00 committed by GitHub
parent 755761867d
commit 92adb5d58a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,12 @@ from homeassistant.const import (
CONF_NAME, CONF_NAME,
CONF_PASSWORD, CONF_PASSWORD,
CONF_USERNAME, CONF_USERNAME,
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_CURRENT,
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_POWER,
DEVICE_CLASS_TEMPERATURE,
DEVICE_CLASS_VOLTAGE,
ELECTRICAL_CURRENT_AMPERE, ELECTRICAL_CURRENT_AMPERE,
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
FREQUENCY_HERTZ, FREQUENCY_HERTZ,
@ -35,24 +41,29 @@ SCAN_INTERVAL = datetime.timedelta(minutes=5)
TOTAL_SENSOR_TYPES = { TOTAL_SENSOR_TYPES = {
"total_money_today": ("Total money today", "", "plantMoneyText", {}), "total_money_today": ("Total money today", "", "plantMoneyText", {}),
"total_money_total": ("Money lifetime", "", "totalMoneyText", {}), "total_money_total": ("Money lifetime", "", "totalMoneyText", {}),
"total_energy_today": ("Energy Today", ENERGY_KILO_WATT_HOUR, "todayEnergy", {},), "total_energy_today": (
"Energy Today",
ENERGY_KILO_WATT_HOUR,
"todayEnergy",
{"device_class": DEVICE_CLASS_ENERGY},
),
"total_output_power": ( "total_output_power": (
"Output Power", "Output Power",
POWER_WATT, POWER_WATT,
"invTodayPpv", "invTodayPpv",
{"device_class": "power"}, {"device_class": DEVICE_CLASS_POWER},
), ),
"total_energy_output": ( "total_energy_output": (
"Lifetime energy output", "Lifetime energy output",
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
"totalEnergy", "totalEnergy",
{}, {"device_class": DEVICE_CLASS_ENERGY},
), ),
"total_maximum_output": ( "total_maximum_output": (
"Maximum power", "Maximum power",
POWER_WATT, POWER_WATT,
"nominalPower", "nominalPower",
{"device_class": "power"}, {"device_class": DEVICE_CLASS_POWER},
), ),
} }
@ -61,90 +72,110 @@ INVERTER_SENSOR_TYPES = {
"Energy today", "Energy today",
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
"powerToday", "powerToday",
{"round": 1}, {"round": 1, "device_class": DEVICE_CLASS_ENERGY},
), ),
"inverter_energy_total": ( "inverter_energy_total": (
"Lifetime energy output", "Lifetime energy output",
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
"powerTotal", "powerTotal",
{"round": 1}, {"round": 1, "device_class": DEVICE_CLASS_ENERGY},
),
"inverter_voltage_input_1": (
"Input 1 voltage",
VOLT,
"vpv1",
{"round": 2, "device_class": DEVICE_CLASS_VOLTAGE},
), ),
"inverter_voltage_input_1": ("Input 1 voltage", VOLT, "vpv1", {"round": 2}),
"inverter_amperage_input_1": ( "inverter_amperage_input_1": (
"Input 1 Amperage", "Input 1 Amperage",
ELECTRICAL_CURRENT_AMPERE, ELECTRICAL_CURRENT_AMPERE,
"ipv1", "ipv1",
{"round": 1}, {"round": 1, "device_class": DEVICE_CLASS_CURRENT},
), ),
"inverter_wattage_input_1": ( "inverter_wattage_input_1": (
"Input 1 Wattage", "Input 1 Wattage",
POWER_WATT, POWER_WATT,
"ppv1", "ppv1",
{"device_class": "power", "round": 1}, {"device_class": DEVICE_CLASS_POWER, "round": 1},
),
"inverter_voltage_input_2": (
"Input 2 voltage",
VOLT,
"vpv2",
{"round": 1, "device_class": DEVICE_CLASS_VOLTAGE},
), ),
"inverter_voltage_input_2": ("Input 2 voltage", VOLT, "vpv2", {"round": 1}),
"inverter_amperage_input_2": ( "inverter_amperage_input_2": (
"Input 2 Amperage", "Input 2 Amperage",
ELECTRICAL_CURRENT_AMPERE, ELECTRICAL_CURRENT_AMPERE,
"ipv2", "ipv2",
{"round": 1}, {"round": 1, "device_class": DEVICE_CLASS_CURRENT},
), ),
"inverter_wattage_input_2": ( "inverter_wattage_input_2": (
"Input 2 Wattage", "Input 2 Wattage",
POWER_WATT, POWER_WATT,
"ppv2", "ppv2",
{"device_class": "power", "round": 1}, {"device_class": DEVICE_CLASS_POWER, "round": 1},
),
"inverter_voltage_input_3": (
"Input 3 voltage",
VOLT,
"vpv3",
{"round": 1, "device_class": DEVICE_CLASS_VOLTAGE},
), ),
"inverter_voltage_input_3": ("Input 3 voltage", VOLT, "vpv3", {"round": 1}),
"inverter_amperage_input_3": ( "inverter_amperage_input_3": (
"Input 3 Amperage", "Input 3 Amperage",
ELECTRICAL_CURRENT_AMPERE, ELECTRICAL_CURRENT_AMPERE,
"ipv3", "ipv3",
{"round": 1}, {"round": 1, "device_class": DEVICE_CLASS_CURRENT},
), ),
"inverter_wattage_input_3": ( "inverter_wattage_input_3": (
"Input 3 Wattage", "Input 3 Wattage",
POWER_WATT, POWER_WATT,
"ppv3", "ppv3",
{"device_class": "power", "round": 1}, {"device_class": DEVICE_CLASS_POWER, "round": 1},
), ),
"inverter_internal_wattage": ( "inverter_internal_wattage": (
"Internal wattage", "Internal wattage",
POWER_WATT, POWER_WATT,
"ppv", "ppv",
{"device_class": "power", "round": 1}, {"device_class": DEVICE_CLASS_POWER, "round": 1},
),
"inverter_reactive_voltage": (
"Reactive voltage",
VOLT,
"vacr",
{"round": 1, "device_class": DEVICE_CLASS_VOLTAGE},
), ),
"inverter_reactive_voltage": ("Reactive voltage", VOLT, "vacr", {"round": 1}),
"inverter_inverter_reactive_amperage": ( "inverter_inverter_reactive_amperage": (
"Reactive amperage", "Reactive amperage",
ELECTRICAL_CURRENT_AMPERE, ELECTRICAL_CURRENT_AMPERE,
"iacr", "iacr",
{"round": 1}, {"round": 1, "device_class": DEVICE_CLASS_CURRENT},
), ),
"inverter_frequency": ("AC frequency", FREQUENCY_HERTZ, "fac", {"round": 1}), "inverter_frequency": ("AC frequency", FREQUENCY_HERTZ, "fac", {"round": 1}),
"inverter_current_wattage": ( "inverter_current_wattage": (
"Output power", "Output power",
POWER_WATT, POWER_WATT,
"pac", "pac",
{"device_class": "power", "round": 1}, {"device_class": DEVICE_CLASS_POWER, "round": 1},
), ),
"inverter_current_reactive_wattage": ( "inverter_current_reactive_wattage": (
"Reactive wattage", "Reactive wattage",
POWER_WATT, POWER_WATT,
"pacr", "pacr",
{"device_class": "power", "round": 1}, {"device_class": DEVICE_CLASS_POWER, "round": 1},
), ),
"inverter_ipm_temperature": ( "inverter_ipm_temperature": (
"Intelligent Power Management temperature", "Intelligent Power Management temperature",
TEMP_CELSIUS, TEMP_CELSIUS,
"ipmTemperature", "ipmTemperature",
{"device_class": "temperature", "round": 1}, {"device_class": DEVICE_CLASS_TEMPERATURE, "round": 1},
), ),
"inverter_temperature": ( "inverter_temperature": (
"Temperature", "Temperature",
TEMP_CELSIUS, TEMP_CELSIUS,
"temperature", "temperature",
{"device_class": "temperature", "round": 1}, {"device_class": DEVICE_CLASS_TEMPERATURE, "round": 1},
), ),
} }
@ -153,61 +184,61 @@ STORAGE_SENSOR_TYPES = {
"Storage production today", "Storage production today",
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
"eBatDisChargeToday", "eBatDisChargeToday",
{}, {"device_class": DEVICE_CLASS_ENERGY},
), ),
"storage_storage_production_lifetime": ( "storage_storage_production_lifetime": (
"Lifetime Storage production", "Lifetime Storage production",
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
"eBatDisChargeTotal", "eBatDisChargeTotal",
{}, {"device_class": DEVICE_CLASS_ENERGY},
), ),
"storage_grid_discharge_today": ( "storage_grid_discharge_today": (
"Grid discharged today", "Grid discharged today",
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
"eacDisChargeToday", "eacDisChargeToday",
{}, {"device_class": DEVICE_CLASS_ENERGY},
), ),
"storage_load_consumption_today": ( "storage_load_consumption_today": (
"Load consumption today", "Load consumption today",
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
"eopDischrToday", "eopDischrToday",
{}, {"device_class": DEVICE_CLASS_ENERGY},
), ),
"storage_load_consumption_lifetime": ( "storage_load_consumption_lifetime": (
"Lifetime load consumption", "Lifetime load consumption",
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
"eopDischrTotal", "eopDischrTotal",
{}, {"device_class": DEVICE_CLASS_ENERGY},
), ),
"storage_grid_charged_today": ( "storage_grid_charged_today": (
"Grid charged today", "Grid charged today",
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
"eacChargeToday", "eacChargeToday",
{}, {"device_class": DEVICE_CLASS_ENERGY},
), ),
"storage_charge_storage_lifetime": ( "storage_charge_storage_lifetime": (
"Lifetime storaged charged", "Lifetime storaged charged",
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
"eChargeTotal", "eChargeTotal",
{}, {"device_class": DEVICE_CLASS_ENERGY},
), ),
"storage_solar_production": ( "storage_solar_production": (
"Solar power production", "Solar power production",
POWER_WATT, POWER_WATT,
"ppv", "ppv",
{"device_class": "power"}, {"device_class": DEVICE_CLASS_POWER},
), ),
"storage_battery_percentage": ( "storage_battery_percentage": (
"Battery percentage", "Battery percentage",
"%", "%",
"capacity", "capacity",
{"device_class": "battery"}, {"device_class": DEVICE_CLASS_BATTERY},
), ),
"storage_power_flow": ( "storage_power_flow": (
"Storage charging/ discharging(-ve)", "Storage charging/ discharging(-ve)",
POWER_WATT, POWER_WATT,
"pCharge", "pCharge",
{"device_class": "power"}, {"device_class": DEVICE_CLASS_POWER},
), ),
"storage_load_consumption_solar_storage": ( "storage_load_consumption_solar_storage": (
"Load consumption(Solar + Storage)", "Load consumption(Solar + Storage)",
@ -219,41 +250,56 @@ STORAGE_SENSOR_TYPES = {
"Charge today", "Charge today",
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
"eChargeToday", "eChargeToday",
{}, {"device_class": DEVICE_CLASS_ENERGY},
), ),
"storage_import_from_grid": ( "storage_import_from_grid": (
"Import from grid", "Import from grid",
POWER_WATT, POWER_WATT,
"pAcInPut", "pAcInPut",
{"device_class": "power"}, {"device_class": DEVICE_CLASS_POWER},
), ),
"storage_import_from_grid_today": ( "storage_import_from_grid_today": (
"Import from grid today", "Import from grid today",
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
"eToUserToday", "eToUserToday",
{}, {"device_class": DEVICE_CLASS_ENERGY},
), ),
"storage_import_from_grid_total": ( "storage_import_from_grid_total": (
"Import from grid total", "Import from grid total",
ENERGY_KILO_WATT_HOUR, ENERGY_KILO_WATT_HOUR,
"eToUserTotal", "eToUserTotal",
{}, {"device_class": DEVICE_CLASS_ENERGY},
), ),
"storage_load_consumption": ( "storage_load_consumption": (
"Load consumption", "Load consumption",
POWER_WATT, POWER_WATT,
"outPutPower", "outPutPower",
{"device_class": "power"}, {"device_class": DEVICE_CLASS_POWER},
),
"storage_grid_voltage": (
"AC input voltage",
VOLT,
"vGrid",
{"round": 2, "device_class": DEVICE_CLASS_VOLTAGE},
),
"storage_pv_charging_voltage": (
"PV charging voltage",
VOLT,
"vpv",
{"round": 2, "device_class": DEVICE_CLASS_VOLTAGE},
), ),
"storage_grid_voltage": ("AC input voltage", VOLT, "vGrid", {"round": 2}),
"storage_pv_charging_voltage": ("PV charging voltage", VOLT, "vpv", {"round": 2}),
"storage_ac_input_frequency_out": ( "storage_ac_input_frequency_out": (
"AC input frequency", "AC input frequency",
FREQUENCY_HERTZ, FREQUENCY_HERTZ,
"freqOutPut", "freqOutPut",
{"round": 2}, {"round": 2},
), ),
"storage_output_voltage": ("Output voltage", VOLT, "outPutVolt", {"round": 2}), "storage_output_voltage": (
"Output voltage",
VOLT,
"outPutVolt",
{"round": 2, "device_class": DEVICE_CLASS_VOLTAGE},
),
"storage_ac_output_frequency": ( "storage_ac_output_frequency": (
"Ac output frequency", "Ac output frequency",
FREQUENCY_HERTZ, FREQUENCY_HERTZ,
@ -264,32 +310,37 @@ STORAGE_SENSOR_TYPES = {
"Solar charge current", "Solar charge current",
ELECTRICAL_CURRENT_AMPERE, ELECTRICAL_CURRENT_AMPERE,
"iAcCharge", "iAcCharge",
{"round": 2}, {"round": 2, "device_class": DEVICE_CLASS_CURRENT},
), ),
"storage_current_1": ( "storage_current_1": (
"Solar current to storage", "Solar current to storage",
ELECTRICAL_CURRENT_AMPERE, ELECTRICAL_CURRENT_AMPERE,
"iChargePV1", "iChargePV1",
{"round": 2}, {"round": 2, "device_class": DEVICE_CLASS_CURRENT},
), ),
"storage_grid_amperage_input": ( "storage_grid_amperage_input": (
"Grid charge current", "Grid charge current",
ELECTRICAL_CURRENT_AMPERE, ELECTRICAL_CURRENT_AMPERE,
"chgCurr", "chgCurr",
{"round": 2}, {"round": 2, "device_class": DEVICE_CLASS_CURRENT},
), ),
"storage_grid_out_current": ( "storage_grid_out_current": (
"Grid out current", "Grid out current",
ELECTRICAL_CURRENT_AMPERE, ELECTRICAL_CURRENT_AMPERE,
"outPutCurrent", "outPutCurrent",
{"round": 2}, {"round": 2, "device_class": DEVICE_CLASS_CURRENT},
),
"storage_battery_voltage": (
"Battery voltage",
VOLT,
"vBat",
{"round": 2, "device_class": DEVICE_CLASS_VOLTAGE},
), ),
"storage_battery_voltage": ("Battery voltage", VOLT, "vBat", {"round": 2}),
"storage_load_percentage": ( "storage_load_percentage": (
"Load percentage", "Load percentage",
"%", "%",
"loadPercent", "loadPercent",
{"device_class": "battery", "round": 2}, {"device_class": DEVICE_CLASS_BATTERY, "round": 2},
), ),
} }