manzanotti/geniushub-client

Zone with missing type key

Opened this issue · 6 comments

I have a Genius Hub with an added OpenTherm Board (a beta trial they ran). That has added an extra zone for the boiler but without a type key returned from the api. I have emailed Genius Hub asking them to add one but no response as yet.
Would you accept a PR to check that the type key exists? I am currently getting the following error:

Logger: geniushubclient.zone
Source: /usr/local/lib/python3.10/site-packages/geniushubclient/zone.py:184 
First occurred: 12:18:41 (4 occurrences) 
Last logged: 12:21:41

Failed to convert Zone 1.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/geniushubclient/zone.py", line 145, in data
    result["type"] = ITYPE_TO_TYPE[raw_json["iType"]]
KeyError: 7

The relevant part returned from /zones of the api:

{
    "id": 1,
    "name": "Ideal Vogue Max",
    "output": 0,
    "mode": "linked",
    "schedule": {
        "timer": {},
        "footprint": {}
    }
},

@warksit - out of curiosity, where is the '7' coming from in that error message?

@rbubley I'm not sure. If I could figure out how to override the geniushub-client in my home assistant install I would add some logging to find out the value of raw_json["iType"] when this is failing. I'm assuming it is the "Boiler Zone" that is causing the issue but I could be wrong.

I believe the bottom of this page https://developers.home-assistant.io/docs/creating_integration_file_structure/ tells you how to override an integration with a local copy. HTH.

I have successfully overridden the Genius Hub Home Assistant integration but can't figure out how to override this package which is a dependency of the HA integration.

There may be a more elegant way of doing this but I have managed to do it in the past by changing the requirements line in manifest.json to point to my fork of the library (using syntax as described here: https://stackoverflow.com/a/35998253/3796914 )

But for the problem you have, you might be better off cloning geniushub-client and using it directly outside of home assistant...

I'm trying to add better fallbacks when the client doesn't understand the data from the hub. I've done issues, but I think that zones and devices will have to be done after I've refactored those classes. I'd potentially like them both to create an issue if this happens.

Longer-term, maybe types could be over-ridden by the user, paving the way to allow adding types in Home Assistant.