IOTDB: modeling state

One issue you are going to face as you start modelling 'real world' things
is there's a lot of 'near duplication' of semantic terms.

For example, in DR's definitions you end up with something like this for
Lights (my apologies if this isn't 100% correct)

   - on: turn the light on /off - { write: true }
   - is_on: is this on or off - { read: true }

Now consider a Denon Audio / Visual Receiver. It has, amongst other things:

   - on
   - volume
   - band
   - mute

So you end up with a parallel set of definitions

   - is_on
   - actual_volume
   - actual_band
   - is_muted

And when you're constructing user interfaces you end up having to figure
out how to correlate all of these things. IOTDB went though this for a
while, but from a programmer POV it's kind of horrifying and doesn't quite
seem right, as it's mostly a DRY violation.

What I ended up doing is creating the concept of a _role_, as in "what does
this thing do", which can be one or both of iot:role-reading or
iot:role-control

Now we just have 4 rather than 8 things to manage. "But how do you
differentiate the _actual_ reading values from control values, as they're
different?", you ask. This will be the next email.

D,

Received on Tuesday, 2 June 2015 15:13:55 UTC