Skip to content

Commit

Permalink
fix #119
Browse files Browse the repository at this point in the history
  • Loading branch information
cereal2nd committed Aug 14, 2024
1 parent d670d25 commit ef904df
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions velbusaio/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ async def on_message(self, message: Message) -> None:
),
):
self._process_channel_name_message(1, message)
self._cache()
elif isinstance(
message,
(
Expand All @@ -274,6 +275,7 @@ async def on_message(self, message: Message) -> None:
),
):
self._process_channel_name_message(2, message)
self._cache()
elif isinstance(
message,
(
Expand All @@ -283,6 +285,7 @@ async def on_message(self, message: Message) -> None:
),
):
self._process_channel_name_message(3, message)
self._cache()
elif isinstance(message, MemoryDataMessage):
await self._process_memory_data_message(message)
elif isinstance(message, (RelayStatusMessage, RelayStatusMessage2)):
Expand Down Expand Up @@ -511,8 +514,6 @@ async def on_message(self, message: Message) -> None:
message.sensor, {"cur": message.value, "unit": message.unit}
)

self._cache()

async def _update_channel(self, channel: int, updates: dict):
try:
await self._channels[channel].update(updates)
Expand All @@ -538,7 +539,7 @@ async def load(self, from_cache: bool = False) -> None:
except OSError:
cache = {}
# load default channels
await self._load_default_channels()
await self.__load_default_channels()

# load the data from memory ( the stuff that we need)
if "name" in cache and cache["name"] != "":
Expand Down Expand Up @@ -722,7 +723,7 @@ async def __load_memory(self) -> None:
msg.low_address = addr[1]
await self._writer(msg)

async def _load_default_channels(self) -> None:
async def __load_default_channels(self) -> None:
if "Channels" not in self._data:
return

Expand Down Expand Up @@ -771,6 +772,7 @@ def __init__(
self.group_members: dict[int, set[int]] = {}

async def _load_default_channels(self) -> None:
await super().load()
for chan in range(1, 64 + 1):
self._channels[chan] = Channel(
self, chan, "placeholder", True, self._writer, self._address
Expand Down

0 comments on commit ef904df

Please sign in to comment.