Skip to content

Add missing camel to snake conversion#698

Merged
ianmcorvidae merged 1 commit intomeshtastic:masterfrom
lachesis:lachesis/fix-remote-module-cfg-get
Oct 29, 2024
Merged

Add missing camel to snake conversion#698
ianmcorvidae merged 1 commit intomeshtastic:masterfrom
lachesis:lachesis/fix-remote-module-cfg-get

Conversation

@lachesis
Copy link
Contributor

Before this patch:

$ meshtastic --dest '!nodeid' --get external_notification
Connected to radio
Requesting current config from remote node (this can take a while).

ERROR file:stream_interface.py __reader line:191 Error while handling message from radio externalNotification
Traceback (most recent call last):
  File "/home/eswanson/.local/lib/python3.12/site-packages/meshtastic/stream_interface.py", line 189, in __reader
    self._handleFromRadio(self._rxBuf[HEADER_LEN:])
  File "/home/eswanson/.local/lib/python3.12/site-packages/meshtastic/mesh_interface.py", line 1097, in _handleFromRadio
    self._handlePacketFromRadio(fromRadio.packet)
  File "/home/eswanson/.local/lib/python3.12/site-packages/meshtastic/mesh_interface.py", line 1379, in _handlePacketFromRadio
    handler.callback(asDict)
  File "/home/eswanson/.local/lib/python3.12/site-packages/meshtastic/node.py", line 124, in onResponseRequestSettings
    raw_config = getattr(getattr(adminMessage['raw'], oneof), field)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: externalNotification. Did you mean: 'ExternalNotificationConfig'?
Completed getting preferences

There sure are a lot of 🐫 and 🐍 in this project.

@ianmcorvidae
Copy link
Contributor

Thanks for the fix! And yeah, the camel and snake conversions are rather pervasive and it's a bit annoying. Perhaps with some refactoring we could eventually make those be a purely command-line thing and standardize one way or the other, but the root of the issue is in the protobuf library itself (in that MessageToDict, by default, converts snake case to camel case, but most of the actual underlying protocol buffer definitions are using snake case). Anyway, glad you found an issue to squash, regardless!

@ianmcorvidae ianmcorvidae merged commit 1070d92 into meshtastic:master Oct 29, 2024
@codecov
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 60.49%. Comparing base (feca49f) to head (073274c).
Report is 14 commits behind head on master.

Files with missing lines Patch % Lines
meshtastic/node.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #698   +/-   ##
=======================================
  Coverage   60.49%   60.49%           
=======================================
  Files          24       24           
  Lines        3782     3782           
=======================================
  Hits         2288     2288           
  Misses       1494     1494           
Flag Coverage Δ
unittests 60.49% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

2 participants