Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tesla-powerwall to version 0.2.8 #34545

Merged
merged 2 commits into from
Apr 22, 2020

Conversation

jrester
Copy link
Contributor

@jrester jrester commented Apr 22, 2020

Proposed change

Update the powerwall library to version 0.2.8. This adds support for powerwall version 1.46.0, more fine grained version control and better error handling.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

@probot-home-assistant
Copy link

Hey there @bdraco, mind taking a look at this pull request as its been labeled with a integration (powerwall) you are listed as a codeowner for? Thanks!

@bdraco bdraco linked an issue Apr 22, 2020 that may be closed by this pull request
@bdraco bdraco self-requested a review April 22, 2020 16:02
@bdraco
Copy link
Member

bdraco commented Apr 22, 2020

Will test later today when things are less busy

@bdraco bdraco added this to the 0.109.0 milestone Apr 22, 2020
@bdraco
Copy link
Member

bdraco commented Apr 22, 2020

@jrester Seeing the below on update. Haven't had a chance to dig into whats going on.

ValueError: {'updating': False, 'commissioning_diagnostic': {'name': 'Commissioning', 'category': 'InternalComms', 'disruptive': False, 'inputs': None, 'checks': [{'name': 'CAN connectivity', 'status': 'fail', 'start_time': '2020-04-22T13:21:13.189764158-05:00', 'end_time': '2020-04-22T13:21:13.189767825-05:00', 'message': 'Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.', 'results': {}, 'debug': {}}, {'name': 'Firmware up-to-date', 'status': 'fail', 'start_time': '2020-04-22T13:21:13.189770158-05:00', 'end_time': '2020-04-22T13:21:13.189772492-05:00', 'message': 'Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.', 'results': {}, 'debug': {}}]}, 'update_diagnostic': {'name': 'Firmware Update', 'category': 'InternalComms', 'disruptive': True, 'inputs': None, 'checks': [{'name': 'Synchronizer firmware', 'status': 'not_run', 'start_time': None, 'end_time': None, 'progress': 0, 'results': None, 'debug': None}, {'name': 'Grid code', 'status': 'not_run', 'start_time': None, 'end_time': None, 'progress': 0, 'results': None, 'debug': None}]}} is not a valid SyncType

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 216, in async_setup
    hass, self
  File "/config/custom_components/powerwall/__init__.py", line 100, in async_setup_entry
    powerwall_data = await hass.async_add_executor_job(call_base_info, power_wall)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/powerwall/__init__.py", line 140, in call_base_info
    serial_numbers = power_wall.get_serial_numbers()
  File "/usr/local/lib/python3.7/site-packages/tesla_powerwall/__init__.py", line 269, in get_serial_numbers
    for powerwall in self.get_powerwalls().powerwalls
  File "/usr/local/lib/python3.7/site-packages/tesla_powerwall/__init__.py", line 263, in get_powerwalls
    self._get("powerwalls"), no_check=self._dont_validate_response
  File "/usr/local/lib/python3.7/site-packages/tesla_powerwall/responses.py", line 284, in __init__
    super().__init__(json_response, no_check)
  File "/usr/local/lib/python3.7/site-packages/tesla_powerwall/responses.py", line 20, in __init__
    self._set_attrs(no_check)
  File "/usr/local/lib/python3.7/site-packages/tesla_powerwall/responses.py", line 29, in _set_attrs
    self._add_attr(attr, missing_attrs)
  File "/usr/local/lib/python3.7/site-packages/tesla_powerwall/responses.py", line 58, in _add_attr
    setattr(self, key, constructor(self.json_response[key]))
  File "/usr/local/lib/python3.7/enum.py", line 310, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.7/enum.py", line 564, in __new__
    raise exc
  File "/usr/local/lib/python3.7/enum.py", line 548, in __new__
    result = cls._missing_(value)
  File "/usr/local/lib/python3.7/enum.py", line 577, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: {'updating': False, 'commissioning_diagnostic': {'name': 'Commissioning', 'category': 'InternalComms', 'disruptive': False, 'inputs': None, 'checks': [{'name': 'CAN connectivity', 'status': 'fail', 'start_time': '2020-04-22T13:21:13.189764158-05:00', 'end_time': '2020-04-22T13:21:13.189767825-05:00', 'message': 'Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.', 'results': {}, 'debug': {}}, {'name': 'Firmware up-to-date', 'status': 'fail', 'start_time': '2020-04-22T13:21:13.189770158-05:00', 'end_time': '2020-04-22T13:21:13.189772492-05:00', 'message': 'Cannot perform this action with site controller running. From landing page, either "STOP SYSTEM" or "RUN WIZARD" to proceed.', 'results': {}, 'debug': {}}]}, 'update_diagnostic': {'name': 'Firmware Update', 'category': 'InternalComms', 'disruptive': True, 'inputs': None, 'checks': [{'name': 'Synchronizer firmware', 'status': 'not_run', 'start_time': None, 'end_time': None, 'progress': 0, 'results': None, 'debug': None}, {'name': 'Grid code', 'status': 'not_run', 'start_time': None, 'end_time': None, 'progress': 0, 'results': None, 'debug': None}]}} is not a valid SyncType

