IOTDB: using from Node.JS

Before I dive into the semantic "hows / whys" of IOTDB, I'd like to show
you how it looks from a Node.JS programmer perspective.

First:

iotdb = require('iotdb')
iot = iotdb.iot()


Now we can start doing stuff. This command "connects to everything"

things = iot.connect()


or we can connect to a specific type of device

things = iot.connct('WeMoSwitch')


In either case, we can now start telling things to semantically. For
example, turn everything on:

things.set(':on', true)


The colon in front of ":on" indicates that we want to use the _semantic_
concept of on. Underneath, there's a JSON(-like) dictionary that may be
some other key entirely than the word "on", for example "power".

This gets into a core concept: IOTDB is about _semantically_ describing how
things work. It is _descriptive_, not _prescriptive_. We can also use the
Node code to directly manipulate the underlying Thing's dictionary,
bypassing semantics

things.set('/power', true)


It's not particularly recommended though.

D.

Received on Tuesday, 2 June 2015 13:53:30 UTC