Skip to content

Commit

Permalink
Use parameter optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre0512 committed Apr 23, 2023
1 parent 9594b9e commit d4c6ccd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion pyhon/appliance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import importlib
import logging
from contextlib import suppress
from typing import Optional, Dict, Any
from typing import TYPE_CHECKING
Expand All @@ -11,6 +12,9 @@
from pyhon import HonAPI


_LOGGER = logging.getLogger(__name__)


class HonAppliance:
def __init__(
self, api: Optional["HonAPI"], info: Dict[str, Any], zone: int = 0
Expand Down Expand Up @@ -183,7 +187,10 @@ def parameters(self):

async def load_attributes(self):
self._attributes = await self._api.load_attributes(self)
for name, values in self._attributes.pop("shadow").get("parameters").items():
_LOGGER.warning(self._attributes)
for name, values in (
self._attributes.pop("shadow", {}).get("parameters", {}).items()
):
self._attributes.setdefault("parameters", {})[name] = values["parNewVal"]

async def load_statistics(self):
Expand Down
2 changes: 1 addition & 1 deletion pyhon/connection/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pyhon.connection.handler.anonym import HonAnonymousConnectionHandler
from pyhon.connection.handler.hon import HonConnectionHandler

_LOGGER = logging.getLogger()
_LOGGER = logging.getLogger(__name__)


class HonAPI:
Expand Down
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.8.5",
version="0.8.6",
author="Andre Basche",
description="Control hOn devices with python",
long_description=long_description,
Expand Down

0 comments on commit d4c6ccd

Please sign in to comment.