This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
|
oak:tutorials:localserver [2016/10/25 19:58] digistump [1. Convert the server's public key to the DER format and then Base64 Encode it] |
oak:tutorials:localserver [2016/12/08 21:38] pfeerick mis-numbered steps |
||
|---|---|---|---|
| Line 30: | Line 30: | ||
| ===== Installing the Particle CLI Tool ===== | ===== Installing the Particle CLI Tool ===== | ||
| - | * With node installed in the last step you can install the Particle CLI tool with this command: | + | * With node installed in the last step you can install the Particle CLI tool with this command: <code>npm install -g particle-cli</code> |
| - | <code>npm install -g particle-cli</code> | + | |
| + | * If you are on the Raspberry Pi, you will need to use the following command so that the serialport dependency is successfully compiled as there are no pre-compiled binaries for the Raspberry Pi/ARM platform: <code>sudo npm install -g particle-cli --unsafe-perm --build-from-source</code> | ||
| ===== Setting up an Oak to use the Local Server ===== | ===== Setting up an Oak to use the Local Server ===== | ||
| Line 53: | Line 55: | ||
| and then use a base64 encoder (locally for best safety) or here for convenience: http://bin-hex-converter.online-domain-tools.com/ | and then use a base64 encoder (locally for best safety) or here for convenience: http://bin-hex-converter.online-domain-tools.com/ | ||
| - | Upload the default_key.der and get the encoded output, save this somewhere, you will need it in the next step. | + | Upload the default_key.pub.der and get the hex encoded output, save this somewhere, you will need it in the next step. |
| ==== 2. Set the Server Address and Server Public Key for the Oak ==== | ==== 2. Set the Server Address and Server Public Key for the Oak ==== | ||
| Line 70: | Line 72: | ||
| - | ==== 3. Set the Particle CLI tool to allow it to talk to the local server ==== | + | ==== 3. Copy the device Public Key to the Server ==== |
| + | |||
| + | In the server folder create a core_keys folder if it does not exist. | ||
| + | |||
| + | While still connected to the Oak that is in config mode go to http://192.168.0.1/device-id - you should get a response like this: | ||
| + | |||
| + | <code> | ||
| + | { "id":"ABCDEFGHJK","c":"1" } | ||
| + | </code> | ||
| + | |||
| + | Where "ABCDEFGHJK" is the device ID for this device - copy this without the quotes, you will need it to complete the rest of this step. | ||
| + | |||
| + | Now go to http://192.168.0.1/public-key - you should get a response like this: | ||
| + | <code> | ||
| + | { "r": 0, "b":"AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ" } | ||
| + | </code> | ||
| + | |||
| + | Where "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ" is a string of numbers and letters that make up the hex encoded public key for the device. Copy this string without the quotes into a text editor and save as DEVICE_ID.pub.der - where DEVICE_ID is the device id you got above. | ||
| + | |||
| + | Upload it here (or use another hex decoder): http://bin-hex-converter.online-domain-tools.com/ and hit decode, then click download as binary file. Rename that download to DEVICE_ID.pub.pem and place in the core_keys directory you created above. | ||
| + | |||
| + | |||
| + | ==== 4. Set the Particle CLI tool to allow it to talk to the local server ==== | ||
| Source: https://docs.particle.io/support/troubleshooting/cloud-solutions/photon/ | Source: https://docs.particle.io/support/troubleshooting/cloud-solutions/photon/ | ||
| Line 85: | Line 109: | ||
| This adds the local server ip to the cli tool, switches to using it, and creates an account on the local cloud. | This adds the local server ip to the cli tool, switches to using it, and creates an account on the local cloud. | ||
| - | ==== 4. Restart Oak so it connects ==== | + | ==== 5. Restart Oak so it connects ==== |
| + | |||
| + | Stop and restart the server. | ||
| Repeat steps #2 and #3 for other Oaks you want on the same cloud. | Repeat steps #2 and #3 for other Oaks you want on the same cloud. | ||