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

Add wrapper function for machine id #11

Closed
brainelectronics opened this issue Mar 20, 2022 · 1 comment
Closed

Add wrapper function for machine id #11

brainelectronics opened this issue Mar 20, 2022 · 1 comment

Comments

@brainelectronics
Copy link
Owner

Use function of https://github.com/brainelectronics/Micropython-ESP-WiFi-Manager/blob/b5d355cba0e479049a78a081bc99d5f3367d5e53/wifi_manager/wifi_manager.py#L69 to generate a unique id of specified length. Default is standard length. To be used in brainelectronics/MyEVSE-Webinterface#9

@brainelectronics
Copy link
Owner Author

Extend function to return also the last n character as follows

amount = abs(length) // uuid_len + (abs(length) % uuid_len > 0)
if length < 0:
    return (uuid * amount)[-length:]
else:
    return (uuid * amount)[:length]

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

1 participant