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

Altertative method to configure parameters in node #12

Closed
gmag11 opened this issue Oct 11, 2020 · 1 comment
Closed

Altertative method to configure parameters in node #12

gmag11 opened this issue Oct 11, 2020 · 1 comment
Labels
question Further information is requested

Comments

@gmag11
Copy link
Owner

gmag11 commented Oct 11, 2020

@quangvankts asked in #11

How do I hardcode network name and network key for both nodes and gateway so I don't have to configure them individually after flashing?

@gmag11
Copy link
Owner Author

gmag11 commented Oct 11, 2020

You may upload configuration to SPIFFS using data upload on Arduino or Platformio.

File name is "config.json".

Format is like this:

{
  "networkName": "You_network",
  "networkKey": [  decimal number array with sha256 of key  ],
  "sleepTime": 10,
  "gateway": "Gateway mac address",
  "nodeName": "Your_node"
}

Plain network key is encoded as ASCII characters filled up to 32 characters with 0x00. For instance: if your key is 1234567890 hex equivalent is 3132333435363738393000000000000000000000000000000000000000000000

You may calculate sha256 using online converter as https://emn178.github.io/online-tools/sha256.html

Result hash is a53d6c160dc1358d307786f8c78b8446ec395da65ddd00e069bc81beb51c2f25

So networkKey field in file should be:

[ 165, 61, 108, 22, 13, 193, 53, 141, 48, 119, 134, 248, 199, 139, 132, 70, 236, 57, 93, 166, 93, 221, 0, 224, 105, 188, 129, 190, 181, 28, 47, 37 ]

It is not simple but is feasible. Sorry, it was not designed to be done so.

You may program a simple Python script to build your JSON file. If you do so please share it here so I can include it in repo.

@gmag11 gmag11 closed this as completed Oct 11, 2020
@gmag11 gmag11 added the question Further information is requested label Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant