Skip to content

plugins

Moritz Lammerich edited this page Mar 9, 2020 · 2 revisions

Plugins

Plugins are what gives YAHAS its functionality. The REST interface is a plugin. So is the web interface, and tha database connection, and so on. If you need YAHAS to do something more, you need a plugin. Unlike bindings which are given signle items to connect to other services, bindings get access to all items and can even modify them.

Loading Plugins

YAHAS automatically loads all plugins (*.so) in the plugins directory

Available Plugins

REST

provides a REST interface for items

Websocket

provides a websocket connection broadcasting items updates. Items can not currently by updated through the websocket connection.

Sites

provides a framework to create web GUIs for interacting with items.

Database

store item states in a mysql database.

Timeswitch

Set an item's state at a specified time. Supports setting multiple items. Weekdays or dates are currently not supported, so the item(s) are set at the specified time every day.

Configuration

This plugin is configured through config/plugins/timeswitch.json.

[
  {
    "time-item":
    {
      "namespace": "namespace of the item",
      "name": "name of item to control the time"
    },
    "state-item": {
      "namespace": "namespace of the item",
      "name": "name of item to specify state to send to controlled item"
    },
    "state": "optional state: this will override the state item",
    "controlled-item":
    [
      {
        "namespace": "namespace of the item",
        "name": "item to be set"
      },
      {
        "namespace": "namespace of the item",
        "name": "optional: 2nd item to be set"
        }
    ]
  }
]

timeswitch takes a JSON array of object, where each object represents a group of items to be controlled along with its configuration. Each element in this array needs at least a time-item to set the trigger time and controlled item which is an array of items to be set at that time. To set the state to be sent to the elements in controlled items you can either use the state field to set a fixed state, or set the state-item field to an item from which the state should be copied. Note that state-item will not be considered if state is set (i.e. a non-empty string).

Creating a Custom Plugin

more documentation to come soon (tm)

Clone this wiki locally