This is a port of the Arduino library nexa_node to SparkCore. Makes it possible to send and receive commands to/from Nexa brand power plugs, motion sensors, remote controls, etc. In combination with the SparkCore's built-in cloud features one essentially out-of-the-box get features similar to Tellstick and Nexa Gateway - at a fraction of the cost.
Nexa brand devices are widely available, sold at E.G. Clas Ohlson stores throughout Scandinavia.
$ curl -H "Authorization: Bearer d586ffffd4334d84f4199fa1517cc5bdf02c66e9" \
"https://api.spark.io/v1/devices/core_name/command"
{
"cmd": "VarReturn",
"name": "command",
"result": "2:D38EB8:0:2:1",
"coreInfo": {
"last_handshake_at": "2015-01-04T18:43:21.222Z",
"connected": true
}
}
The command was a request to turn on a power plug - trailing :1
$ curl -H "Authorization: Bearer d586ffffd4334d84f4199fa1517cc5bdf02c66e9" \
https://api.spark.io/v1/devices/core_name/send -d "args=2:D38EB8:0:2:0"
{
"id": "ffff6c066672524845333456",
"name": "core_name",
"last_app": null,
"connected": true,
"return_value": 1
}
Power plug ordered to turn off - trailing :0
Received Nexa commands are echoed on the Serial interface. Commands entered through serial are sent. ##Hardware setup
- Sparkcore
- 433Mhz RF receiver, model RWS-371
- 433Mhz RF transmitter
N.B. Wrt. the 5V receiver module - the SparkCore, though beeing a 3.3V device, has some 5V-tolerant input pins and can also supply 5V through Vin.