Skip to content

Commit d56be12

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents cb0baba + 0e2de3b commit d56be12

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyown/items/gateway/gateway.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import datetime
22
import ipaddress
3+
import logging
34
from asyncio import Task
45
from enum import StrEnum
56
from typing import Self, Any, Sequence
@@ -17,6 +18,9 @@
1718
]
1819

1920

21+
log = logging.getLogger("pyown.items.gateway")
22+
23+
2024
class GatewayModel(StrEnum):
2125
"""
2226
This enum is used to define the various models of gateways that are supported by the library.
@@ -32,15 +36,30 @@ class GatewayModel(StrEnum):
3236
F452V:
3337
MHServer2:
3438
H4684:
39+
MH202:
3540
"""
3641

42+
GENERIC = "0"
3743
MHServer = "2"
3844
MH200 = "4"
3945
F452 = "6"
4046
F452V = "7"
4147
MHServer2 = "11"
4248
H4684 = "12"
4349
HL4684 = "23"
50+
MH202 = "200"
51+
52+
@classmethod
53+
def _missing_(cls, value):
54+
"""
55+
This method is called when a value is not found in the enum.
56+
It returns the generic value if the value is not found.
57+
"""
58+
log.warning("The gateway model %s was not found in the known models.", value)
59+
log.warning(
60+
"Please, open an issue on GitHub, attach the logs and the model name."
61+
)
62+
return GatewayModel.GENERIC
4463

4564

4665
class WhatGateway(What, StrEnum):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pyown"
3-
version = "0.3.2"
3+
version = "0.3.3"
44
requires-python = ">=3.11"
55
description = "Python wrapper for OpenWebNet protocol"
66
authors = [

0 commit comments

Comments
 (0)