Powerwall add Current attribute (#50550)

This commit is contained in:
Barry Quiel 2021-05-13 09:12:48 -07:00 committed by GitHub
parent 136b34af20
commit c079803fcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 6 deletions

View file

@ -176,7 +176,7 @@ async def _async_update_powerwall_data(
def _login_and_fetch_base_info(power_wall: Powerwall, password: str): def _login_and_fetch_base_info(power_wall: Powerwall, password: str):
"""Login to the powerwall and fetch the base info.""" """Login to the powerwall and fetch the base info."""
if password is not None: if password is not None:
power_wall.login("", password) power_wall.login(password)
power_wall.detect_and_pin_version() power_wall.detect_and_pin_version()
return call_base_info(power_wall) return call_base_info(power_wall)

View file

@ -21,7 +21,7 @@ _LOGGER = logging.getLogger(__name__)
def _login_and_fetch_site_info(power_wall: Powerwall, password: str): def _login_and_fetch_site_info(power_wall: Powerwall, password: str):
"""Login to the powerwall and fetch the base info.""" """Login to the powerwall and fetch the base info."""
if password is not None: if password is not None:
power_wall.login("", password) power_wall.login(password)
power_wall.detect_and_pin_version() power_wall.detect_and_pin_version()
return power_wall.get_site_info() return power_wall.get_site_info()

View file

@ -12,6 +12,7 @@ ATTR_FREQUENCY = "frequency"
ATTR_ENERGY_EXPORTED = "energy_exported_(in_kW)" ATTR_ENERGY_EXPORTED = "energy_exported_(in_kW)"
ATTR_ENERGY_IMPORTED = "energy_imported_(in_kW)" ATTR_ENERGY_IMPORTED = "energy_imported_(in_kW)"
ATTR_INSTANT_AVERAGE_VOLTAGE = "instant_average_voltage" ATTR_INSTANT_AVERAGE_VOLTAGE = "instant_average_voltage"
ATTR_INSTANT_TOTAL_CURRENT = "instant_total_current"
ATTR_IS_ACTIVE = "is_active" ATTR_IS_ACTIVE = "is_active"
STATUS_VERSION = "version" STATUS_VERSION = "version"

View file

@ -3,7 +3,7 @@
"name": "Tesla Powerwall", "name": "Tesla Powerwall",
"config_flow": true, "config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/powerwall", "documentation": "https://www.home-assistant.io/integrations/powerwall",
"requirements": ["tesla-powerwall==0.3.5"], "requirements": ["tesla-powerwall==0.3.10"],
"codeowners": ["@bdraco", "@jrester"], "codeowners": ["@bdraco", "@jrester"],
"dhcp": [ "dhcp": [
{ {

View file

@ -11,6 +11,7 @@ from .const import (
ATTR_ENERGY_IMPORTED, ATTR_ENERGY_IMPORTED,
ATTR_FREQUENCY, ATTR_FREQUENCY,
ATTR_INSTANT_AVERAGE_VOLTAGE, ATTR_INSTANT_AVERAGE_VOLTAGE,
ATTR_INSTANT_TOTAL_CURRENT,
ATTR_IS_ACTIVE, ATTR_IS_ACTIVE,
DOMAIN, DOMAIN,
ENERGY_KILO_WATT, ENERGY_KILO_WATT,
@ -144,6 +145,7 @@ class PowerWallEnergySensor(PowerWallEntity, SensorEntity):
ATTR_FREQUENCY: round(meter.frequency, 1), ATTR_FREQUENCY: round(meter.frequency, 1),
ATTR_ENERGY_EXPORTED: meter.get_energy_exported(), ATTR_ENERGY_EXPORTED: meter.get_energy_exported(),
ATTR_ENERGY_IMPORTED: meter.get_energy_imported(), ATTR_ENERGY_IMPORTED: meter.get_energy_imported(),
ATTR_INSTANT_AVERAGE_VOLTAGE: round(meter.avarage_voltage, 1), ATTR_INSTANT_AVERAGE_VOLTAGE: round(meter.average_voltage, 1),
ATTR_INSTANT_TOTAL_CURRENT: meter.get_instant_total_current(),
ATTR_IS_ACTIVE: meter.is_active(), ATTR_IS_ACTIVE: meter.is_active(),
} }

View file

@ -2220,7 +2220,7 @@ temperusb==1.5.3
# tensorflow==2.3.0 # tensorflow==2.3.0
# homeassistant.components.powerwall # homeassistant.components.powerwall
tesla-powerwall==0.3.5 tesla-powerwall==0.3.10
# homeassistant.components.tesla # homeassistant.components.tesla
teslajsonpy==0.18.3 teslajsonpy==0.18.3

View file

@ -1189,7 +1189,7 @@ systembridge==1.1.5
tellduslive==0.10.11 tellduslive==0.10.11
# homeassistant.components.powerwall # homeassistant.components.powerwall
tesla-powerwall==0.3.5 tesla-powerwall==0.3.10
# homeassistant.components.tesla # homeassistant.components.tesla
teslajsonpy==0.18.3 teslajsonpy==0.18.3