How to Measure Distance with a Grove Ultrasonic Ranger in Wio Node

REST API

1) Connect the module to PORT0.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GroveUltraRangerD0/range_in_inch', headers = { 'Authorization': 'nodetoken' }) # or range_in_cm

if res.ok:
  print res.text

WebSocket API

Not supported.

CLI

1) Connect the module to PORT0.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GroveUltraRangerD0/range_in_inch # or range_cm

How to Detect Touch on a Grove Touch Sensor in Wio Node

REST API

1) Connect the module to PORT0.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GenericDInD0/input', headers = { 'Authorization': 'nodetoken' })

if res.ok:
  print res.text

WebSocket API

1) Connect the module to PORT0.

2) Run the following code:

import json
import websocket

def on_open(ws):
  ws.send("nodetoken")

def on_message(ws, msg):
  msg_json = json.loads(msg)

  if msg_json['msg']['input_changed']:
    print msg

ws = websocket.WebSocketApp("wss://host/v1/node/event", on_open = on_open, on_message = on_message)

ws.run_forever()

CLI

1) Connect the module to PORT0.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GenericDInD0/input

How to Get Temperature from a Grove Temperature Sensor in Wio Node

REST API

1) Connect the module to PORT1.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GroveTempA0/temp', headers = { 'Authorization': 'nodetoken' })

if res.ok:
  print res.text

WebSocket API

Not supported.

CLI

1) Connect the module to PORT1.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GroveTempA0/temp

How to Get Humidity from a Grove Temperature & Humidity Sensor in Wio Node

REST API

1) Connect the module to PORT0.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GroveTempHumD0/humidity', headers = { 'Authorization': 'nodetoken' })

if res.ok:
  print res.text

WebSocket API

Not supported.

CLI

1) Connect the module to PORT0.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GroveTempHumD0/humidity

How to Get Temperature from a Grove Temperature & Humidity Sensor in Wio Node

REST API

1) Connect the module to PORT0.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GroveTempHumD0/temperature', headers = { 'Authorization': 'nodetoken' }) # or temperature_f for fahrenheit

if res.ok:
  print res.text

WebSocket API

Not supported.

CLI

1) Connect the module to PORT0.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GroveTempHumD0/temperature # or temperate_f for fahreinheit

How to Get Sound Intensity from a Grove Sound Sensor in Wio Node

REST API

1) Connect the module to PORT1.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GroveSoundA0/sound_level', headers = { 'Authorization': 'nodetoken' })

if res.ok:
  print res.text

WebSocket API

Not supported.

CLI

1) Connect the module to PORT1.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GroveSoundA0/sound_level

How to Open/Close a Grove Relay in Wio Node

REST API

1) Connect the module to PORT0.

2) Run the following code:

import requests
import time

while True:
  requests.post('https://host/v1/node/GroveRelayD0/onoff/1', headers = { 'Authorization': 'nodetoken' })

  time.sleep(1)

  requests.post('https://host/v1/node/GroveRelayD0/onoff/0', headers = { 'Authorization': 'nodetoken' })

  time.sleep(1)

WebSocket API

Not supported.

CLI

1) Connect the module to PORT0.

2) Configure the CLI:

wio login

3) Run the following script:

#!/bin/bash

while true; do
  wio call nodetoken POST https://host/v1/node/GroveRelayD0/onoff/1

  sleep 1

  wio call nodetoken POST https://host/v1/node/GroveRelayD0/onoff/0

  sleep 1
done

How to Get Light Intensity with a Grove Light Sensor in Wio Node

REST API

1) Connect the module to PORT1.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GenericAInA0/analog', headers = { 'Authorization': 'nodetoken' })

if res.ok:
  print res.text

WebSocket API

Not supported.

CLI

1) Connect the module to PORT1.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GenericAInA0/analog

How to Turn On/Off a LED in a Grove LED Socket in Wio Node

REST API

1) Connect the module to PORT0.

2) Run the following code:

import requests
import time

while True:
  requests.post('https://host/v1/node/GenericDOutD0/onoff/1', headers = { 'Authorization': 'nodetoken' })

  time.sleep(1)

  requests.post('https://host/v1/node/GenericDOutD0/onoff/0', headers = { 'Authorization': 'nodetoken' })

  time.sleep(1)

WebSocket API

Not supported.

CLI

1) Connect the module to PORT0.

2) Configure the CLI:

wio login

3) Run the following script:

#!/bin/bash

while true; do
  wio call nodetoken POST https://host/v1/node/GenericDOutD0/onoff/1

  sleep 1

  wio call nodetoken POST https://host/v1/node/GenericDOutD0/onoff/0

  sleep 1
done

How to Set the Level of a Grove LED Bar in Wio Node

REST API

1) Connect the module to PORT0.

2) Run the following code:

import requests
 
requests.post('https://host/v1/node/GroveLEDBarUART0/level/0', headers = { 'Authorization': 'nodetoken' }) # 0-10

WebSocket API

Not supported.

CLI

1) Connect the module to PORT0.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken POST /v1/node/GroveLEDBarUART0/level/0 # 0-10