Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Normalize MAC address to lower case using prepareConfig #7

Merged
merged 2 commits into from
Oct 17, 2016

Conversation

mwittig
Copy link

@mwittig mwittig commented Oct 15, 2016

This will automatically normalize the MAC address to lower case before the device is instantiated. This way, user can also provide the MAC address using upper case letters.

See also https://forum.pimatic.org/topic/2327/pimatic-dash-button-problem

@michbeck100
Copy link
Owner

What about hyphen vs colon?

@mwittig
Copy link
Author

mwittig commented Oct 15, 2016

Good point. Actually, there are even more format derivations https://community.spiceworks.com/topic/932330-mac-address-format-what-s-the-standard-why-don-t-vendors-stick-to-it

@mwittig
Copy link
Author

mwittig commented Oct 15, 2016

Here is my proposal for simple MAC address validation and transformation.
https://jsfiddle.net/WittigMarcus/d7hyezwm/

It covers all cases of the aforementioned post, but MACs without leading '0's like ab-2-cd-4-ef-56 will be regarded as an error. I'll extend my PR accordingly.

@michbeck100
Copy link
Owner

Perfect, thanks

@michbeck100 michbeck100 merged commit eb533be into michbeck100:master Oct 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants