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

Getting error in __open #235

Closed
giachello opened this issue Oct 18, 2021 · 3 comments
Closed

Getting error in __open #235

giachello opened this issue Oct 18, 2021 · 3 comments

Comments

@giachello
Copy link
Contributor

Hi. I am getting this error in __open:

2021-10-18 08:39:09 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[{"energy_site_id":184280630899,"resource_type":"solar","site_name":"Villa Madrona","id":"c7ff07a3-0dad-4b6a-a8d9-1674bd7d7385","asset_site_id":"33d9bc12-b870-4189-8ce7-c0799de0381d","solar_power":280,"solar_type":"pv_panel","sync_grid_alert_enabled":false,"breaker_alert_enabled":false,"components":{"battery":false,"solar":true,"solar_type":"pv_panel","grid":true,"load_meter":false,"market_type":"residential"}}],"count":1}
2021-10-18 08:39:09 DEBUG (MainThread) [teslajsonpy.controller] tasks [] False
2021-10-18 08:39:09 DEBUG (MainThread) [custom_components.tesla_custom] Connected to the Tesla API
2021-10-18 08:39:09 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.000 seconds (success: True)
2021-10-18 08:39:11 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.000 seconds (success: True)
2021-10-18 08:40:11 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 44 days, 20:21:46
2021-10-18 08:40:11 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/vehicles {}
2021-10-18 08:40:11 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[],"count":0}
2021-10-18 08:40:11 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 44 days, 20:21:46
2021-10-18 08:40:11 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {}
2021-10-18 08:40:11 DEBUG (MainThread) [teslajsonpy.connection] 200: {"response":[{"energy_site_id":184280630899,"resource_type":"solar","site_name":"Villa Madrona","id":"c7ff07a3-0dad-4b6a-a8d9-1674bd7d7385","asset_site_id":"33d9bc12-b870-4189-8ce7-c0799de0381d","solar_power":280,"solar_type":"pv_panel","sync_grid_alert_enabled":false,"breaker_alert_enabled":false,"components":{"battery":false,"solar":true,"solar_type":"pv_panel","grid":true,"load_meter":false,"market_type":"residential"}}],"count":1}
2021-10-18 08:40:11 DEBUG (MainThread) [teslajsonpy.controller] Updating 184280630899
2021-10-18 08:40:11 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 44 days, 20:21:46
2021-10-18 08:40:11 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/energy_sites/184280630899/live_status {'product_type': 'energy_sites'}
2021-10-18 08:40:11 ERROR (MainThread) [custom_components.tesla_custom] Unexpected error fetching tesla_custom data: get() got an unexpected keyword argument 'data'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/tesla_custom/__init__.py", line 286, in _async_update_data
    return await self.controller.update()
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 903, in update
    return any(await asyncio.gather(*tasks))
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 830, in _get_and_process_energysite_data
    data = await self.api(
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 166, in wake_up
    result = await wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/controller.py", line 1179, in api
    return await self.__connection.post("", method="get", data=kwargs, url=uri)
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/connection.py", line 167, in post
    return await self.__open(
  File "/usr/local/lib/python3.9/site-packages/teslajsonpy/connection.py", line 204, in __open
    resp = await getattr(self.websession, method)(
TypeError: get() got an unexpected keyword argument 'data'
2021-10-18 08:40:11 DEBUG (MainThread) [custom_components.tesla_custom] Finished fetching tesla_custom data in 0.152 seconds (success: False)
@giachello
Copy link
Contributor Author

I think it's related to the recent refactoring on API's @zabuldon .

@giachello
Copy link
Contributor Author

giachello commented Oct 18, 2021

you need to remove product_type=TESLA_PRODUCT_TYPE_ENERGY_SITES,
from line 834 of controller.py

@giachello
Copy link
Contributor Author

Works perfectly , Thank you @alandtse and @zabuldon !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant