diff --git a/zwave_js_server/model/value.py b/zwave_js_server/model/value.py index 3a189dc0..2841d502 100644 --- a/zwave_js_server/model/value.py +++ b/zwave_js_server/model/value.py @@ -2,6 +2,7 @@ from __future__ import annotations from dataclasses import dataclass, field +from enum import StrEnum from typing import TYPE_CHECKING, Any, TypedDict from ..const import VALUE_UNKNOWN, CommandClass, ConfigurationValueType, SetValueStatus @@ -13,6 +14,15 @@ from .node import Node +class ValueType(StrEnum): + """Enum with all value types.""" + + ANY = "any" + BOOLEAN = "boolean" + NUMBER = "number" + STRING = "string" + + class MetaDataType(TypedDict, total=False): """Represent a metadata data dict type.""" @@ -301,8 +311,9 @@ def configuration_value_type(self) -> ConfigurationValueType: max_ = self.metadata.max states = self.metadata.states allow_manual_entry = self.metadata.allow_manual_entry + type_ = self.metadata.type - if max_ == 1 and min_ == 0 and not states: + if (max_ == 1 and min_ == 0 or type_ == ValueType.BOOLEAN) and not states: return ConfigurationValueType.BOOLEAN if (