Fork me on GitHub

Actions

Read about the usage of the api in the guide.

Framework

getGuiSettings

getGuiSettings() -> guiSettings : object

Get the GUI config options

Result

  • guiSettings (object)
    • config (object)
    • defaults (object)

HTTP-Request

  GET /api/config/settings/gui

restart

restart() -> void : 

Restart pimatic

Result

  • void

HTTP-Request

  POST /api/restart

getConfig

getConfig([password : string]) -> config : object

Get the config, fields will be blank if no password was provided

Parameters

  • password (string, optional)

Result

  • config (object) : The config

HTTP-Request

  GET /api/config

updateConfig

updateConfig(config : object)undefined

Update the config

Parameters

  • config (object)

HTTP-Request

  POST /api/config

Rules

addRuleByString

addRuleByString(ruleId : string, rule : object, [force : boolean])undefined

Add a rule by a string

Parameters

  • ruleId (string)
  • rule (object)
    • name (string)
    • ruleString (string)
    • active (boolean, optional)
    • logging (boolean, optional)
  • force (boolean, optional)

HTTP-Request

  POST /api/rules/:ruleId

updateRuleByString

updateRuleByString(ruleId : string, rule : object)undefined

Update a rule by a string

Parameters

  • ruleId (string)
  • rule (object)
    • name (string, optional)
    • ruleString (string, optional)
    • active (boolean, optional)
    • logging (boolean, optional)

HTTP-Request

  PATCH /api/rules/:ruleId

removeRule

removeRule(ruleId : string)undefined

Remove the rule with the given ID

Parameters

  • ruleId (string)

HTTP-Request

  DELETE /api/rules/:ruleId

getRules

getRules() -> rules : array

List all rules

Result

  • rules (array)

HTTP-Request

  GET /api/rules

getRuleById

getRuleById(ruleId : string) -> rule : object

List all rules

Parameters

  • ruleId (string)

Result

  • rule (object)

HTTP-Request

  GET /api/rules/:ruleId

getRuleActionsHints

getRuleActionsHints(actionsInput : string) -> hints : object

Get hints for the rule actions input field

Parameters

  • actionsInput (string)

Result

  • hints (object)
    • actions (array)
    • tokens (array)
    • autocomplete (array)
    • errors (array)
    • warnings (array)
    • format (array)

HTTP-Request

  POST /api/rules-parser/get-actions-hints

getRuleConditionHints

getRuleConditionHints(conditionInput : string) -> hints : object

Get hints for the rule condition input field

Parameters

  • conditionInput (string)

Result

  • hints (object)
    • predicates (array)
    • tokens (array)
    • autocomplete (array)
    • errors (array)
    • warnings (array)
    • format (array)

HTTP-Request

  POST /api/rules-parser/get-condition-hints

getPredicatePresets

getPredicatePresets() -> presets : array

Get predicates the user can choose from

Result

  • presets (array)

HTTP-Request

  GET /api/rules-parser/get-predicate-presets

getPredicateInfo

getPredicateInfo(input : string, [predicateProviderClass : string]) -> result : array

Get predicates info

Parameters

  • input (string)
  • predicateProviderClass (string, optional)

Result

  • result (array)

HTTP-Request

  GET /api/rules-parser/get-predicate-info

executeAction

executeAction(actionString : string, [simulate : boolean], [logging : string]) -> message : string

Execute a rule action by a given string

Parameters

  • actionString (string) : The action to execute
  • simulate (boolean, optional) : If it is true then only simulate the action.
  • logging (string, optional) : Log result message

Result

  • message (string)

HTTP-Request

  POST /api/execute-action

updateRuleOrder

updateRuleOrder(ruleOrder : array) -> ruleOrder : array

Update the order of all rules

Parameters

  • ruleOrder (array)

Result

  • ruleOrder (array)

HTTP-Request

  POST /api/rules

Variables

getVariables

getVariables() -> variables : array

List all variables

Result

  • variables (array)

HTTP-Request

  GET /api/variables

updateVariable

updateVariable(name : string, type : string, valueOrExpression : string, [unit : string]) -> variable : object

Update a variable value or expression

Parameters

  • name (string)
  • type (string)
  • valueOrExpression (string)
  • unit (string, optional)

Result

  • variable (object)

HTTP-Request

  PATCH /api/variables/:name

addVariable

addVariable(name : string, type : string, valueOrExpression : string, [unit : string]) -> variable : object

Add a value or expression variable

Parameters

  • name (string)
  • type (string)
  • valueOrExpression (string)
  • unit (string, optional)

Result

  • variable (object)

HTTP-Request

  POST /api/variables/:name

