Leverege Platform

Leverege Platform

  • Overview
  • JSDocs
  • REST API
  • Help

›Utilities

Platform Overview

  • Overview
  • Architecture
  • Core Concepts

Guides

  • Platform Setup
  • Building a Project
  • API UI

Services

  • API Server
  • Message Processor
  • Transponder
  • Reason
  • Scheduler
  • Messenger
  • Emailer
  • Rest Server
  • DB Curator

API

  • API
  • Interface
  • Project
  • System
  • Device
  • Blueprint
  • Collection
  • Child
  • History
  • Scenario
  • Script
  • Template
  • Timer
  • User
  • Users

Server Libraries

  • Log
  • Messages
  • Message Queue
  • Cache
  • Lock
  • Limit
  • Cluster Manager
  • Error
  • Exit

Utilities

  • Promise
  • Data Store
  • Factory
  • Path
  • Reasoner
  • Object Util
  • Array Util
  • String Util
  • Base62 Util
  • Value Cache
  • Validator
  • Lol

UI

  • API Redux
  • UI Builder
  • UI Elements
  • UI Redux
  • UI Mapbox Elements
  • UI Active Theme
  • UI Color Elements
  • UI Linear View Elements

Reasoner

The reasoner library abstracts FaaS capabilities, wrapping scripts that can be run and triggered from anywhere in the Leverege Platform. Currently only Cloud Functions are supported by reasoner. Reasoner prepares a context with device, system, blueprint and project information in addition to several methods, and then invokes the script with that context.

Deploying

A script is deployed through the ui, under the script section, scripts can be created, edited, deployed and have their logs viewed.

Context

The context enables a lot of functionality that can be utilized within Reason scripts. The context comes with several data properties and several methods.

Properties

keytypedescription
scriptIdstringid of script
deviceDataobjectcurrent data of the device (before the incoming data reasoner receives)
cacheobjectcache for the device for this script
systemobjectcurrent data of the system
deviceobjectcurrent device information
blueprintobjectblueprint information of the device
scriptCacheobjectcache for the script
paramsobjectuser defined parameters to run the script with

Methods

  1. setCache( data )

The setCache method is used to set the cache for the device. This cache then gets added to the context for subsequent times the reason script is triggered by a device change.

paramtypedescription
dataobjectthe data to be set for the device's cache
  1. setScriptCache( data )

The setScriptCache method is used to set the cache for the script. This cache then gets added to the context for subsequent times the reason script is triggered via the scriptCache property.

paramtypedescription
dataobjectthe data to be set for the script's cache
  1. sendEmail( msg, targets )

The sendEmail method is used to send emails. This method formats an EmailMsg which is then sent into the Leverege Platform, where it is received and processed by Emailer.

paramtypedescription
msgobjectfollows the format of an EmailMsg, does not need to specify a to field
targetsarraythe recipients of the email
  1. sendSms( msg, targets )

The sendSms method is used to send SMS messages. This method formats a SmsMsg which is then sent into the Leverege Platform, where it is received and processed by Messenger.

paramtypedescription
msgobjectfollows the format of an SmsMsg, does not need to specify a to field
targetsarraythe recipients of the SMS
  1. setDeviceData( pathValueArray )

This method is used to set device data.

paramtypedescription
pathValueArrayarrayarray of objects
pathValueArray[x].pathstring/ separated string that specifies where to save the value to
pathValueArray[x].valueanythe value to be saved to the device
  1. log( args )

This method currently just uses console.log, but is recommended in case any additional logging functionality is added or existing functionality gets changed.

  1. error( args )

This method currently just uses console.error, but is recommended in case any additional logging functionality is added or existing functionality gets changed.

← PathObject Util →
  • Deploying
  • Context
Leverege Platform
Docs
Overview
Connect
FacebookLinkedInTwitter
Facebook Open Source