custom-components / zaptec

zaptec charger custom component for home assistant
MIT License
67 stars 20 forks source link

Cannot setup zaptec (TypeError: 'NoneType' object is not subscriptable) #14

Closed roflmao closed 1 year ago

roflmao commented 3 years ago

Got a new charger (Zaptec Pro iirc) setup today, only with accesslevel "User", dont know if this is causing the issues

Version: 0.0.3

Logs:

2021-10-20 10:57:11 ERROR (MainThread) [custom_components.zaptec.api] Could not get info from https://api.zaptec.com/api/installation: 
2021-10-20 10:57:11 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Zaptec for zaptec
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/zaptec/__init__.py", line 68, in async_setup_entry
    await _dry_setup(hass, entry.data)
  File "/config/custom_components/zaptec/__init__.py", line 44, in _dry_setup
    await acc.build()
  File "/config/custom_components/zaptec/api.py", line 438, in build
    for data in installations["Data"]:
TypeError: 'NoneType' object is not subscriptable
roflmao commented 3 years ago

Ive now gotten owner rights, but still got no zaptec entity. https://www.jottacloud.com/s/0069af3704f50624d4fbb3d00de0e254ea4

logs:

2021-10-28 10:06:19 INFO (MainThread) [custom_components.zaptec] 
-------------------------------------------------------------------
zaptec
Version: 0.0.4
This is a custom component
If you have any issues with this you need to open an issue here:
https://github.com/custom-components/zaptec/issues
-------------------------------------------------------------------

2021-10-28 10:06:19 DEBUG (MainThread) [custom_components.zaptec.api] Update remaps
2021-10-28 10:06:19 DEBUG (MainThread) [custom_components.zaptec.services] Setting up services.
2021-10-28 10:06:19 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.zaptec
2021-10-28 10:06:20 DEBUG (MainThread) [custom_components.zaptec] hourly_update 2021-10-28 08:06:20.687302+00:00
2021-10-28 10:06:24 DEBUG (MainThread) [custom_components.zaptec] hourly_update 2021-10-28 08:06:24.377055+00:00
Hellowlol commented 3 years ago

Can you logon to https://portal.zaptec.com and post a image of installasjoner and ladere?

roflmao commented 3 years ago

I have no "Installations", only "Owner,User" for my charger: https://www.jottacloud.com/s/006587888a7f9d64a4d972b13a536fd7ef7

Hellowlol commented 3 years ago

You will not be able to use this package then. We use live data from "installation" as Azure service bus is the only live data that is in the public API. I know that the portal has a /live endpoint and uses signalr but this isnt documented in the the API.

Hellowlol commented 3 years ago

If you don't mind me asking? Why don't you have access to everything. Is this a shared install? If your willing to do some testing, i might be able to use signalr to get live data from the charger.

roflmao commented 3 years ago

This is a shared garage setup, and im not an admin. Im willing to test for sure.

Hellowlol commented 2 years ago

I have tested signalr connect now and unfortunately, the only info I get there "live" is total_charge_power_session which is pretty useless IMO :/

Example output from the signalr connection:

{"type":1,"target":"notifyObservation","arguments":[
    "ZCHXXXXXX",
    {
      "ObservationId": 553,
      "ObservedAt": "2022-02-07T20:52:01.773343Z",
      "Value": "24.506",
      "OldValue": "24.444"
    }]}

It's strange that the integration didn't throw an exception. Do you mind turning on debug logging on the component and posting the log?

sveinse commented 1 year ago

In my experience a Zaptec user with the unprivileged access rights "User" is very limited. Even on portal.zaptec.com, there isn't much that user is able to do. The user can observe the status of charging through the API, but it doesn't seem possible to interact with the charger. I have tried that on my Zaptec Go and the commands just bounces on me.

The newest version of zaptec that I'm working on, tracked in PR #56 fixes the issue of using zaptec with an unprivileged user. It is at beta test in my fork at https://github.com/sveinse/zaptec and is installable via HACS (yet I'd be careful on production environments). See the URL for instructions if you want to give it a go. I'm grateful for all feedback I can get.

sveinse commented 1 year ago

The 0.7.0 have now been released which works when being used with unprivileged user.

Is this issue still valid? If it isn't, I'd like to close the issue.