getVariableByName

getVariableByName(name : string) -> variable : object

Get infos about a variable

Parameters

  • name (string)

Result

  • variable (object)

HTTP-Request

  GET /api/variables/:name

removeVariable

removeVariable(name : string) -> variable : object

Remove a variable

Parameters

  • name (string)

Result

  • variable (object)

HTTP-Request

  DELETE /api/variables/:name

updateVariableOrder

updateVariableOrder(variableOrder : array) -> variableOrder : array

Update the order of all variables

Parameters

  • variableOrder (array)

Result

  • variableOrder (array)

HTTP-Request

  POST /api/variables

Devices

getDevices

getDevices() -> devices : array

List all devices.

Result

  • devices (array) : Array of all devices.
    • device (object)
      • id (string) : A user chosen string, used to identify that device.
      • name (string) : A user chosen string that should be used to display the device.
      • template (string) : Name of the template, that should be used to display the device.
      • attributes (array) : List of all attributes of the device.
      • actions (array) : List of all actions of the device.
      • config (object) : Config of the device, without default values.
      • configDefaults (object) : Default values for the config options.

HTTP-Request

  GET /api/devices

getDeviceById

getDeviceById(deviceId : string) -> device : object

Retrieve a device by a given ID.

Parameters

  • deviceId (string) : The ID of the device that should be returned.

Result

  • device (object) : The requested device or null if the device was not found.
    • id (string) : A user chosen string, used to identify that device.
    • name (string) : A user chosen string that should be used to display the device.
    • template (string) : Name of the template, that should be used to display the device.
    • attributes (array) : List of all attributes of the device.
    • actions (array) : List of all actions of the device.
    • config (object) : Config of the device, without default values.
    • configDefaults (object) : Default values for the config options.

HTTP-Request

  GET /api/devices/:deviceId

updateDeviceOrder

updateDeviceOrder(deviceOrder : array) -> deviceOrder : array

Update the order of all devices

Parameters

  • deviceOrder (array)

Result

  • deviceOrder (array)

HTTP-Request

  POST /api/devices

getDeviceClasses

getDeviceClasses() -> deviceClasses : array

List all registered device classes.

Result

  • deviceClasses (array)

HTTP-Request

  GET /api/device-class

getDeviceConfigSchema

getDeviceConfigSchema(className : string) -> configSchema : object

Get the config schema of a device class.

Parameters

  • className (string)

Result

  • configSchema (object)

HTTP-Request

  GET /api/device-class/:className

addDeviceByConfig

addDeviceByConfig(deviceConfig : object) -> device : object

Add a device by config values

Parameters

  • deviceConfig (object)

Result

  • device (object)
    • id (string) : A user chosen string, used to identify that device.
    • name (string) : A user chosen string that should be used to display the device.
    • template (string) : Name of the template, that should be used to display the device.
    • attributes (array) : List of all attributes of the device.
    • actions (array) : List of all actions of the device.
    • config (object) : Config of the device, without default values.
    • configDefaults (object) : Default values for the config options.

HTTP-Request

  POST /api/device-config

updateDeviceByConfig

updateDeviceByConfig(deviceConfig : object) -> device : object

Update a device by config values

Parameters

  • deviceConfig (object)

Result

  • device (object)
    • id (string) : A user chosen string, used to identify that device.
    • name (string) : A user chosen string that should be used to display the device.
    • template (string) : Name of the template, that should be used to display the device.
    • attributes (array) : List of all attributes of the device.
    • actions (array) : List of all actions of the device.
    • config (object) : Config of the device, without default values.
    • configDefaults (object) : Default values for the config options.

HTTP-Request

  PATCH /api/device-config

removeDevice

removeDevice(deviceId : string) -> device : object

Remove a device from the framework an config

Parameters

  • deviceId (string)

Result

  • device (object)
    • id (string) : A user chosen string, used to identify that device.
    • name (string) : A user chosen string that should be used to display the device.
    • template (string) : Name of the template, that should be used to display the device.
    • attributes (array) : List of all attributes of the device.
    • actions (array) : List of all actions of the device.
    • config (object) : Config of the device, without default values.
    • configDefaults (object) : Default values for the config options.

HTTP-Request

  DELETE /api/device-config/:deviceId

callDeviceAction

callDeviceAction(deviceId : string, actionName : string)undefined

Calls the action of the given device

Parameters

  • deviceId (string)
  • actionName (string)

HTTP-Request

  GET /api/device/:deviceId/:actionName

Groups

getGroups

getGroups() -> groups : array

List all groups.

Result

  • groups (array)
    • group (object)

