Switch tile
A device that a tap switches on or off, such as a socket.
In a dashboard file: "type": "switch", with the options below. Every tile also has the fields under Every tile.
Example
Section titled “Example”A tile, as it goes in a screen’s tiles:
{ "type": "switch", "label": "Coffee machine", "layout": { "x": 1, "y": 1, "width": 1, "height": 1 }, "dataSource": { "connection": "demo", "params": { "device": "coffee-machine", "value": "switch" } }, "options": { "onIcon": "mug-hot", "offIcon": "mug-saucer", "onColor": "#ffcc00" }}It reads the demo home: in a dashboard with the connection "demo": { "driver": "demo", "config": {} }, it works as it is. To read a device of your own, its data source names one of your connections, with the params of that connection’s driver (Connections and data sources).
Options
Section titled “Options”| Field | Type | Default | What |
|---|---|---|---|
source |
data source name | primary |
Device. One of the tile’s data sources, by name, that gives on or off. |
onIcon |
icon name | toggle-large-on |
Icon when on. By its name in the icon set. |
offIcon |
icon name | toggle-large-off |
Icon when off. By its name in the icon set. |
onColor |
colour | #ffff00 |
Colour when on. A look option: a tile style can set it. |
offColor |
colour | #808080 |
Colour when off. A look option: a tile style can set it. |
onStyle |
object | Tile style when on. The tile’s style while it is on, over its own. Its fields: Tile style. | |
offStyle |
object | Tile style when off. The tile’s style while it is off or not yet known, over its own. Its fields: Tile style. |
Built-in styles
Section titled “Built-in styles”The styles the app offers for it, after “The dashboard’s style”. Style files says what they set.
- Centred
- Left aligned
- Compact
- Icon at the left