-
Notifications
You must be signed in to change notification settings - Fork 91
Actor Docs
Documentation for actors included in the latest release.
context : Access to information about the current context
data : Actors for data stream handling
exception : This module provides actors related to exception handling.
flow : This module provides actors related to handling of data flow.
io : This module organizes actors related to input and output.
json : This module provides container types List and Dict, accessors, and methods for reading and writing JSON formatted strings.
kappa : Helper actors for Calvin Kappa. Should only be used by trained professionals.
math : A collection of (simple) mathematical operations and functions
media : This module provides actors related to media objects/functions.
misc : This module organizes actors that cannot easily be categorized.
net : This module provides actors related to network access.
sensor : Actors related to sensors and other hardware
std : This module organizes actors related to standard operations and is expected to be available anywhere.
test : This module organizes actors related to testing of Calvin and is only expected to be available during test.
text : This module organizes actors related to text processing.
time : Actors related to timing.
web : This module provides actors related to web services.
Access to information about the current context
PublicAttribute : Fetch given public attribute of runtime given as a section.subsection.subsubsection
RuntimeName : Get name of current runtime
RegistryAttribute : Fetch given registry attribute of runtime given as a section.subsection.subsubsection. Will only work for locally known attributes.
Actors for data stream handling
Sink : Data sink - usually some form of permanent storage
Source : Data source.
PersistentBuffer : Buffer data to file (when necessary.)
This module provides actors related to exception handling.
A common case of exception is end-of-stream (EOS) that indicates that the source cannot produce anymore tokens, e.g. when a file reader reaches the end of the file. Depending the application, this may or may not indicated that the process has completed execution, on possible scenario is that a file reader will start reading another file after reaching the end of a first file. It is up to the application developer to decide how to interpret EOS tokens.
Another common use of EOS tokens is to create lists and dictionaries with varying number of members, see docs for module 'json', in particular 'json.List' and 'json.Dict'.
IsEOS : Return 'true' if token is EOS-token
ExceptionHandler : Scan tokens for Exceptions.
This module provides actors related to handling of data flow.
Alternate2 : Alternating between two streams of tokens
Collect : Collect tokens from many ports on the inport
CollectCompleteDict : Collect tokens from token port, forming a dict according to mapping. Will only produce
DispatchDict : Route tokens to the ports connected to the fan-out port token according to 'mapping'
Alternate : Fetch tokens from the fan-in port in the order given by the argument 'order'
Terminator : Acts like a true sink.
Dispatch : Dispatch tokens to all connected outports, aiming at keeping all queues equal, i.e. the token will end up in the smallest queue at all times.
Bool : Any token on the inport will be tested for truth value.
Void : Acts like a source but will never generate tokens.
CollectDict : Collect tokens from token port, forming a dict according to mapping. May produce
Join : Join two streams of tokens. Deprecated.
Switch : Switch data paths depending on 'switch'
Deselect : Route token from 'case_true' or 'case_false' to 'data' port depending on 'select'
Dealternate2 : Split token stream into two streams of tokens (odd and even tokens)
Select : Route 'data' token to 'case_true' or 'case_false' port depending on 'select'
Init : Insert an initial token (data) before passing all others through
Dealternate : Route tokens to the ports connected to the fan-out port token in the order given by the argument 'order'
This module organizes actors related to input and output.
DigitalIn : Edge triggered digital input in runtime-defined pin.
PWM : Pulse width modulation on runtime-defined pin.
Light : Set state of a light (e.g. an LED or a lightbulb)
Log : Write data to calvin log using specified loglevel.
StandardIn : Reads from Standard IN, and send each read line as a token on output port
TiltSwitch : React to changes in a TiltSwitch.
Buzzer : Buzz
Switch : Creates a on/off switch.
Button : Handle a button and trigger on state changes.
Print : Print data to standard out of runtime. Note that what constitutes standard out varies.
DigitalOut : Set runtime defined-pin to inport state.
Knob : Read a knob to see which way it turned.
ServoMotor : Rotate servo given degrees.
LogError : Write data to system log at loglevel "Error"
FileReader : Read a file line by line, and send each line as a token on output port
LogInfo : Write data to system log at loglevel "INFO"
FileWriter : Writes input 'data' to file 'basename' + some counter + '.' + suffix
LogWarning : Write data to system log at loglevel "warning"
This module provides container types List and Dict, accessors, and methods for reading and writing JSON formatted strings.
SetValues : Modify a container (list or dictionary)
List : Create a list.
SetDefaults : Modify a dictionary part of container if key does not exist (key must be string)
SetDefault : Modify a dictionary part of container if key does not exist (key must be string)
GetValues : Extract values from a container using list of keys/indices
ToString : Transform data to JSON-string
GetValue : Extract a value from a container using key/index
Dict : Create a dict
FromString : Transform JSON-formatted string to value
SetValue : Modify a container (list or dictionary)
Items : Produce all items from a list as a sequence of tokens.
Helper actors for Calvin Kappa. Should only be used by trained professionals.
Sink : Sink for kappa results. Parameter buffer_size determines maximum number of items to hold
Source : Load up tokens for a kappa
A collection of (simple) mathematical operations and functions
RandomInteger : Produce random integer in range [lower ... upper-1]
RandomNumber : Produce random number (floating point) in range [lower ... upper)
Evaluate : Evaluate arithmetic expression 'expr' with two arguments, passed as (a string) argument.
Compute : Perform a OP b where OP is the operator passed as (a string) argument.
This module provides actors related to media objects/functions.
ImageSource : When token on input, get an image.
Bell : Triggers a audible or visible bell (runtime dependent).
FaceCounter : Counts faces in a base64 encoded jpg image
ObjectCounter : Counts objects in a base64 encoded jpg image
ObjectFinder : Finds and marks objects in a base64 encoded jpg image function
PlayAudio : Play audio file <audiofile>.
ImageSink : Incoming tokens, as base64 endoded images, sent to renderer.
FaceFinder : Finds and marks faces in a base64 encoded jpg image function
This module organizes actors that cannot easily be categorized.
ExplicitStateExample : Demonstrate (and test) explicit state handling in actors.
This module provides actors related to network access.
HTTPPutS : HTTP method PUT
UDPListener : Listen for UDP messages on a given port.
HTTPGet : Get contents of URL
HTTPPost : Post data to URL
SimpleUDPSender : Send all incoming tokens to given address/port over UDP
HTTPGetS : HTTP method GET
UDPSender : Send all incoming tokens to given address/port over UDP
HTTPDeleteS : HTTP method DELETE
HTTPDelete : Send delete to URL
SimpleUDPListener : Listen for UDP messages on a given port. Address is of the form "ip:port" (note: ip is ipv4)
BasicAuthHeader : Generate Basic Authorization header from username/password
TCPServer : Etablish a TCP connection and forward all tokens except EOST on this connection.
MQTTSubscriber : Subscribe to given topics (list of mqtt ), output messages on message-port
MQTTPublisher : Publish all incoming messages to given broker"
HTTPPostS : HTTP method POST
HTTPPut : Post data to URL
TCPClient : Etablish a TCP connection and forward all tokens.
Actors related to sensors and other hardware
TriggeredTemperature : Measure temperature.
LightBreaker : React to changes in a sensor.
TriggeredRelativeHumidity : Read Relative Humidity when told to.
Gyroscope : Measure the rotation. Takes the period of measurements, in microseconds, as input.
Temperature : Measure temperature. Takes the period of measurements, in seconds, as input.
Distance : Measure distance. Takes the period of measurements, in seconds, as input.
TriggeredPressure : Measure atmospheric pressure
RFIDReader : RFIDReader - read MIFare Classic/ultralight when present.
Accelerometer : Measure the acceleration. Takes the period of measurements, in microseconds, as input.
HallEffect : React to presence of magnetic field.
TriggeredSoilMoisture : Measure the moisture level in the soil.
TriggeredDistance : Measure distance.
This module organizes actors related to standard operations and is expected to be available anywhere.
Iterate : Produce sequence of items by iterating over 'token',
Sequencer : Interleave incoming tokens with end of string token (EOS) on outport.
Watchdog : Data on inport is passed on to outport unchanged. If nothing has arrived on the inport after timeout
seconds, then true is sent on the timeout port.
ClassicDelay : After first token, pass on token once every 'delay' seconds.
CountTimer : Produce a counter token on the output every period seconds
Stringify : Consume a token and stringify its value
RecTimer : After first token, pass on token once every 'delay' seconds. *Deprecated*
Burn : forward a token unchanged and Burns cycles
Constant : Send predetermined data on output. Never ending sequence.
Sum : Read a number and compute a cumulative sum
Identity : forward a token unchanged
Compare : Perform a REL b where REL is a comparison relation passed as (a string) argument.
SampleHold : Sample 'in' and hold it internally if 'sample' input is true, replacing any previous value.
Counter : Produce next integer in a sequence 1,2,3,...
DelayToken : Sends input on after a given delay has passed. Preserves time between tokens.
ConstSequencer : Consume a token and produce a constant from a sequence
Constantify : Consume a token and produce a constant
Trigger : Pass on given _data_ every _tick_ seconds
This module organizes actors related to testing of Calvin and is only expected to be available during test.
FiniteCounter : Produce next token in a sequence start, start+1, ..., start+steps-1, EOSToken
RandomDelay : Sends input on after a random delay has passed.
Sink : Write tokens to standard output
ReplicaIdentity : forward a token with replica index prepended
TestProcess : This is only intended to be used for testing.
FakeShadow : forward a token unchanged like identity
This module organizes actors related to text processing.
PrefixString : Prepends <prefix> to input tokens and passes them to ouput port as strings
LineJoin : Join strings into a text token using delimiter 'delim' (defaults to '\n')
Length : Return length of string
WordCount : Count occurances of words in a stream of words.
PostfixString : Appends <postfix> to input tokens and passes them to ouput port as strings
Format : Format output according to 'fmt' using dict
Split : Split string into list of strings on delimiter 'delim'. Consumes delimiter.
Mustache : Formats string based on template and incoming dictionary
RegexMatch : Apply the regex supplied as argument to the incoming text.
Actors related to timing.
Timestamp : Return the (UTC) time in seconds since Jan 1st 1970
Datetime : Return a dictionary with current date and time.
This module provides actors related to web services.
LocalWeather : Get current weather where runtime is located (or think it is located)
TriggeredWeather : Get current weather at selected destination, given as "city,country code", "city", or ",country code"
Twitter : Post incoming tokens (text) as twitter status
Pushbullet : Post incoming tokens (text) to runtime specific pushbullet channel with given title
LocationWeather : Get current weather at selected destination, given as "city,country code", "city", or ",country code"
Fetch given public attribute of runtime given as a section.subsection.subsubsection
trigger : Any token will trigger a read
value : The given attribute of this runtime, or null
sys.attribute.public
Get name of current runtime
trigger : Any token will trigger a read
value : A string denoting the name of this runtime, or null
sys.attribute.indexed
Fetch given registry attribute of runtime given as a section.subsection.subsubsection. Will only work for locally known attributes.
trigger : Any token will trigger a read
value : The given attribute of this runtime, or null
sys.attribute.indexed
Data sink - usually some form of permanent storage
data : a list of json structures to be saved
data.sink
Data source. { "id": "ns=2;s=/Channel/Parameter/rpa[u1,115]", "tag": "R115", "type": "Double", "value": 0.0, "serverts": "2017-03-20 15:42:41.600000", "sourcets": "2017-03-20 15:42:41.542000", "calvints": 1490021096110, "status": 0 "info": "description given for parameter" }
parameter : description of parameter as shown above
data.source
Buffer data to file (when necessary.)
item : data to be buffered
current : list of data, current and on-line
buffered : catching up of buffered data, list
buffer.persistent, json, sys.timer.once
Return 'true' if token is EOS-token
token : any token
status : 'true' if input token is EOS-token, false otherwise
Scan tokens for Exceptions.
Any non-exception or EOS is simply passed on. Exceptions other than EOS are replaced with an EOS token on the ouput 'token' port unless optional 'replace' argument is true, in which case 'replacement' argument (defaults to null) is produced. Any exception (including EOS) are produces its reason on the 'status' output port.
token : any token
token : input token or EOS/replacement on exception
status : reason for any exception tokens encountered (including EOS)
Alternating between two streams of tokens
token_1 : first token stream
token_2 : second token stream
token : resulting token stream
Collect tokens from many ports on the inport
token : collecting token stream Properties(routing:collect-unordered)
token : resulting token stream
Collect tokens from token port, forming a dict according to mapping. Will only produce a complete dictionary.
token : token Properties(routing:collect-all-tagged)
dict : Collected dictionary according to 'mapping'
Route tokens to the ports connected to the fan-out port token according to 'mapping'
For unrecognized mappings tokens are routed to 'default' port.
dict : dictionary
token : Dispatching tokens to connected ports according to 'mapping' Properties(routing:dispatch-mapped)
default : Default route for unknown token values
Fetch tokens from the fan-in port in the order given by the argument 'order'
token : incoming tokens from connected ports in order Properties(routing:collect-all-tagged)
token : tokens collected from ports as given by order
Acts like a true sink.
This behaviour is useful if an actor produces outputs that will never be used in a particular application. Because of how the runtime works, all output ports must be connected before the application can run, so leaving a port unconnected is not an option.
void : A port that will consume tokens
Dispatch tokens to all connected outports, aiming at keeping all queues equal, i.e. the token will end up in the smallest queue at all times.
token : incoming token stream
token : outgoing token stream Properties(routing:round-robin)
Any token on the inport will be tested for truth value. The following values are considered false:
null false zero of any numeric type, for example, 0, 0L, 0.0, 0j any empty sequence, for example, "", (), [] any empty mapping, for example, {}
All other values are considered true
token : a token to evaluate to either true or false
bool : true or false
Acts like a source but will never generate tokens.
This behaviour is useful if an actor has inputs that will never be used in a particular application. Because of how the runtime works, all input ports must be connected before the application can run, so leaving a port unconnected is not an option.
void : A port that will never produce tokens
Collect tokens from token port, forming a dict according to mapping. May produce a partial dictionary.
token : token Properties(routing:collect-any-tagged)
dict : Collected dictionary according to 'mapping'
Join two streams of tokens. Deprecated.
Note: This actor gives preference to token_1, hence if there is always a token available on that port, then token_2 will starve. The actor you are looking for is probably flow.Collect or possibly flow.Alternate2
token_1 : first token stream
token_2 : second token stream
token : resulting token stream
Switch data paths depending on 'switch'
Switch assumes 'false' or 'true' as input to 'switch', other values are considered 'false'.
switch : Switch data paths a->b, b->a if 'true, else a->a, b->b
a : token
b : token
a : token
b : token
Route token from 'case_true' or 'case_false' to 'data' port depending on 'select'
Deselect assumes 'false' or 'true' as input, values outside that range will default to 'case_false'.
case_false : Token to output 'data' if select token is 'false'
case_true : Token to output 'data' if select token is 'true'
select : Select which inport will propagate to 'data' port
data : Token from 'case_true' or 'case_false' port
Split token stream into two streams of tokens (odd and even tokens)
token : incoming token stream
token_1 : first token stream
token_2 : second token stream
Route 'data' token to 'case_true' or 'case_false' port depending on 'select'
Select assumes false or true as input, values outside that range will default to 'case_false'.
select : Select output for token on 'data' port
data : Token to send to 'case_true' or 'case_false' port
case_false : Token from input 'data' if select token is false
case_true : Token from input 'data' if select token is true
Insert an initial token (data) before passing all others through
in : Any token
out : Data given as parameter followed by data from in port
sys.schedule
Route tokens to the ports connected to the fan-out port token in the order given by the argument 'order'
token : Any token
token : Dispatching tokens to connected ports in order Properties(routing:dispatch-ordered)
Edge triggered digital input in runtime-defined pin.
state : 1/0 when edge goes high/low
io.digitalin
Pulse width modulation on runtime-defined pin.
dutycycle : new dutycycle
io.pwm
Set state of a light (e.g. an LED or a lightbulb)
on : true if light should be on, false if turned off
io.light
Write data to calvin log using specified loglevel. Supported loglevels: INFO, WARNING, ERROR
data : data to be logger
Reads from Standard IN, and send each read line as a token on output port
out : Each token is a line of text, or EOSToken.
io.stdin
React to changes in a TiltSwitch.
open : state true=closed, false=open
io.tiltswitch
Buzz
on : true/false for on/off
io.buzzer
Creates a on/off switch.
state : 0/1 according to switch state
io.switch
Handle a button and trigger on state changes.
state : Button state 1=pressed, 0=not pressed
io.button
Print data to standard out of runtime. Note that what constitutes standard out varies.
token : data to write
io.stdout
Set runtime defined-pin to inport state.
state : 1/0
io.digitalout
Read a knob to see which way it turned.
direction : clockwise or anti-clockwise
io.knob
Rotate servo given degrees.
angle : set servo to given angle
io.servomotor
Write data to system log at loglevel "Error"
data : data to be logged
log.error
Read a file line by line, and send each line as a token on output port
filename : File to read. If file doesn't exist, an ExceptionToken is produced
out : Each token is a line of text, or EOSToken.
io.filereader, io.filesize
Write data to system log at loglevel "INFO"
data : data to be logged
log.info
Writes input 'data' to file 'basename' + some counter + '.' + suffix End of stream token changes file
data : data
io.filewriter
Write data to system log at loglevel "warning"
data : data to be logged
log.warning
Modify a container (list or dictionary)
If container is a list then the key must be an integer index (zero-based), or a list of indices if for nested lists. If container is a dictionary the key must be a string or list of (string) keys for nested dictionaries. It is OK to make a key list of mixed strings and integers if the container comprises nested dictionaries and lists. Produce an ExceptionToken if mapping between key and (sub-)container is incorrect, or if a integer index is out of range. N.B. This actor will incur a performance penalty from a deep copy operation. Use wisely.
container : a list or dictionary
keys : A list of indices (integer), keys (string), or a (possibly mixed) list for nested containers
values : A list of values to set for the corresponding keys
container : a modified container
Create a list.
Consumes 'n' tokens to produce a list, 'n' defaults to 1. If 'n' is zero or negative, consumes tokens until EOS encountered (variable list length). The optional arguments pre_list and post_list are used to prepend and extend the list before delivering the final list. Will produce an ExceptionToken if EOS is encountered when n > 0, or if an ExceptionToken is encountered regardless of value of 'n'.
item : items to append to list
list : a list of consumed items
Modify a dictionary part of container if key does not exist (key must be string)
If container is a list then the key must be an integer index (zero-based), or a list of indices if for nested lists. If container is a dictionary the key must be a string or list of (string) keys for nested dictionaries. It is OK to make a key list of mixed strings and integers if the container comprises nested dictionaries and lists. Produce an ExceptionToken if mapping between key and (sub-)container is incorrect, or if a integer index is out of range. N.B. This actor will incur a performance penalty from a deep copy operation. Use wisely.
container : a list or dictionary
keys : A list of keys (string), or a (possibly mixed) list for nested containers (must point to dictionary key)
values : A list of default values to set
container : a modified container
Modify a dictionary part of container if key does not exist (key must be string)
If container is a list then the key must be an integer index (zero-based), or a list of indices if for nested lists. If container is a dictionary the key must be a string or list of (string) keys for nested dictionaries. It is OK to make a key list of mixed strings and integers if the container comprises nested dictionaries and lists. Produce an ExceptionToken if mapping between key and (sub-)container is incorrect, or if a integer index is out of range. N.B. This actor will incur a performance penalty from a deep copy operation. Use wisely.
container : a list or dictionary
key : key (string), or a (possibly mixed) list for nested containers
value : default value to set
container : a modified container
Extract values from a container using list of keys/indices
If container is a list then the key must be an integer index (zero-based), or a list of indices if for nested lists. If container is a dictionary the key must be a string or list of (string) keys for nested dictionaries. It is OK to make a key list of mixed strings and integers if the container comprises nested dictionaries and lists. Produce an ExceptionToken if mapping between key and (sub-)container is incorrect, or if a integer index is out of range, or key is not present in dictionary.
container : a dictionary, list or a nested mix of them
keys : A list of items to access using index (integer), key (string), or a (possibly mixed) list for nested containers
values : A list of values for the specifiers in keys
Transform data to JSON-string
Exception tokens will produce "null" as output unless another value is supplied through the optional 'exception_output' argument.
data : any kind of token
string : JSON-formatted string
json
Extract a value from a container using key/index
If container is a list then the key must be an integer index (zero-based), or a list of indices if for nested lists. If container is a dictionary the key must be a string or list of (string) keys for nested dictionaries. It is OK to make a key list of mixed strings and integers if the container comprises nested dictionaries and lists. Produce an ExceptionToken if mapping between key and (sub-)container is incorrect, or if a integer index is out of range, or key is not present in dictionary.
container : a dictionary, list or a nested mix of them
key : index (integer), key (string), or a (possibly mixed) list for nested containers
value : value for the key/index/list
Create a dict
Consume 'n' key/value pairs to produce a dictionary, 'n' defaults to 1. If 'n' is zero or negative, consume key/value pairs until EOS encountered on both input ports. If EOS is only encountered on one port, produce an execption.
key : key must be string
value : can be any token
dict : dictionary or Exception
Transform JSON-formatted string to value
Invalid input will produce an Exception token as output unless another value is supplied through the optional 'exception_output' argument. N.B. Using 'null' for 'exception_output' will produce an ExceptionToken rather than 'null'.
string : JSON-formatted string
data : data read from input string
json
Modify a container (list or dictionary)
If container is a list then the key must be an integer index (zero-based), or a list of indices if for nested lists. If container is a dictionary the key must be a string or list of (string) keys for nested dictionaries. It is OK to make a key list of mixed strings and integers if the container comprises nested dictionaries and lists. Produce an ExceptionToken if mapping between key and (sub-)container is incorrect, or if a integer index is out of range. N.B. This actor will incur a performance penalty from a deep copy operation. Use wisely.
container : a list or dictionary
key : index (integer), key (string), or a (possibly mixed) list for nested containers
value : value to set
container : a modified container
Produce all items from a list as a sequence of tokens.
Produce an exception token if data is not a list.
list : a list
item : items of list in order
copy
Sink for kappa results. Parameter buffer_size determines maximum number of items to hold
in : Any token
kappa
Load up tokens for a kappa
out : Any token
kappa
Produce random integer in range [lower ... upper-1]
trigger : Any token
integer : Random integer in range [lower ... upper-1]
math.random
Produce random number (floating point) in range [lower ... upper)
trigger : Any token
number : Random number in range [lower ... upper)
math.random
Evaluate arithmetic expression 'expr' with two arguments, passed as (a string) argument.
x : a number
y : a number
result : value expr with x and y substituted for given values
math.arithmetic.eval
Perform a OP b where OP is the operator passed as (a string) argument.
Allowed values for OP are: +, -, *, /, div (integer division), mod (modulo)
a : a token
b : a token
result : result of 'a' OP 'b'
math.arithmetic.operator
When token on input, get an image.
trigger : anything
b64image : generated image
image.source
Triggers a audible or visible bell (runtime dependent).
trigger : any token triggers the bell.
notify.bell
Counts faces in a base64 encoded jpg image
b64image : Image to analyze
objects : number of faces found in image
image.facedetection
Counts objects in a base64 encoded jpg image
b64image : Image to analyze
objects : number of objects found in image
image.objectdetection
Finds and marks objects in a base64 encoded jpg image function
b64image : Image to analyze
b64image : New image with all detected objects marked
image.objectfinding
Play audio file <audiofile>.
play : starts playing file when true
media.audio
Incoming tokens, as base64 endoded images, sent to renderer.
b64image : base64 encoded jpg
image.render
Finds and marks faces in a base64 encoded jpg image function
b64image : Image to analyze
b64image : New image with all detected faces marked
image.facefinding
Demonstrate (and test) explicit state handling in actors. In order to migrate this actor, potentially to non-python platforms, we need to explicitly handle set/get state for the custom wrap object.
token : any token
token : a string with input token wrapped in '(((' and ')))'
HTTP method PUT url : url to send to params : dictionary with query parameters (or null) headers: dictionary with headers to include in request (or null) auth : dictionary with authtype (basic/digest), username and password (or null)
data : execute request, include data as body if not null or boolean
status : status of request
headers : JSON dictionary of incoming headers
data : body of response (if any)
http.put
Listen for UDP messages on a given port.
Control port takes control commands of the form (uri only applicable for connect.)
{
"command" : "listen"/"stop",
"uri": "udp://<ipv4 address>:<port>"
}
control_in : JSON containing host & port to listen to.
data_out : Data received on the UDP port will be sent as tokens.
network.udplistener, regexp
Get contents of URL
URL : URL to get
params : dictionary with query parameters (optional)
headers : dictionary with headers to include in request (optional)
auth : dictionary with authtype (basic/digest), username and password (optional)
status : HTTP status of request
headers : dictionary of response headers
data : body of response (only if body is non-empty)
http.get
Post data to URL
URL : URL to post to
data : Data to post
params : dictionary with query parameters (optional)
headers : dictionary with headers to include in request (optional)
auth : dictionary with authtype (basic/digest), username and password (optional)
status : HTTP status of request
headers : dictionary of response headers
data : body of response (only if body is non-empty)
http.post
Send all incoming tokens to given address/port over UDP
data : Each received token will be sent to address set via control port
network.socketclient
HTTP method GET url : url to send to params : dictionary with query parameters (or null) headers: dictionary with headers to include in request (or null) auth : dictionary with authtype (basic/digest), username and password (or null)
data : execute request, include data as body if not null or boolean
status : status of request
headers : JSON dictionary of incoming headers
data : body of response (if any)
http.get
Send all incoming tokens to given address/port over UDP
Control port takes control commands of the form (uri only applicable for connect.)
{
"command" : "connect"/"disconnect",
"uri": "udp://<address>:<port>"
}
data_in : Each received token will be sent to address set via control port
control_in : Control port
network.socketclient, regexp
HTTP method DELETE
url : url to send to params : dictionary with query parameters (or null) headers: dictionary with headers to include in request (or null) auth : dictionary with authtype (basic/digest), username and password (or null)
data : execute request, include data as body if not null or boolean
status : status of request
headers : JSON dictionary of incoming headers
data : body of response (if any)
http.delete
Send delete to URL
URL : URL to send delete to
params : dictionary with query parameters (optional)
headers : dictionary with headers to include in request (optional)
auth : dictionary with authtype (basic/digest), username and password (optional)
status : HTTP status of request
headers : dictionary of response headers
data : body of response (only if body is non-empty)
http.delete
Listen for UDP messages on a given port. Address is of the form "ip:port" (note: ip is ipv4)
data : data in packets received on the UDP port will forwarded as tokens.
network.udplistener
Generate Basic Authorization header from username/password
credential : JSon with values for "username" and "password"
header : Authorization header
base64
Etablish a TCP connection and forward all tokens except EOST on this connection. Any recevied data on the TCP connection is forwarded according to either Line mode or Raw mode.
host : The host name as a string
port : The port number
handle : A handle to the connection for which the data is meant.
token : Each received token will be sent to the client matching the handle.
handle : A handle to the connection from which the data was received.
token : Data received on the TCP connection will be sent as tokens.
network.tcpserver
Subscribe to given topics (list of mqtt ), output messages on message-port
Arguments: hostname: <ip/name of mqtt broker>, port: <port to use on mqtt broker>, topics: <list of topics to subscribe to>
settings is a dictionary with optional arguments : { "tls": { "ca_certs": , "certfile": , "keyfile": , "tls_version": , "ciphers": }, "auth": { "username": <username "password": }, "will": { "topic": , "payload": }, "transport": , "client_id": }
message : dictionary {"topic": <topic>, "payload": <payload>}
mqtt.subscribe
Publish all incoming messages to given broker"
Arguments: hostname: <ip/name of of mqtt broker>, port: <port to use on mqtt broker>,
Settings is a dictionary with optional arguments.
{
"tls": {
"ca_certs": <ca certs>, "certfile": <certfile>, "keyfile": <keyfile>,
"tls_version": <tls version>, "ciphers": <ciphers>
},
"auth": { "username": <username "password": <password> },
"will": { "topic": <topic>, "payload": <payload> },
"transport": <tcp or websocket>,
"client_id": <id of this mqtt client>
"topic": <prefix all outgoing message topics with this>
}
topic : topic of message
payload : payload of message
mqtt.publish
HTTP method POST url : url to send to params : dictionary with query parameters (or null) headers: dictionary with headers to include in request (or null) auth : dictionary with authtype (basic/digest), username and password (or null)
data : execute request, include data as body if not null or boolean
status : status of request
headers : JSON dictionary of incoming headers
data : body of response (if any)
http.post
Post data to URL
URL : URL to put to
data : Data to put
params : dictionary with query parameters (optional)
headers : dictionary with headers to include in request (optional)
auth : dictionary with authtype (basic/digest), username and password (optional)
status : HTTP status of request
headers : dictionary of response headers
data : body of response (only if body is non-empty)
http.put
Etablish a TCP connection and forward all tokens. Any recevied data on the TCP connection is forwarded according to protocol.
data_in : Each received token will be sent out through the TCP connection.
control_in : Each received token will be sent out through the TCP connection.
data_out : Data received on the TCP connection will be sent as tokens.
network.socketclient, regexp
Measure temperature.
trigger : any token triggers meausurement
centigrade : temperature, in centigrade
io.temperature
React to changes in a sensor.
open : state true=closed, false=open
io.lightbreaker
Read Relative Humidity when told to.
measure : Triggers a temperature reading
percent : The measured humidity in percent
io.humidity
Measure the rotation. Takes the period of measurements, in microseconds, as input.
rotation : Rotation around the x,y and z axis. Is returned as a dict with the x,y, and z keys.
io.gyroscope
Measure temperature. Takes the period of measurements, in seconds, as input.
centigrade : temperature, in centigrade
io.temperature, sys.timer.once
Measure distance. Takes the period of measurements, in seconds, as input.
meters : distance, in meters
io.distance, sys.timer.repeating
Measure atmospheric pressure
trigger : any token triggers measurement
mbar : atmospheric pressure, in millibars
io.pressure
RFIDReader - read MIFare Classic/ultralight when present.
data : {"cardno": uid, "data": <data>, "timestamp": <timestamp>}
io.rfid, time
Measure the acceleration. Takes the period of measurements, in microseconds, as input.
acceleration : Acceleration as a dict with the x,y, and z directions.
io.accelerometer
React to presence of magnetic field.
state : true if magnetic field present, false otherwise
io.hallswitch
Measure the moisture level in the soil.
trigger : any token triggers meausurement
level : moisture level, in percent
io.soilmoisture
Measure distance.
trigger : any token triggers meausurement
meters : distance, in meters
io.distance
Produce sequence of items by iterating over 'token', or simply pass 'token' along if not iterable (i.e. list, dict, or string)
N.B. Empty iterables produces a 'null' token.
FIXME: Is 'null' production the right thing? Exception? Nothing?
token : any token
item : item (or value if input is dictionary)
index : index of item (or key if input is dictionary)
copy
Interleave incoming tokens with end of string token (EOS) on outport.
data_in : Tokens, any kind.
data_out : Tokens seen on input, interleaved with EOS
Data on inport is passed on to outport unchanged. If nothing has arrived on the inport after timeout
seconds, then true is sent on the timeout port.
If parameter immediate
is false, then the timer will not start until at least one token has arrived, otherwise it will start upon instantiation.
data : anything
data : whatever arrived on the inport of the same name
timeout : true iff timeout seconds has passed without tokens on inport
sys.timer.once
After first token, pass on token once every 'delay' seconds.
token : anything
token : anything
sys.timer.repeating
Produce a counter token on the output every period seconds and for steps times, using a timer.
integer : Integer counter
sys.timer.once, sys.timer.repeating
Consume a token and stringify its value
in :
out :
After first token, pass on token once every 'delay' seconds. *Deprecated*
This actor is identical to ClassicDelay.
token : anything
token : anything
sys.timer.repeating
forward a token unchanged and Burns cycles
token : a token
token : the same token
Send predetermined data on output. Never ending sequence.
token : given data
sys.schedule
Read a number and compute a cumulative sum
integer : Number
integer : Cumulative sum
forward a token unchanged
token : a token
token : the same token
Perform a REL b where REL is a comparison relation passed as (a string) argument.
Allowed values for REL are: =, <, >, <=, >=, !=
a : a token
b : a token
result : true or false according to result of 'a' REL 'b'
math.arithmetic.eval
Sample 'in' and hold it internally if 'sample' input is true, replacing any previous value.
Produce the held token on the 'out' port regardless of wether 'sample' is true or false. Assumes 'false' or 'true' as input to 'sample', other values are considered 'false'.
sample : Sample 'in' if true.
in : A token
out : The currently held token, or the 'default' argument if not sampled yet.
copy
Produce next integer in a sequence 1,2,3,...
integer : Integer
sys.schedule
Sends input on after a given delay has passed. Preserves time between tokens.
token : anything
token : anything
sys.timer.once
Consume a token and produce a constant from a sequence
in :
out :
Consume a token and produce a constant
in :
out :
Pass on given _data_ every _tick_ seconds
data : given data
sys.timer.repeating
Actor: test.FiniteCounter(start=0, replicate_mult=false, repeat=false, steps=9223372036854775807, stopped=false)
Produce next token in a sequence start, start+1, ..., start+steps-1, EOSToken If repeat is True will repeat sequence
integer : Integer
Sends input on after a random delay has passed.
token : anything
token : anything
math.random, sys.timer.once
Write tokens to standard output
token : Any token
forward a token with replica index prepended
token : a token
token : the prepended token
This is only intended to be used for testing. Perform processing on input token and send out.
data : a token
result : result of processing
forward a token unchanged like identity Starts as shadow and can be later changed to not be a shadow by having a fakeshadow requires (but needs to be migrated to reeval)
token : a token
token : the same token
mock.shadow
Prepends <prefix> to input tokens and passes them to ouput port as strings
in : Text token
out : Prefixed text token
Join strings into a text token using delimiter 'delim' (defaults to '\n')
Consume consecutive strings until an end-of-stream (EOSToken) is received, which triggers an output of the joined lines. After receiving the EOFToken, the LineJoin is reset and ready for new lines to join.
line : arbitrary string
text : strings joined by
Return length of string
string : arbitrary string
length :
Count occurances of words in a stream of words.
in : a word
out : count for each word
Appends <postfix> to input tokens and passes them to ouput port as strings
in : Text token
out : Postfixed text token
Format output according to 'fmt' using dict
Format string uses "{access.key.path}" to access dict
dict :
text : Formatted string
regexp
Split string into list of strings on delimiter 'delim'. Consumes delimiter.
text : arbitrary string
lines : list of strings
Formats string based on template and incoming dictionary
Format string uses "{{access.key.path}}" to access dict Also refer to Mustache documentation (http://mustache\.github\.io/\)
dict :
text : formatted string
mustache
Apply the regex supplied as argument to the incoming text.
If the regex matches, the text is routed to the 'match' output, otherwise it is routed to the 'no_match' output. If a (single) capture group is present, the captured result will be routed to 'match' instead of the full match, but it the match fails, the full input text will be routed to 'no_match' just as if no capture group was present. Any additional capture groups will be ignored.
text : text to match
match : matching text or capture if capture group present
no_match : input text if match fails
regexp
Return the (UTC) time in seconds since Jan 1st 1970
Detailed information
trigger : any token
timestamp : floating point number
time
Return a dictionary with current date and time.
The dictionary contains entries for: century, year, month, day, hour, minute, second, timezone
trigger : any token
datetime : dictionary
time
Get current weather where runtime is located (or think it is located)
trigger : start fetching weather on any token
forecast : weather at preconfigured city, or null on error
weather.local
Get current weather at selected destination, given as "city,country code", "city", or ",country code"
trigger : start fetching weather on any token
forecast : weather at given city, or null on error
weather
Post incoming tokens (text) as twitter status
status : A text (with a maximum length)
web.twitter.post
Post incoming tokens (text) to runtime specific pushbullet channel with given title
message : A message
web.pushbullet.channel.post
Get current weather at selected destination, given as "city,country code", "city", or ",country code"
location : location to fetch weather from
forecast : weather at given city, or null on error
weather