This will guide you through on how to Setup the Local and use it with Particle-CLI
after a successful installation.
Before you proceed, make sure you fired up particle-server successfully at least once. We will need the server public keys generated on 1st run later.
**NOTE: ** This will point the Particle-CLI
to the local and you will not be able to use features available on the cloud
1.) We will now create a new server profile on Particle-CLI using the command:
particle config profile_name apiUrl "http://DOMAIN_OR_IP"
For the local , the port number 8080 needs to be added behind: http://domain_or_ip:8080
This will create a new profile to point to your server and switching back to the spark is simply particle config particle
and other profiles would be particle config profile_name
2.) We will now point over to the local using particle config profile_name
3.) particle setup
(on a separate CMD from the one running the server)
This will create an account on the local
Perform CTRL + C once you logon with Particle-CLI
asking you to send Wifi-credentials etc…
4.) on Command-line, cd to particle-server
5.) Place your core in DFU mode [flashing yellow]
6.) Change server keys to local cloud key + IP Address
particle keys server default_key.pub.pem IP_ADDRESS
7.) Go to cores_key directory to place core public key inside
cd core_keys
- place core in DFU-mode
particle keys save INPUT_DEVICE_ID_HERE
NOTE: make sure you use the DEVICE_ID
when saving the keys!
Reset the core manually by hitting the RST button
8.) Check for connection
- Make sure
particle-server
is running - open a separate CMD (if you closed it earlier)
- cd to
particle-server
- run
node main.js
- watch the cmd for connections by the core
- you can restart the core and see if there’s any activity when the core attempts to reach breathing cyan
Example activity from CMD:
Connection from: 192.168.1.159, connId: 1
on ready { coreID: '48ff6a065067555008342387',
ip: '192.168.1.159',
product_id: 65535,
firmware_version: 65535,
cache_key: undefined }
Core online!
HOORAY!
Switching between and Local
Here’s a few things you need to know:
1.) You will need to flash the respective Public Key to the core which you are connecting to
-
Place your core in DFU-mode (flashing yellow)
-
on the command-line,
For Cloud:
particle keys server cloud_public.der
The cloud public key file is here: https://s3.amazonaws.com/spark-website/cloud_public.der
For local Cloud:
particle keys server your_local_cloud_public_key.der IP-ADDRESS
-
reset your core
2.) Changing of profile back to the default spark on the Spark-cli must be performed using particle config particle
Knowing which profile Particle-CLI
is pointing to
1.) The command is simply particle config identify
Example output:
KENMBP:~ kennethlimcp$ particle config identify
Current profile: local
Using API: http://192.168.1.68
This will ensure that you are pointing to your own !
Updated on: 01 Oct 2015