Fix none-type attributes

This commit is contained in:
Andre Basche 2023-05-08 02:23:48 +02:00
parent 8e16b4a215
commit 022da71800
2 changed files with 4 additions and 2 deletions

View file

@ -7,6 +7,7 @@ from typing import TYPE_CHECKING
from pyhon import helper, exceptions from pyhon import helper, exceptions
from pyhon.commands import HonCommand from pyhon.commands import HonCommand
from pyhon.parameter.base import HonParameter
from pyhon.parameter.fixed import HonParameterFixed from pyhon.parameter.fixed import HonParameterFixed
if TYPE_CHECKING: if TYPE_CHECKING:
@ -33,6 +34,7 @@ class HonAppliance:
self._zone: int = zone self._zone: int = zone
self._additional_data: Dict[str, Any] = {} self._additional_data: Dict[str, Any] = {}
self._last_update = None self._last_update = None
self._default_setting = HonParameter("", {}, "")
try: try:
self._extra = importlib.import_module( self._extra = importlib.import_module(
@ -229,7 +231,7 @@ class HonAppliance:
result = {} result = {}
for name, command in self._commands.items(): for name, command in self._commands.items():
for key in command.setting_keys: for key in command.setting_keys:
setting = command.settings.get(key) setting = command.settings.get(key, self._default_setting)
result[f"{name}.{key}"] = setting result[f"{name}.{key}"] = setting
if self._extra: if self._extra:
return self._extra.settings(result) return self._extra.settings(result)

View file

@ -7,7 +7,7 @@ with open("README.md", "r") as f:
setup( setup(
name="pyhOn", name="pyhOn",
version="0.10.5", version="0.10.6",
author="Andre Basche", author="Andre Basche",
description="Control hOn devices with python", description="Control hOn devices with python",
long_description=long_description, long_description=long_description,