Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre0512 committed Mar 8, 2023
1 parent c4d21be commit f52f847
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Empty file added pyhon/appliances/__init__.py
Empty file.
11 changes: 6 additions & 5 deletions pyhon/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,24 @@ def __getitem__(self, item):
if "." in item:
result = self.data
for key in item.split("."):
if all([k in "0123456789" for k in key]):
if all([k in "0123456789" for k in key]) and type(result) is list:
result = result[int(key)]
else:
result = result[key]
return result
else:
if item in self.data:
return self.data[item]
return self.attributes["parameters"].get(item, self.appliance[item])
if item in self.attributes["parameters"]:
return self.attributes["parameters"].get(item)
return self.appliance[item]

def get(self, item, default=None):
try:
return self[item]
except KeyError | IndexError:
except (KeyError, IndexError):
return default


@property
def appliance_model_id(self):
return self._appliance.get("applianceModelId")
Expand Down Expand Up @@ -127,7 +128,7 @@ async def update(self):
@property
def data(self):
result = {"attributes": self.attributes, "appliance": self.appliance, "statistics": self.statistics,
"commands": self.parameters}
**self.parameters}
if self._extra:
return result | self._extra.Appliance(result).get()
return result
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="pyhOn",
version="0.3.1",
version="0.3.2",
author="Andre Basche",
description="Control hOn devices with python",
long_description=long_description,
Expand Down

0 comments on commit f52f847

Please sign in to comment.