Use parameter optional
This commit is contained in:
parent
9594b9ebd8
commit
d4c6ccdce3
3 changed files with 10 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
|||
import importlib
|
||||
import logging
|
||||
from contextlib import suppress
|
||||
from typing import Optional, Dict, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
@ -11,6 +12,9 @@ if TYPE_CHECKING:
|
|||
from pyhon import HonAPI
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class HonAppliance:
|
||||
def __init__(
|
||||
self, api: Optional["HonAPI"], info: Dict[str, Any], zone: int = 0
|
||||
|
@ -183,7 +187,10 @@ class HonAppliance:
|
|||
|
||||
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):
|
||||
|
|
|
@ -12,7 +12,7 @@ from pyhon.connection.auth import HonAuth
|
|||
from pyhon.connection.handler.anonym import HonAnonymousConnectionHandler
|
||||
from pyhon.connection.handler.hon import HonConnectionHandler
|
||||
|
||||
_LOGGER = logging.getLogger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class HonAPI:
|
||||
|
|
2
setup.py
2
setup.py
|
@ -7,7 +7,7 @@ with open("README.md", "r") as f:
|
|||
|
||||
setup(
|
||||
name="pyhOn",
|
||||
version="0.8.5",
|
||||
version="0.8.6",
|
||||
author="Andre Basche",
|
||||
description="Control hOn devices with python",
|
||||
long_description=long_description,
|
||||
|
|
Loading…
Reference in a new issue