HTTP-Request

  GET /api/groups

removeGroup

removeGroup(groupId : string) -> removed : object

Remove group

Parameters

  • groupId (string)

Result

  • removed (object)

HTTP-Request

  DELETE /api/groups/:groupId

addGroup

addGroup(groupId : string, group : object) -> group : object

Add a group

Parameters

  • groupId (string)
  • group (object)

Result

  • group (object)

HTTP-Request

  POST /api/groups/:groupId

updateGroup

updateGroup(groupId : string, group : object) -> group : object

Update a group

Parameters

  • groupId (string)
  • group (object)
    • name (optional)
    • devicesOrder (array, optional)
    • variablesOrder (array, optional)
    • rulesOrder (array, optional)

Result

  • group (object)

HTTP-Request

  PATCH /api/groups/:groupId

addDeviceToGroup

addDeviceToGroup(groupId : string, deviceId : string) -> deviceItem : object

Add a device to a group

Parameters

  • groupId (string)
  • deviceId (string)

Result

  • deviceItem (object)

HTTP-Request

  POST /api/groups/:groupId/devices/:deviceId

removeDeviceFromGroup

removeDeviceFromGroup(groupId : string, deviceId : string) -> group : object

Remove a device from a group

Parameters

  • groupId (string)
  • deviceId (string)

Result

  • group (object)

HTTP-Request

  DELETE /api/groups/:groupId/devices/:deviceId

addRuleToGroup

addRuleToGroup(groupId : string, ruleId : string, [position : number]) -> group : object

Add a rule to a group

Parameters

  • groupId (string)
  • ruleId (string)
  • position (number, optional)

Result

  • group (object)

HTTP-Request

  POST /api/groups/:groupId/rules/:ruleId

removeRuleFromGroup

removeRuleFromGroup(groupId : string, ruleId : string) -> group : object

Remove a rule from a group

Parameters

  • groupId (string)
  • ruleId (string)

Result

  • group (object)

HTTP-Request

  DELETE /api/groups/:groupId/rules/:ruleId

updateRuleGroupOrder

updateRuleGroupOrder(groupId : string, ruleOrder : array) -> group : object

Add a rule to a group

Parameters

  • groupId (string)
  • ruleOrder (array)

Result

  • group (object)

HTTP-Request

  POST /api/groups/:groupId/rules

addVariableToGroup

addVariableToGroup(groupId : string, variableName : string, [position : number]) -> group : object

Add a variable to a group

Parameters

  • groupId (string)
  • variableName (string)
  • position (number, optional)

Result

  • group (object)

HTTP-Request

  POST /api/groups/:groupId/variables/:variableName

updateDeviceGroupOrder

updateDeviceGroupOrder(groupId : string, deviceOrder : array) -> group : object

Update device order in group

Parameters

  • groupId (string)
  • deviceOrder (array)

Result

  • group (object)

HTTP-Request

  POST /api/groups/:groupId/devices

removeVariableFromGroup

removeVariableFromGroup(groupId : string, variableName : string) -> group : object

Remove a variable from a group

Parameters

  • groupId (string)
  • variableName (string)

Result

  • group (object)

HTTP-Request

  DELETE /api/groups/:groupId/variables/:variableName

updateVariableGroupOrder

updateVariableGroupOrder(groupId : string, variableOrder : array) -> group : object

Update variable order in group

Parameters

  • groupId (string)
  • variableOrder (array)

Result

  • group (object)

HTTP-Request

  POST /api/groups/:groupId/variables

updateGroupOrder

updateGroupOrder(groupOrder : array) -> groupOrder : array

Update the order of all groups

Parameters

  • groupOrder (array)

Result

  • groupOrder (array)

HTTP-Request

  POST /api/groups

Pages

getPages

getPages() -> pages : array

List all pages.

Result

  • pages (array)
    • page (object)
      • id (string) : A user chosen string, used to identify the page.
      • name (string) : A user chosen string that should be used to display the page.
      • devices (array) : List of all device ids that should be displayed on that page
        • deviceItem (object)
          • deviceId (string) : The id of the device to display at that position

HTTP-Request

  GET /api/pages

getPageById

getPageById(pageId : string) -> page : object

Get a page by ID

Parameters

  • pageId (string) : The ID of the page that should be returned.

Result

  • page (object) : The requested page or null if the page was not found.
    • id (string) : A user chosen string, used to identify the page.
    • name (string) : A user chosen string that should be used to display the page.
    • devices (array) : List of all device ids that should be displayed on that page
      • deviceItem (object)
        • deviceId (string) : The id of the device to display at that position

