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

From MozillaWiki
Jump to navigation Jump to search
(→‎Recipe: Documented)
Line 115: Line 115:


== Recipe ==
== Recipe ==
A recipe is a set of *rules*.
Each rule is triggered when *all* its *conditions* are true. A condition is specified by a set of channels to watch and a range of values that make it true - the condition becomes true once *any* of the channels it watches provides a value that fits the range.
Once a rule is triggered, it *executes*. An execution sends one value to a set of channels.
Once a rule is triggered, it won't be triggered again until at least one of the conditions has become false and true again.
Format:
  {
    rules: one or more of {
      conditions: one or more of {
        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]
        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
      }
      execute: one or more of {
        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]
        value: see [http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/values/enum.Value.html#json documentation of values]
      }
    }
  }
* Send Recipe
* Send Recipe
To Be Documented: Use channel selector {"kind": "AddThinkerbellRule"}.
* List available Recipes
* List available Recipes
To Be Documented: Use service selector {"getters": "ThinkerbellRuleSource"}.


== WebPush ==
== WebPush ==

Revision as of 17:38, 1 April 2016

Taxonomy Documentation

Github Link: http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/index.html

Current REST API

Account

Services

Services may requested by selector. A service selector is an object with the following fields:

  • (optional) string `id`: accept only a service with a given id;
  • (optional) string array of string `tags`: accept only services with all the tags in the array;
  • (optional) object or array of objects `getters` (see GetterSelector): accept only services with channels matching all the selectors in this array;
  • (optional) object or array of objects `setters` (see SetterSelector): accept only services with channels matching all the selectors in this array.

Generally, except for (de)assigning tags, using an id is considered a bad idea, as this ties the application to a specific device, and this will fail if the device is replaced (consider that this is equivalent to using an IP address instead of a domain name).

List of Services

Example with 1 selector:

  • Get services with tag "location: kitchen" and channel kind "OvenTemperature"

Example with 2 selectors:

As a shortcut, providing no argument will locate all services:

Tags

Channels

Channels are designed to be used by selector.

A selector is an object with the following fields:

  • (optional) string id: accept only a channel with a given id;
  • (optional) string `service`: accept only channels of a service with a given id;
  • (optional) string|array of string `tags`: accept only channels with all the tags in the array;
  • (optional) string|array of string `service_tags`: accept only channels of a service with all the tags in the array;
  • (optional) string|object `kind` (see ChannelKind): accept only channels of a given kind.

While each field is optional, at least one field must be provided.

Generally, except for (de)assigning tags, using an id is considered a bad idea, as this ties the application to a specific device, and this will fail if the device is replaced (consider that this is equivalent to using an IP address instead of a domain name).


Fetching


Example:

Sending

or

See http://fxbox.github.io/taxonomy/doc/foxbox_taxonomy/values/enum.Value.html for the full documentation on values.

Tags


Specific services and channels

Time

Camera

Recipe

A recipe is a set of *rules*.

Each rule is triggered when *all* its *conditions* are true. A condition is specified by a set of channels to watch and a range of values that make it true - the condition becomes true once *any* of the channels it watches provides a value that fits the range.

Once a rule is triggered, it *executes*. An execution sends one value to a set of channels.


Once a rule is triggered, it won't be triggered again until at least one of the conditions has become false and true again.

Format:

 {
   rules: one or more of {
     conditions: one or more of {
       source: one or more of Selectors (see section on channels)
       kind: see documentation of channel kinds
       range: see documentation of ranges
       duration: (optional) floating point number of seconds
     }
     execute: one or more of {
       destination: one or more Selectors (see section on channels)
       kind: see documentation of channel kinds
       value: see documentation of values
     }
   }
 }


  • Send Recipe

To Be Documented: Use channel selector {"kind": "AddThinkerbellRule"}.

  • List available Recipes

To Be Documented: Use service selector {"getters": "ThinkerbellRuleSource"}.

WebPush