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

[Bug]: CLI duck-types all values for --set irrespective of the field's type #704

Open
misterpok opened this issue Nov 13, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@misterpok
Copy link

Category

Serial, WiFi

Hardware

T-Beam

Firmware Version

2.3.4.ea61808

Description

From the CLI, I set the psk to something with a leading zero. Reboot the device, the router does not get a DHCP request. Checking the psk, the leading zero has been dropped.

Disabling wifi, connecting via Bluetooth, then setting the psk is successful, and the CLI now reports the leading 0.

Relevant log output

pok@CENTCOMP:~/Downloads$ meshtastic --set network.wifi_psk 0123456789
Connected to radio
Set network.wifi_psk to 0123456789
Writing modified preferences to device
pok@CENTCOMP:~/Downloads$ meshtastic --get network.wifi_psk
Connected to radio
network.wifi_psk: 123456789
Completed getting preferences
@misterpok misterpok added the bug Something isn't working label Nov 13, 2024
@thebentern
Copy link
Contributor

Python is interpreting this value as a number. You probably need to quote to have it treat this is as a string

@thebentern thebentern transferred this issue from meshtastic/firmware Nov 13, 2024
@misterpok
Copy link
Author

misterpok commented Nov 13, 2024

Do you mean simply adding quotes around the psk in the cli command? If so, I get the same result.

pok@CENTCOMP:~/Downloads$ meshtastic --set network.wifi_psk "0987654321"
Connected to radio
Set network.wifi_psk to 0987654321
Writing modified preferences to device
pok@CENTCOMP:~/Downloads$ meshtastic --get network.wifi_psk
Connected to radio
network.wifi_psk: 987654321
Completed getting preferences

@ianmcorvidae
Copy link
Contributor

Yeah, I see the issue here. We'll need to update the code to be aware of the type of the field it's setting; right now it just blindly tries to convert to bytes (with 0x or base64: prefix), boolean (with t, true, yes, f, false, no), int, or float.

@ianmcorvidae ianmcorvidae changed the title [Bug]: On CLI, leading 0 on wifi PSKs gets dropped [Bug]: CLI duck-types all values for --set irrespective of the field's type Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants