-
Notifications
You must be signed in to change notification settings - Fork 0
Explanation of Sitemaps
Sitemap Definition
Sitemaps are used to create elements of a user interface for making openHAB items accessible to various frontends.
Sitemaps are a declarative UI definition. With a few lines it is possible to define the structure and the content of your UI screens. Sitemap files are stored in ${openhab_home}/configurations/sitemaps
.
The openHAB runtime comes with a demo sitemap file, which should let you easily understand its structure.
For easy editing, the openHAB Designer brings full IDE support for these files, so you can easily check the syntax and find out about the options you have. (Again, for the technically interested, this is also an Xtext DSL.)
Sitemaps can be composed by grouping various user interface elements into areas, which will be rendered by openHAB.
The following elements can be used in a sitemap definition file (alphabetical order):
Element name | Description |
Colorpicker | |
Chart | |
Frame | Area with either various other sitemap elements or further nested frames |
Group | Renders all elements of a given group defined in an items defintion file |
Image | Renders an image |
List | |
Switch | Renders a switch item |
Selection | Renders a selection item |
Setpoint | |
Slider | Renders a slider |
Text | Renders a text element |
Video | Displays a video |
Webview |
Syntax:
Colorpicker [item="<itemname>"] [label="<labelname>"] [icon="<iconname>"] [sendFrequency=""]
Frames are used to create a visually separated area of items.
Syntax:
Frame [label="<labelname>"] [icon="<icon>"] [item="<item">]
{
[additional sitemap elements]
}
Syntax:
Group [item="<itemname>"] [label="<labelname>"] [icon="<iconname>"]
Syntax:
Image [item="<itemname>"] [icon="<iconname>"] url="<url of image>" [label="<labelname>"] [refresh=xxxx]
refresh is the refresh period of the image in milliseconds
Syntax:
Image [item="<itemname>"] [icon="<iconname>"] [label="<labelname>"] [service="<service>"] [period=xxxx] [refresh=xxxx]
refresh is the refresh period of the image in milliseconds
Syntax:
Switch item="<itemname>" [label="<labelname>"] [icon="<iconname>"] [mappings="<mapping definition>"]
Syntax:
Selection item="<itemname>" [label="<labelname>"] [icon="<iconname>"] [mappings="<mapping definition>"]
Syntax:
Setpoint item="<itemname>" [label="<labelname>"] [icon="<iconname>"] minValue="<min value>" maxValue="<max value>" step="<step value>"
Syntax:
Slider item="<itemname>" [label="<labelname>"] [icon="<iconname>"] [sendFrequency="frequency"] [switchEnabled]
Syntax:
List item="<itemname>" [label="<labelname>"] [icon="<iconname>"] [separator=""]
Syntax:
Text item="<itemname>" [label="<labelname>"] [icon="<iconname>"]
Syntax:
Video item="<itemname>" [icon="<iconname>"] url="<url of video to embed>"
Syntax:
Webview item="<itemname>" [label="<labelname>"] [icon="<iconname>"] url="<url>" [height="<heightvalue"]
Note The following is only available in v1.4 (from Late December 2013)
Sitemaps can be designed to show items dynamically, or add colors depending on their state, or the state of another item. A few use cases for this are -:
- Hide elements of a heating system depending on its mode
- Display different charts or URLs depending on the state of an item
- Show a battery warning of the voltage is low
- Highlight a value with a warning color if it's above or below limits
All widgets in the sitemap have the following three parameters available -:
- visibility
- labelcolor
- valuecolor
It is important to note that in all cases rules are parsed from left to right, and the first rule that returns true will take priority.
To dynamically show or hide an item, the visibility tag is used. By default, an item is visibile if the visibility tag is not provided. If provided, a set of rules are used to indicate the items visibility status. If any of the rules are true then the item will be visible, otherwise it will be hidden.
The format of the visibility tag is as follows -:
visibility=[item_name operator value, ... ]
Multiple rules can be provided using a comma as a delimiter. Valid operators are the ==, >=, <=, !=, >, <.
Examples
visibility=[Weather_Chart_Period!=ON]
visibility=[Weather_Chart_Period=="Today"]
visibility=[Weather_Chart_Period>1, Weather_Temperature!="Uninitialized"]
Colors can be used to emphasise an items label or its value.
The format of the labelcolor and valuecolor tags are as follows -:
labelcolor=[item_name operator value = "color", ... ]
Multiple rules can be provided using a comma as a delimiter. Valid operators are the ==, >=, <=, !=, >, <.
itemname and operator are optional - if not provided, itemname will default to the current item and operator will default to ==. So the following three rules will all do the same thing, and all are valid.
Text item=Weather_Temperature valuecolor=[22="green"]
Text item=Weather_Temperature valuecolor=[==22="green"]
Text item=Weather_Temperature valuecolor=[Weather_Temperature==22="green"]
The "color" is passed directly through to the UI, so its exact implementtion is up to the UI. It is generally expected that valid HTML colors can be used (eg "green", "red", "#334455") but a UI could for example define abstract colors that are defined internally depending on the theme. For example, "warning" could be defined and used in a UI dependant way, but there is currently no standardisation of these terms.
Examples
valuecolor=[>25="orange",>15="green",>5="orange",<5="blue"]
valuecolor=[Weather_LastUpdate=="Uninitialized"="lightgray",Weather_LastUpdate>600="lightgray",>15="green",>=10="orange",<10="red"]
- String comparissons are case sensitive, so
==ON
is not the same a==on
. - DateTime comparissons are relative to the current time and specified in seconds. So a rule >300 will return true if the DateTime item is set to a value that's newer than the past 5 minutes (300 seconds).
Installation
Community
- Support
- News Archive
- Presentations
- How to Contribute
- IDE Setup
- How to Implement a Binding
- How to Implement an Actions
- User Interfaces
- Classic UI
- iOS Client
- Android Client
- GreenT UI
- Bindings
- Asterisk Binding
- Bluetooth Binding
- Comfo Air Binding
- CUPS Binding
- digitalSTROM Binding
- DMX512 Binding
- EnOcean Binding
- Epson Projector Binding
- Exec Binding
- Fritz!Box Binding
- Fritz AHA Binding
- Homematic Binding
- HTTP Binding
- IHC / ELKO Binding
- KNX Binding
- Koubachi Binding
- MAX!Cube Binding
- MiLight Binding
- Modbus TCP Binding
- MPD Binding
- MQTT Binding
- Network Health Binding
- Nibe Heatpump Binding
- Nikobus Binding
- Novelan/Luxtronic Heatpump Binding
- NTP Binding
- One-Wire Binding
- Onkyo AV Receiver Binding
- OpenSprinkler Binding
- OSGi Configuration Admin Binding
- Philips Hue Binding
- Piface Binding
- Pioneer-AVR-Binding
- Plugwise Binding
- PLCBus Binding
- Pulseaudio Binding
- RFXCOM Binding
- Samsung TV Binding
- Serial Binding
- Snmp Binding
- Squeezebox Binding
- System Info Binding
- Somfy URTSI II Binding
- Sonos Binding
- TCP/UDP Binding
- TinkerForge Binding
- VDR Binding
- Wake-on-LAN Binding
- Z-Wave Binding
- Persistence
- db4o Persistence
- rrd4j Persistence
- Sql Persistence
- Sen.Se Persistence
- Cosm Persistence
- Logging Persistence
- Exec Persistence
- Automation
- Scripts
- Rules
- Actions
- Misc
- REST-API
- Security
- Google Calendar Support
- Twitter Action
- Service Discovery
- Dropbox Bundle
- CometVisu
Samples
- Item definitions
- Sitemap definitions
- Binding configurations
- Rules
- REST Examples
- Tips & Tricks
- FAQ
- XSLT Transforms
- Scripts
- Integration with other applications
- Syntax highlighting for external editors
- Update-Scripts
- Samples-Comfo-Air-Binding
Release Notes