Closed gmag11 closed 4 years ago
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.
@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?