HTTP-Request

  GET /api/pages/:pageId

removePage

removePage(pageId : string) -> removed : object

Remove a page.

Parameters

  • pageId (string) : The ID of the page that should be removed.

Result

  • removed (object) : The removed page.
    • id (string) : A user chosen string, used to identify the page.
    • name (string) : A user chosen string that should be used to display the page.
    • devices (array) : List of all device ids that should be displayed on that page
      • deviceItem (object)
        • deviceId (string) : The id of the device to display at that position

HTTP-Request

  DELETE /api/pages/:pageId

addPage

addPage(pageId : string, page : object) -> page : object

Add a page.

Parameters

  • pageId (string) : The ID of the page that should be added.
  • page (object) : Object with ID and name of the page to create.
    • name (string) : A user chosen string that should be used to display the page.

Result

  • page (object) : The created page.
    • id (string) : A user chosen string, used to identify the page.
    • name (string) : A user chosen string that should be used to display the page.
    • devices (array) : List of all device ids that should be displayed on that page
      • deviceItem (object)
        • deviceId (string) : The id of the device to display at that position

HTTP-Request

  POST /api/pages/:pageId

updatePage

updatePage(pageId : string, page : object) -> page : object

Update a page name or device order.

Parameters

  • pageId (string) : The ID of the page to change.
  • page (object) : An object with properties that should be updated.
    • name (string, optional) : The new name to set.
    • devicesOrder (array, optional) : Array of ordered deviceIDs.
      • deviceId (string)

Result

  • page (object) : The updated page.
    • id (string) : A user chosen string, used to identify the page.
    • name (string) : A user chosen string that should be used to display the page.
    • devices (array) : List of all device ids that should be displayed on that page
      • deviceItem (object)
        • deviceId (string) : The id of the device to display at that position

HTTP-Request

  PATCH /api/pages/:pageId

addDeviceToPage

addDeviceToPage(pageId : string, deviceId : string) -> page : object

Add a page

Parameters

  • pageId (string)
  • deviceId (string)

Result

  • page (object)

HTTP-Request

  POST /api/pages/:pageId/devices/:deviceId

removeDeviceFromPage

removeDeviceFromPage(pageId : string, deviceId : string) -> page : object

Remove a device from a group.

Parameters

  • pageId (string)
  • deviceId (string)

Result

  • page (object)

HTTP-Request

  DELETE /api/pages/:pageId/devices/:deviceId

updatePageOrder

updatePageOrder(pageOrder : array) -> pageOrder : array

Update the order of all pages

Parameters

  • pageOrder (array)

Result

  • pageOrder (array)

HTTP-Request

  POST /api/pages

Plugins

getInstalledPluginsWithInfo

getInstalledPluginsWithInfo() -> plugins : array

List all installed plugins

Result

  • plugins (array)

HTTP-Request

  GET /api/plugins

searchForPluginsWithInfo

searchForPluginsWithInfo() -> plugins : array

Search for available plugins

Result

  • plugins (array)

HTTP-Request

  GET /api/available-plugins

getOutdatedPlugins

getOutdatedPlugins() -> outdatedPlugins : array

Get outdated plugins

Result

  • outdatedPlugins (array)

HTTP-Request

  GET /api/outdated-plugins

isPimaticOutdated

isPimaticOutdated() -> outdated : 

Is pimatic outdated

Result

  • outdated

HTTP-Request

  GET /api/outdated-pimatic

installUpdatesAsync

installUpdatesAsync(modules : array) -> status : any

Install updates without awaiting result

Parameters

  • modules (array)

Result

  • status (any)

HTTP-Request

  POST /api/update-async

addPluginsToConfig

addPluginsToConfig(pluginNames : array) -> added : array

Add plugins to config

Parameters

  • pluginNames (array)

Result

  • added (array)

HTTP-Request

  POST /api/config/plugins

removePluginsFromConfig

removePluginsFromConfig(pluginNames : array) -> removed : array

Remove plugins from config

Parameters

  • pluginNames (array)

Result

  • removed (array)

HTTP-Request

  DELETE /api/config/plugins

getUpdateProcessStatus

getUpdateProcessStatus() -> info : object

Get update status

Result

  • info (object)

HTTP-Request

  GET /api/update-process

Database

queryMessages

queryMessages([criteria : object]) -> messages : array

List log messages

Parameters

  • criteria (object, optional)
    • level (any, optional)
    • levelOp (string, optional)
    • after (date, optional)
    • before (date, optional)
    • limit (number, optional)

Result

  • messages (array)

HTTP-Request

  GET /api/database/messages

deleteMessages

deleteMessages([criteria : object])undefined

