Skip to content

Commit

Permalink
have a Default class for unknown Calaos IOs
Browse files Browse the repository at this point in the history
(so that we can test that a device is unknown specifically,
which cannot be done when it directly uses the Item class)
  • Loading branch information
tiramiseb committed May 20, 2023
1 parent cef3d97 commit 153a2a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pycalaos/item/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging

from .common import Item

from .common import Default
from . import io

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -32,4 +31,4 @@ def new_item(data, room, conn):
return types[data["type"]](data, room, conn)
except:
_LOGGER.error(f"Unknown Calaos item type, using generic item for: {data}")
return Item(data, room, conn)
return Default(data, room, conn)
4 changes: 4 additions & 0 deletions pycalaos/item/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,7 @@ def _update_state(self):

def _translate(self, state):
return state


class Default(Item):
pass

0 comments on commit 153a2a0

Please sign in to comment.