@jrester
Copy link
Contributor Author

jrester commented Apr 22, 2020

Could you post the response for https://<powerwall-api>/api/powerwalls?

@bdraco
Copy link
Member

bdraco commented Apr 22, 2020

{
	"enumerating": false,
	"updating": false,
	"checking_if_offgrid": false,
	"running_phase_detection": false,
	"phase_detection_last_error": "phase detection not run",
	"bubble_shedding": false,
	"on_grid_check_error": "on grid check not run",
	"grid_qualifying": false,
	"grid_code_validating": false,
	"phase_detection_not_available": true,
	"powerwalls": [{
		"PackagePartNumber": "2012170-53-D",
		"PackageSerialNumber": "XXXXXXXX",
		"type": "acpw",
		"grid_state": "Grid_Uncompliant",
		"grid_reconnection_time_seconds": 0,
		"under_phase_detection": false,
		"updating": false,
		"commissioning_diagnostic": {
			"name": "Commissioning",
			"category": "InternalComms",
			"disruptive": false,
			"inputs": null,
			"checks": [{
				"name": "CAN connectivity",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424145449-05:00",
				"end_time": "2020-04-22T13:44:48.424149449-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Enable switch",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424152116-05:00",
				"end_time": "2020-04-22T13:44:48.424154116-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Internal communications",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424157449-05:00",
				"end_time": "2020-04-22T13:44:48.424159782-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Firmware up-to-date",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424161782-05:00",
				"end_time": "2020-04-22T13:44:48.424164116-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}]
		},
		"update_diagnostic": {
			"name": "Firmware Update",
			"category": "InternalComms",
			"disruptive": true,
			"inputs": null,
			"checks": [{
				"name": "Powerwall firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Battery firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Inverter firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Grid code",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}]
		}
	}, {
		"PackagePartNumber": "2012170-53-D",
		"PackageSerialNumber": "XXXXXXXX",
		"type": "acpw",
		"grid_state": "Grid_Uncompliant",
		"grid_reconnection_time_seconds": 0,
		"under_phase_detection": false,
		"updating": false,
		"commissioning_diagnostic": {
			"name": "Commissioning",
			"category": "InternalComms",
			"disruptive": false,
			"inputs": null,
			"checks": [{
				"name": "CAN connectivity",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424325449-05:00",
				"end_time": "2020-04-22T13:44:48.424328449-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Enable switch",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424330782-05:00",
				"end_time": "2020-04-22T13:44:48.424332782-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Internal communications",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424335115-05:00",
				"end_time": "2020-04-22T13:44:48.424338449-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Firmware up-to-date",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424340449-05:00",
				"end_time": "2020-04-22T13:44:48.424343449-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}]
		},
		"update_diagnostic": {
			"name": "Firmware Update",
			"category": "InternalComms",
			"disruptive": true,
			"inputs": null,
			"checks": [{
				"name": "Powerwall firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Battery firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Inverter firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Grid code",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}]
		}
	}, {
		"PackagePartNumber": "2012170-53-D",
		"PackageSerialNumber": "XXXXXXXX",
		"type": "acpw",
		"grid_state": "Grid_Uncompliant",
		"grid_reconnection_time_seconds": 0,
		"under_phase_detection": false,
		"updating": false,
		"commissioning_diagnostic": {
			"name": "Commissioning",
			"category": "InternalComms",
			"disruptive": false,
			"inputs": null,
			"checks": [{
				"name": "CAN connectivity",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424489115-05:00",
				"end_time": "2020-04-22T13:44:48.424492115-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Enable switch",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424494448-05:00",
				"end_time": "2020-04-22T13:44:48.424496781-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Internal communications",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424499115-05:00",
				"end_time": "2020-04-22T13:44:48.424501115-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Firmware up-to-date",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424503448-05:00",
				"end_time": "2020-04-22T13:44:48.424505448-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}]
		},
		"update_diagnostic": {
			"name": "Firmware Update",
			"category": "InternalComms",
			"disruptive": true,
			"inputs": null,
			"checks": [{
				"name": "Powerwall firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Battery firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Inverter firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Grid code",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}]
		}
	}, {
		"PackagePartNumber": "2012170-53-D",
		"PackageSerialNumber": "XXXXXXXX",
		"type": "acpw",
		"grid_state": "Grid_Uncompliant",
		"grid_reconnection_time_seconds": 0,
		"under_phase_detection": false,
		"updating": false,
		"commissioning_diagnostic": {
			"name": "Commissioning",
			"category": "InternalComms",
			"disruptive": false,
			"inputs": null,
			"checks": [{
				"name": "CAN connectivity",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424665114-05:00",
				"end_time": "2020-04-22T13:44:48.424669448-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Enable switch",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424671448-05:00",
				"end_time": "2020-04-22T13:44:48.424673781-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Internal communications",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424675781-05:00",
				"end_time": "2020-04-22T13:44:48.424678114-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Firmware up-to-date",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424680114-05:00",
				"end_time": "2020-04-22T13:44:48.424682448-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}]
		},
		"update_diagnostic": {
			"name": "Firmware Update",
			"category": "InternalComms",
			"disruptive": true,
			"inputs": null,
			"checks": [{
				"name": "Powerwall firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Battery firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Inverter firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Grid code",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}]
		}
	}, {
		"PackagePartNumber": "2012170-53-D",
		"PackageSerialNumber": "XXXXXXXX",
		"type": "acpw",
		"grid_state": "Grid_Uncompliant",
		"grid_reconnection_time_seconds": 0,
		"under_phase_detection": false,
		"updating": false,
		"commissioning_diagnostic": {
			"name": "Commissioning",
			"category": "InternalComms",
			"disruptive": false,
			"inputs": null,
			"checks": [{
				"name": "CAN connectivity",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424821447-05:00",
				"end_time": "2020-04-22T13:44:48.424824781-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Enable switch",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424827114-05:00",
				"end_time": "2020-04-22T13:44:48.424829447-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Internal communications",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424831781-05:00",
				"end_time": "2020-04-22T13:44:48.424833781-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Firmware up-to-date",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424835781-05:00",
				"end_time": "2020-04-22T13:44:48.424838114-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}]
		},
		"update_diagnostic": {
			"name": "Firmware Update",
			"category": "InternalComms",
			"disruptive": true,
			"inputs": null,
			"checks": [{
				"name": "Powerwall firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Battery firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Inverter firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Grid code",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}]
		}
	}],
	"has_sync": true,
	"sync": {
		"updating": false,
		"commissioning_diagnostic": {
			"name": "Commissioning",
			"category": "InternalComms",
			"disruptive": false,
			"inputs": null,
			"checks": [{
				"name": "CAN connectivity",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.424931114-05:00",
				"end_time": "2020-04-22T13:44:48.424934114-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}, {
				"name": "Firmware up-to-date",
				"status": "fail",
				"start_time": "2020-04-22T13:44:48.42493678-05:00",
				"end_time": "2020-04-22T13:44:48.424939114-05:00",
				"message": "Cannot perform this action with site controller running. From landing page, either \"STOP SYSTEM\" or \"RUN WIZARD\" to proceed.",
				"results": {},
				"debug": {}
			}]
		},
		"update_diagnostic": {
			"name": "Firmware Update",
			"category": "InternalComms",
			"disruptive": true,
			"inputs": null,
			"checks": [{
				"name": "Synchronizer firmware",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}, {
				"name": "Grid code",
				"status": "not_run",
				"start_time": null,
				"end_time": null,
				"progress": 0,
				"results": null,
				"debug": null
			}]
		}
	},
	"states": []
}

@jrester jrester force-pushed the powerwall-upgrade branch from 32fa46b to 34be199 Compare April 22, 2020 19:23
@jrester jrester changed the title Update tesla-powerwall to version 0.2.7 Update tesla-powerwall to version 0.2.8 Apr 22, 2020
@bdraco
Copy link
Member

bdraco commented Apr 22, 2020

Retesting

Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrester All good now. Nice work!

@bdraco bdraco merged commit dbd1ca4 into home-assistant:dev Apr 22, 2020
@jrester
Copy link
Contributor Author

jrester commented Apr 23, 2020

@bdraco Great, thanks!

balloob pushed a commit that referenced this pull request Apr 23, 2020
* Update tesla-powerwall to version 0.2.7

* Update tesla-powerwall to version 0.2.8
@lock lock bot locked and limited conversation to collaborators Apr 25, 2020
@bdraco bdraco linked an issue Apr 28, 2020 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Powerwall Integration error on reboot Powerwall doesn't show any sensor when the utility data is missing
4 participants