From 42e5958a48fda1d4752368c5de57972b91f953e6 Mon Sep 17 00:00:00 2001 From: maxyvon Date: Fri, 26 Jan 2024 11:59:49 -0500 Subject: [PATCH] =?UTF-8?q?Changement=20de=20la=20valeur=20par=20d=C3=A9fa?= =?UTF-8?q?ult=20du=20get=5Fvalue=20de=20None=20=C3=A0=20'unknown'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyhilo/device/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyhilo/device/__init__.py b/pyhilo/device/__init__.py index 22e3124..ce48ade 100644 --- a/pyhilo/device/__init__.py +++ b/pyhilo/device/__init__.py @@ -5,6 +5,8 @@ from datetime import datetime from typing import TYPE_CHECKING, Any, Dict, Union, cast +from homeassistant.const import STATE_UNKNOWN + from pyhilo.const import ( HILO_DEVICE_ATTRIBUTES, HILO_LIST_ATTRIBUTES, @@ -150,7 +152,7 @@ def has_attribute(self, attr: str) -> bool: return next((True for k in self.supported_attributes if k.attr == attr), False) def get_value( - self, attribute: str, default: Union[str, int, float, None] = None + self, attribute: str, default: Union[str, int, float, None] = STATE_UNKNOWN ) -> Any: attr = self.get_attribute(attribute) return attr.value if attr else default