Delete messages older than the given date

Parameters

  • criteria (object, optional)
    • level (any, optional)
    • levelOp (string, optional)
    • after (date, optional)
    • before (date, optional)
    • limit (number, optional)

HTTP-Request

  DELETE /api/database/messages

addDeviceAttributeLogging

addDeviceAttributeLogging(deviceId : string, attributeName : string, time : number|boolean|string|array|date|object)undefined

Enable or disable logging for an device attribute

Parameters

  • deviceId (string)
  • attributeName (string)
  • time (number|boolean|string|array|date|object)

queryMessagesTags

queryMessagesTags([criteria : object]) -> tags : array

List all tags from the matching messages

Parameters

  • criteria (object, optional)
    • level (any, optional)
    • levelOp (string, optional)
    • after (date, optional)
    • before (date, optional)
    • limit (number, optional)

Result

  • tags (array)

HTTP-Request

  GET /api/database/messages/tags

queryMessagesCount

queryMessagesCount([criteria : object]) -> count : number

Count of all matches matching the criteria

Parameters

  • criteria (object, optional)
    • level (any, optional)
    • levelOp (string, optional)
    • after (date, optional)
    • before (date, optional)
    • limit (number, optional)

Result

  • count (number)

HTTP-Request

  GET /api/database/messages/count

queryDeviceAttributeEvents

queryDeviceAttributeEvents([criteria : object]) -> events : array

Get logged values of device attributes

Parameters

  • criteria (object, optional)
    • deviceId (string|array, optional)
    • attributeName (string|array, optional)
    • after (date, optional)
    • before (date, optional)
    • order (string, optional)
    • orderDirection (string, optional)
    • offset (number, optional)
    • limit (number, optional)

Result

  • events (array)

HTTP-Request

  GET /api/database/device-attributes/

queryDeviceAttributeEventsCount

queryDeviceAttributeEventsCount() -> count : number

Get count of saved device attributes events

Result

  • count (number)

HTTP-Request

  GET /api/database/device-attributes/count

queryDeviceAttributeEventsCounts

queryDeviceAttributeEventsCounts() -> counts : array

Get count of saved device attributes per atrtibute

Result

  • counts (array)

HTTP-Request

  GET /api/database/device-attributes/counts

queryDeviceAttributeEventsDevices

queryDeviceAttributeEventsDevices() -> devices : array

Get all device attribute infos in database

Result

  • devices (array)

HTTP-Request

  GET /api/database/device-attributes/devices

queryDeviceAttributeEventsInfo

queryDeviceAttributeEventsInfo() -> deviceAttributes : array

Get all device attribute infos in database

Result

  • deviceAttributes (array)

HTTP-Request

  GET /api/database/device-attributes-info

querySingleDeviceAttributeEvents

querySingleDeviceAttributeEvents(deviceId : string, attributeName : string, [criteria : object]) -> events : array

Get logged values of device attributes

Parameters

  • deviceId (string)
  • attributeName (string)
  • criteria (object, optional)
    • after (date, optional)
    • before (date, optional)
    • groupByTime (number, optional)
    • order (string, optional)
    • orderDirection (string, optional)
    • offset (number, optional)
    • limit (number, optional)

Result

  • events (array)

HTTP-Request

  GET /api/database/device-attributes/:deviceId/:attributeName

getDeviceAttributeLogging

getDeviceAttributeLogging() -> attributeLogging : array

Get device attribute logging times table

Result

  • attributeLogging (array)

setDeviceAttributeLogging

setDeviceAttributeLogging(attributeLogging : array)undefined

Set device attribute logging times table

Parameters

  • attributeLogging (array)

getDeviceAttributeLoggingTime

getDeviceAttributeLoggingTime(deviceId : string, attributeName : string) -> timeInfo : object

Get device attribute logging times table

Parameters

  • deviceId (string)
  • attributeName (string)

Result

  • timeInfo (object)

runVacuum

runVacuum()undefined

Run the sqlite3 vacuum pragma

HTTP-Request

  GET /api/database/vacuum

checkDatabase

checkDatabase() -> problems : array

Check database and config integrity

Result

  • problems (array)

HTTP-Request

  GET /api/database/check

deleteDeviceAttribute

deleteDeviceAttribute(id : number)undefined

Delete a device attribute from the database

Parameters

  • id (number)

HTTP-Request

  DELETE /api/database/device-attribue/by-id

updateDeviceAttribute

updateDeviceAttribute(id : number)undefined

Updates a device attribute info in database

Parameters

  • id (number)

HTTP-Request

  PATCH /api/database/device-attribue/by-id