Connected Devices/Projects/Project Link/Taxonomy: Difference between revisions

Jump to navigation Jump to search
→‎Specific services and channels: Decentralized Taxonomy
(→‎Channels: Updated to Decentralized API)
(→‎Specific services and channels: Decentralized Taxonomy)
Line 103: Line 103:
== Time ==
== Time ==
* Get the current time
* Get the current time
     PUT http://localhost:3000/api/v1/channels/get {"kind":"CurrentTime"}
     PUT http://localhost:3000/api/v1/channels/get {"feature":"clock/time-of-day-seconds"}
     PUT http://localhost:3000/api/v1/channels/get {"kind":"CurrentTimeOfDay"}
     PUT http://localhost:3000/api/v1/channels/get {"feature":"clock/time-timestamp-rfc-3339"}


== Camera ==
== Camera ==
Line 115: Line 115:
** PUT http://localhost:3000/api/v1/channels/get {"id":"getter:image_newest.ae67e622-7a66-465e-bab0-28107b2df980@link.mozilla.org"}     
** PUT http://localhost:3000/api/v1/channels/get {"id":"getter:image_newest.ae67e622-7a66-465e-bab0-28107b2df980@link.mozilla.org"}     
* Get list of services that can take image (snapshot)
* Get list of services that can take image (snapshot)
** POST http://localhost:3000/api/v1/services {"setters":[{"kind":{"adapter":"Adapter","kind":"snapshot","type": "Json", "vendor":"DLink"} }]}
** POST http://localhost:3000/api/v1/services {"channels":[{"kind": "camera/store-snapshot"} }]}


== Recipe ==
== Recipe ==
Line 134: Line 134:
       conditions: one or more of {
       conditions: one or more of {
         source: one or more of Selectors (see section on channels)
         source: one or more of Selectors (see section on channels)
         kind: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/services/enum.ChannelKind.html#json documentation of channel kinds]
         feature: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/services/enum.ChannelKind.html#json documentation of channel kinds]
         range: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/values/enum.Range.html#json documentation of ranges]
         range: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/values/enum.Range.html#json documentation of ranges]
         duration: (optional) floating point number of seconds
         duration: (optional) floating point number of seconds
Line 140: Line 140:
       execute: one or more of {
       execute: one or more of {
         destination: one or more Selectors (see section on channels)
         destination: one or more Selectors (see section on channels)
         kind: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/services/enum.ChannelKind.html#json documentation of channel kinds]
         feature: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/services/enum.ChannelKind.html#json documentation of channel kinds]
         value: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/values/enum.Value.html#json documentation of values]
         value: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/values/enum.Value.html#json documentation of values]
       }
       }
Line 161: Line 161:
           "ThinkerbellRule":{
           "ThinkerbellRule":{
             "name":"Hello, Thinkerbell",
             "name":"Hello, Thinkerbell",
             "source":"{\"name\": \"Hello, Thinkerbell\", \"rules\":[{\"conditions\":[{\"source\":[{\"id\":\"OpenZWave/72057594126794752 (Sensor)\"}],\"kind\":\"OpenClosed\",\"range\":{\"Eq\":{\"OpenClosed\":\"Open\"}}}],\"execute\":[{\"destination\":[{\"kind\":\"Log\"}],\"kind\":\"Log\",\"value\":{\"String\":\"Closed\"}}]}]}"
             "source":"{\"name\": \"Hello, Thinkerbell\", \"rules\":[{\"conditions\":[{\"source\":[{\"id\":\"OpenZWave/72057594126794752 (Sensor)\"}],\"feature\":\"door/is-open\",\"range\":{\"Eq\":{\"OpenClosed\":\"Open\"}}}],\"execute\":[{\"destination\":[{\"feature\":\"log/append-text\"}],\"feature\":\"log/append-text\",\"value\":{\"String\":\"Closed\"}}]}]}"
           }
           }
       }
       }
Line 169: Line 169:


Example:
Example:
     POST http://localhost:3000/api/v1/services HTTP/1.1 {"getters": [{"kind": "ThinkerbellRuleSource"}]}
     POST http://localhost:3000/api/v1/services HTTP/1.1 {"channels": [{"feature": "thinkerbell/source"}]}


== WebPush ==
== WebPush ==
Note: In the future, there will be a ChannelKind (or equivalent) to replace the id.


* Get current subscriptions
* Get current subscriptions
     PUT http://localhost:3000/api/v1/channels/get {"id": "getter:subscription.webpush@link.mozilla.org"}
     PUT http://localhost:3000/api/v1/channels/get {"feature": "webpush/subscribe"}
* Get current resources receiving notifications on
* Get current resources receiving notifications on
     PUT http://localhost:3000/api/v1/channels/get {"id": getter:resource.webpush@link.mozilla.org"}
     PUT http://localhost:3000/api/v1/channels/get {"feature": "webpush/resource"}


* Add push subscription
* Add push subscription
     PUT http://localhost:3000/api/v1/channels/set {"select": {"id": "setter:subscribe.webpush@link.mozilla.org"},  
     PUT http://localhost:3000/api/v1/channels/set {"select": {"feature": "webpush/subscribe"},  
     "value": {"Json": {"subscriptions":[{"push_uri":"http://push.service/t54wtresfesfd","public_key":"base64_encoded_key","auth":"optional_base64_auth_data"}]}}}
     "value": {"Json": {"subscriptions":[{"push_uri":"http://push.service/t54wtresfesfd","public_key":"base64_encoded_key","auth":"optional_base64_auth_data"}]}}}


* Remove push subscription
* Remove push subscription
     PUT http://localhost:3000/api/v1/channels/set {"select": {"id": "setter:unsubscribe.webpush@link.mozilla.org"},  
     PUT http://localhost:3000/api/v1/channels/set {"select": {"feature": "webpush/unsubscribe"},  
     "value": {"Json": {"subscriptions":[{"push_uri":"http://push.service/t54wtresfesfd","public_key":"base64_encoded_key","auth":"optional_base64_auth_data"}]}}}
     "value": {"Json": {"subscriptions":[{"push_uri":"http://push.service/t54wtresfesfd","public_key":"base64_encoded_key","auth":"optional_base64_auth_data"}]}}}


Line 261: Line 260:
=== Examples ===
=== Examples ===
==== Check availability of an individual light ====
==== Check availability of an individual light ====
  PUT http://localhost:3000/api/v1/channels/get {"id":"getter:available.4.001788fffe25681a.philips_hue@link.mozilla.org"}
  PUT http://localhost:3000/api/v1/channels/get {"id":"channel:available.4.001788fffe25681a.philips_hue@link.mozilla.org"}


==== Turn all the lights off ====
==== Turn all the lights off ====
  PUT http://localhost:3000/api/v1/channels/set {"select":{"kind":"LightOn"},"value":{"OnOff":"Off"}}
  PUT http://localhost:3000/api/v1/channels/set {"select":{"feature":"light/is-on"},"value":{"OnOff":"Off"}}
184

edits

Navigation menu