aequitas / python-rflink

MIT License
30 stars 27 forks source link

Underscores #49

Closed jgrob1 closed 4 years ago

jgrob1 commented 4 years ago

I have entered this into the HA WTH forum here: https://community.home-assistant.io/t/wth-is-rflink-doing-with-underscores/221658

I am trying to use a protocol that includes an underscore (Dooya_v4) to control some blinds. The additional underscore confuses the parsing and I get the following from the HA log:

2020-08-24 18:39:51 DEBUG (MainThread) [homeassistant.components.rflink] Rflink command for {'command': 'on', 'device_id': 'dooya_v4_6d5f8e00_3f'} 2020-08-24 18:39:51 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2815618640] Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 125, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1308, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1343, in _execute_service await handler.func(service_call) File "/usr/src/homeassistant/homeassistant/components/rflink/__init__.py", line 134, in async_send_command await RflinkCommand.send_command( File "/usr/src/homeassistant/homeassistant/components/rflink/__init__.py", line 457, in send_command return await cls._protocol.send_command_ack(device_id, action) File "/usr/local/lib/python3.8/site-packages/rflink/protocol.py", line 223, in send_command_ack self.send_command(device_id, action) File "/usr/local/lib/python3.8/site-packages/rflink/protocol.py", line 186, in send_command command = deserialize_packet_id(device_id) File "/usr/local/lib/python3.8/site-packages/rflink/parser.py", line 459, in deserialize_packet_id assert len(id_switch) < 3 AssertionError

I'm not sure how easy this would be to fix? I am a massive fan of this component. Thanks so much for your work. I'm starting a course to learn Python but I cant be of much help currently.

aequitas commented 4 years ago

There is not really a defined protocol for rflink, so these things crop up from time to time. I added a an exception to handling this in the parser https://github.com/aequitas/python-rflink/commit/18b19a8c6b59731295ea6b2bb32dcf9d0443325f Once it has passed the tests and a new version is automatically created you can create a pull request at home-assistant to have the new version bumbed there.