dlarrick / pykumo

Python library to interact with Mitsubishi KumoCloud devices via their local API
MIT License
33 stars 12 forks source link

KumoCloudAccount._parse_unit() assumes raw JSON is dict of dicts, actual data includes list of dicts #14

Closed cjkrolak closed 2 years ago

cjkrolak commented 2 years ago

KumoCloudAccount._parse_unit() assumes raw JSON output is a dict of dicts, I'm seeing the value for the 'children' element is a list of dicts, so the iterating code within KumoCloudAccount._parse_unit() is failing because string indexes are not allowed for list indexing.

Is anyone using the KumoCloudAccount._parse_unit() static method today?

dlarrick commented 2 years ago

Hmm, I'm not sure I'm following. _parse_unit is called from within KumoCloudAccount._fetch_if_needed, which is the code that iterates through children. This code is most definitely always used when parsing the info returned from (or cached from) the Kumo servers. The only loop in _parse_unit is over the set of fields to extract so I'm not sure what you're referring to.

'children' is definitely a list of dicts in all the samples I have that I developed the code against, and has been that way from the beginning. Whatever problem you're seeing I think you've misdiagnosed it.

-Doug

cjkrolak commented 2 years ago

sorry my mistake reading the code, there is no issue