libweave daemon examples

This directory contains examples implementation of libweave device daemons.


  • build all examples
make all-examples
  • build only the light daemon
make out/Debug/weave_daemon_light


  • enable user-service-publishing in avahi daemon

set disable-user-service-publishing=no in /etc/avahi/avahi-daemon.conf

  • restart avahi daemon
sudo service avahi-daemon restart


Generate registration tickets

  • go to the OAuth 2.0 Playground
    • Step 1: enter the Weave API scope and click to Authorize APIs
    • Step 2: click Exchange authorization code for tokens
    • Step 3:
      • set HTTP Method: POST
      • set Request URI:
      • click Enter request body: {"userEmail": "me"}
      • click Send the request
    • The Response contains a new registrationTicket resource.
  "userEmail": "",
  "kind": "weave#registrationTicket",
  "expirationTimeMs": "1443204934855",
  "deviceId": "0f8a5ff5-1ef0-ec39-f9d8-66d1caeb9e3d",
  "creationTimeMs": "1443204694855",
   "id": "93019287-6b26-04a0-22ee-d55ad23a4226"
  • Note: the ticket expires after a few minutes

Provision the device

  • start the daemon with the registrationTicket id.
sudo out/Debug/weave_daemon_sample --registration_ticket=93019287-6b26-04a0-22ee-d55ad23a4226
  • the daemon outputs the path to its configuration file and its deviceId
Saving settings to /var/lib/weave/weave_settings_XXXXX_config.json
Device registered: 0f8a5ff5-1ef0-ec39-f9d8-66d1caeb9e3d
  • the device id matches the cloud_id in the configuration
$ sudo grep "cloud_id" /var/lib/weave/weave_settings_[XXXXX]_config.json
  "cloud_id": 0f8a5ff5-1ef0-ec39-f9d8-66d1caeb9e3d

Send Commands

  • go to the Weave Developers Console,
  • click Your devices
  • select your device to show the Device details page.
  • in the Available commands click _sample.hello
  • set command parameters
  • click RUN COMMAND
  • verify the command is handled correctly by looking at the daemon logs.