Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pickle error on selectedprogram #69

Closed
Cereal2nd opened this issue Dec 2, 2022 · 9 comments
Closed

pickle error on selectedprogram #69

Cereal2nd opened this issue Dec 2, 2022 · 9 comments

Comments

@Cereal2nd
Copy link
Owner

DEBUG:velbus-protocol:RX: RawMessage(priority=fb, address=19, rtr=False, command=255, data=b'ff 17 eb f1 00 18 22')
DEBUG:velbus-packet:Received {"name": "ModuleTypeMessage", "priority": 251, "address": 25, "rtr": false, "data": "", "module_type": 23, "led_on": [], "led_slow_blinking": [], "led_fast_blinking": [], "serial": 60401, "memory_map_version": 0, "build_year": 24, "build_week": 34}
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-12' coro=<VelbusProtocol._process_message() done, defined at /home/cereal/home-assistant/venv/lib/python3.9/site-packages/velbusaio/protocol.py:167> exception=AttributeError("Can't get attribute 'SelectedProgram' on <module 'velbusaio.channels' from '/home/cereal/home-assistant/venv/lib/python3.9/site-packages/velbusaio/channels.py'>")>
Traceback (most recent call last):
  File "/home/cereal/home-assistant/venv/lib/python3.9/site-packages/velbusaio/protocol.py", line 169, in _process_message
    await self._message_received_callback(msg)
  File "/home/cereal/home-assistant/venv/lib/python3.9/site-packages/velbusaio/controller.py", line 55, in _on_message_received
    await self._handler.handle(msg)
  File "/home/cereal/home-assistant/venv/lib/python3.9/site-packages/velbusaio/handler.py", line 66, in handle
    await self._handle_module_type(msg)
  File "/home/cereal/home-assistant/venv/lib/python3.9/site-packages/velbusaio/handler.py", line 179, in _handle_module_type
    await self._velbus.add_module(
  File "/home/cereal/home-assistant/venv/lib/python3.9/site-packages/velbusaio/controller.py", line 79, in add_module
    mod = self._load_module_from_cache(self._cache_dir, addr)
  File "/home/cereal/home-assistant/venv/lib/python3.9/site-packages/velbusaio/controller.py", line 113, in _load_module_from_cache
    return pickle.load(fl)
AttributeError: Can't get attribute 'SelectedProgram' on <module 'velbusaio.channels' from '/home/cereal/home-assistant/venv/lib/python3.9/site-packages/velbusaio/channels.py'>

@Cereal2nd
Copy link
Owner Author

@DannyDeGaspari
this is something i see since the merge of #66

@DannyDeGaspari
Copy link
Contributor

I'll try to reproduce it, did not get this error while testing. Maybe because I cleared the cache first?

@Cereal2nd
Copy link
Owner Author

nevermind indeed it was the cache ....

@DannyDeGaspari
Copy link
Contributor

I'm afraid HA users will bump into the same issue. Is there something foreseen on the HA side that with breaking cache releases of velbus-aio, the cache needs to be cleared ?

@Cereal2nd
Copy link
Owner Author

no, we will have to implement this

and befor this is implemented we can not upgrade, so i have a lot of work on the hass side:

  • implement the select platform for the "active program"
  • implement an upgrade path to forcely clean the cache (if needed, so we will have to implement some version compares)
  • upgrade to a new release

@DannyDeGaspari
Copy link
Contributor

Let me know if I can be of any help with testing.

@niobos
Copy link
Collaborator

niobos commented Dec 4, 2022

I've run into the same problem when developing. This is something that's on my "I'll need to fix this"-list, but haven't gotten around to.
I think the best way to solve this is to move from pickle to our own (de)serializer (e.g. JSON?), where the deserializer takes care of the upgrade path.

@Cereal2nd Should this be a separate Issue specifically for "Make deserializer from cache backward compatible"? Or can we re-purpose this issue for that?

@Cereal2nd
Copy link
Owner Author

We can do whatever we want reuse this one or create a new one.

But we either fix this asap, or we continue to handle this on the Hass side. On the Hass side this change is minimal and I have this almost implemented

If we fix this on the velbusaio side we need to have a solution before we can upgrade Hass to this newer version.

@niobos
Copy link
Collaborator

niobos commented Dec 4, 2022

I'll open a new issue, for the 'long term solution'; when and if we get around to that. Go ahead with the Hass-side fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants