To enable debug logging, use the [console logging]({{base}}/administration/logging.html) commands to enable debug logging for the automation functionality:
-```text
+```shell
log:set DEBUG org.openhab.core.automation
```
To enable debug logging, use the [console logging]({{base}}/administration/logging.html) commands to enable debug logging for the automation functionality:
-```text
+```shell
log:set DEBUG org.openhab.core.automation
```
1) Create a rule with a trigger of your choice
-```php
+```java
rule "Say welcome if the door opens"
when
Item Door_Contact changed to OPEN
You can also use [SSML](https://docs.aws.amazon.com/polly/latest/dg/supported-ssml.html) to provide a better voice experience
-```php
+```java
rule "Say welcome if the door opens"
when
Item Door_Contact changed to OPEN
Simple:
-```php
+```java
rule "Say welcome if the door opens"
when
Item Door_Contact changed to OPEN
You can use a json formatted string to control title, sound and volume:
-```php
+```json
{"sound": true, "speak":"<Speak>", "title": "<Title>", "body": "<Body Text>", "volume": 20}
```
### argoclima.sitemap
-```java
+```perl
// All things in all modes expose the same channels
Frame label="❄ HVAC Control" {
Switch item=ArgoClimaHVACRemote_Power
Auto-discovery is enabled by default.
To disable it, you can add the following line to `<openHAB-conf>/services/runtime.cfg`:
-```text
+```ini
discovery.avmfritz:background=false
```
Background discovery is **enabled** by default.
To **disable** background discovery, add the following line to the _conf/services/runtime.cfg_ file:
-```text
+```ini
discovery.bigassfan:background=false
```
Background discovery is **enabled** by default.
To **disable** background discovery, add the following line to the _conf/services/runtime.cfg_ file:
-```text
+```ini
discovery.daikin:background=false
```
- **When** `calculateParameters` is triggered in `myquery`
- **Then** executes the following script action (in that example Jython):
-```text
+```python
map = {"time" : "-2h"}
dbquery = actions.get("dbquery","dbquery:query:myquery")
dbquery.setQueryParameters(map)
## Full Example
-### `.things` file:
+### `.things` file
-```perl
+```java
Thing emotiva:processor:1 "XMC-2" @ "Living room" [ipAddress="10.0.0.100", protocolVersion="3.0"]
```
-### `.items` file:
+### `.items` file
-```perl
+```java
Switch emotiva-power "Processor" {channel="emotiva:processor:1:general#power"}
Dimmer emotiva-volume "Volume [%d %%]" {channel="emotiva:processor:1:main-zone#volume"}
Number:Dimensionless emotiva-volume-db "Volume [%d dB]" {channel="emotiva:processor:1:main-zone#volume-db"}
String emotiva-menu-tottom-end "" <none> {channel="emotiva:processor:1:general#menu-display-bottom-end"}
```
-### `.sitemap` file:
+### `.sitemap` file
```perl
Group item=emotiva-input label="Processor" icon="receiver" {
// Examples of items for calculating the energy purchased and sold. Look at the demo.rules section.
Number:Currency SoldEnergy "Total sold energy [%.2f €]" <price> (GF_UtilityRoomSolar)
Number:Currency PurchasedEnergy "Total purchased energy [%.2f €]" <price> (GF_UtilityRoomSolar)
-
```
### demo.sitemap
Please note that the device meter ID is only available through the API and not available on the Flume portal.
When the Bridge device is first created, there will be a log message with the ID of the discovered device which can be used in further configuring the device via the text files.
-```
+```java
Bridge flume:cloud:cloudconnector [ username="xxx", password="xxx", clientId="xxx", clientSecret="xxx" ] {
-
meter-device meter [ id="xxx" ]
}
```
### Item Configuration
-```
+```java
Number:VolumetricFlowRate InstantUsage "Instant Usage" { channel = "flume:meter-device:1:meter:instant-usage" }
Number:Volume CumulativeUsed "Cumulative Used" { channel = "flume:meter-device:1:meter:cumulative-usage" }
Number:Dimensionless BatteryLevel "Battery Level" { channel = "flume:meter-device:1:meter:battery-level" }
DateTime LastSeen "Last Seen" { channel = "flume:meter-device:1:meter:last-seen" }
Switch LowPower "Battery Low Power" { channel = "flume:meter-device:1:meter:low-battery" }
-
```
### Rules
Background discovery is **enabled** by default.
To disable background discovery, add the following line to the _conf/services/runtime.cfg_ file:
-```text
+```ini
discovery.globalcache:background=false
```
This binding includes rule actions, which allow you to setup programs for battery charging and discharging.
Each inverter thing has a separate actions instance, which can be retrieved as follows.
-```php
+```java
val growattActions = getActions("growatt", "growatt:inverter:home:sph")
```
Where the first parameter must always be `growatt` and the second must be the full inverter thing UID.
Once the action instance has been retrieved, you can invoke the following method:
-```php
+```java
growattActions.setupBatteryProgram(int programMode, @Nullable Integer powerLevel, @Nullable Integer stopSOC, @Nullable Boolean enableAcCharging, @Nullable String startTime, @Nullable String stopTime, @Nullable Boolean enableProgram)
```
The following is an example program to charge the battery during a night-time low tariff period, and depending on the forecast solar energy for the coming day.
-```php
+```java
// solar power constants
val Integer programMode = 1 // 0 = Load First, 1 = Battery First, 2 = Grid First
val Integer powerLevel = 23 // percent
The following is an example program to charge the battery in preparation to avoid importing energy during a coming extra high tariff time window.
-```php
+```java
// solar power constants
var pauseProgramLastSetupDate
A suggested Grott configuration for openHAB is as follows:
-```php
+```ini
[Generic]
mode = proxy
compat = False
- Copy the `grott.service` file to the `/etc/systemd/system/` folder
- Modify `grott.service` to enter your user name; the Grott settings; the path to Python; and the path to the Grott application:
-```php
+```ini
[Service]
SyslogIdentifier=grott
User=<username> // your username
### `demo.sitemap` File
-```php
+```perl
Frame label="Living Room" {
Switch item=Living_Room_Shades_Scene_Open
Slider item=Living_Room_Shade_Position
Auto-discovery is enabled by default.
To disable it, you can add the following line to `<openHAB-conf>/services/runtime.cfg`:
-```text
+```ini
discovery.hue:background=false
```
This binding includes a rule action, which allows to change a light channel with a specific fading time from within rules.
There is a separate instance for each light or light group, which can be retrieved e.g. through
-```php
+```java
val hueActions = getActions("hue","hue:0210:00178810d0dc:1")
```
where the first parameter always has to be `hue` and the second is the full Thing UID of the light that should be used.
Once this action instance is retrieved, you can invoke the `fadingLightCommand(String channel, Command command, DecimalType fadeTime)` method on it:
-```php
+```java
hueActions.fadingLightCommand("color", new PercentType(100), new DecimalType(1000))
```
### Events
- ```php
+ ```java
rule "example trigger rule"
when
Channel "hue:0820:1:dimmer-switch:dimmer_switch_event" triggered <EVENT>
Be aware that the events have a '.0' attached to them, like `2001.0` or `34.0`.
So, testing for specific events looks like this:
-```php
+```java
if (receivedEvent == "1000.0") {
//do stuff
}
This binding includes a rule action, which implements dynamic (i.e. gradual) transitions to a new scene or light(s) state.
Each thing has a separate action instance, which can be retrieved as follows.
-```php
+```java
val hueActions = getActions("hue","hue:device:g24:11111111-2222-3333-4444-555555555555")
```
Where the first parameter must always be `hue` and the second must be the full thing UID.
Once the action instance has been retrieved, you can invoke its `dynamicCommand(String channelId, Command command, Long durationMs)` method as follows.
-```php
+```java
hueActions.dynamicCommand("brightness", new PercentType(100), new Long(10000))
hueActions.dynamicCommand("scene", new StringType("SceneName"), new Long(20000))
### icloud.things
-```php
+```java
Bridge icloud:account:myaccount [appleId="mail@example.com", password="secure", code="123456", refreshTimeInMinutes=5]
{
Thing device myiPhone8 "iPhone 8" @ "World" [deviceId="VIRG9FsrvXfE90ewVBA1H5swtwEQePdXVjHq3Si6pdJY2Cjro8QlreHYVGSUzuWV"]
### icloud.items
-```php
+```java
Group iCloud_Group "iPhone"
String iPhone_BatteryStatus "Battery Status [%s]" <battery> (iCloud_Group) {channel="icloud:device:myaccount:myiPhone8:batteryStatus"}
### icloud.sitemap
-```php
+```perl
sitemap icloud label="iCloud" {
Frame item=iCloud_Group {
Text item=iPhone_BatteryStatus
### icloud.rules
-```php
+```java
rule "iPhone Home"
when
Item iPhone_Location changed
Device types are defined in the file `device_types.xml`, which is inside the Insteon bundle and thus not visible to the user.
You can however load your own device_types.xml by referencing it in the network config parameters:
-```text
+```ini
additionalDevices="/usr/local/openhab/rt/my_own_devices.xml"
```
If you can't build a new device out of the existing device features (for a complete list see `device_features.xml`) you can add new features by specifying a file (let's call it `my_own_features.xml`) with the "additionalDevices" option in the network config parameters:
-```text
+```ini
additionalFeatures="/usr/local/openhab/rt/my_own_features.xml"
```
To define a parameter value in a .things file, please refer to it by parameter's ID, for example:
-```text
+```ini
keepAlivePeriod=120
```
- Constant Score: drive at constant speed e.g. use *cruise control*
- Bonus Range: assumed bonus range vs. a *very sportive driver*
-
### Position
Group name: `position`
## Vehicle Actions
-Actions for `vehicle` [thing}(#vehicle) are provided.
+Actions for `vehicle` [thing](#vehicle) are provided.
### `sendPOI`
Required information
-```
- val mercedesmeActions = getActions("mercedesme","mercedesme:bev:4711:eqa")
- mercedesmeActions.sendPOI("Eiffel Tower",48.85957476434348,2.2939068084684853)
+```java
+val mercedesmeActions = getActions("mercedesme","mercedesme:bev:4711:eqa")
+mercedesmeActions.sendPOI("Eiffel Tower",48.85957476434348,2.2939068084684853)
```
Full information
-```
- val mercedesmeActions = getActions("mercedesme","mercedesme:bev:4711:eqa")
- mercedesmeActions.sendPOI("Eiffel Tower",48.85957476434348,2.2939068084684853,"Paris","Av. Gustave Eiffel", "75007")
+```java
+val mercedesmeActions = getActions("mercedesme","mercedesme:bev:4711:eqa")
+mercedesmeActions.sendPOI("Eiffel Tower",48.85957476434348,2.2939068084684853,"Paris","Av. Gustave Eiffel", "75007")
```
## Discover your Vehicle
GPS data which is showing your location is anonymized.
Please double check yourself no critical data is inside.
The content of these items shall be used to create a problem report.
-During development the `proto-update` contains an entry with binding version information.
+During development the `proto-update` contains an entry with binding version information.
-```
- "bindingInfo": {
- "oh-bundle": "4.1.0.202309241814",
- "version": "2.2-alpha",
- "vehicle": "mercedesme:bev"
- }
+```json
+"bindingInfo": {
+ "oh-bundle": "4.1.0.202309241814",
+ "version": "2.2-alpha",
+ "vehicle": "mercedesme:bev"
+}
```
Keep these 3 channels disconnected during normal operation.
### POI ruleExample
-```
+```java
// send POI from JSON String item
rule "Send POI"
when
The default value is 15 seconds.
If you want to change this value just add the following line to your `$OPENHAB_CONF/services/runtime.cfg` file.
-```text
+```ini
discovery.miele:removalGracePeriod=30
```
This can e.g. be achieved on openHABian the following way:
-```text
+```shell
sudo nano /etc/sysctl.conf`
+```
Add the following at the bottom of the file:
+```ini
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
-
```
Reboot your server after the change.
Create a `<openHAB-conf>/services/network.cfg` file and use the above options like this:
-```text
+```ini
binding.network:allowSystemPings=true
binding.network:allowDHCPlisten=false
binding.network:arpPingToolPath=arping
Both workarounds can be implemented using a systemd system manager script, for example:
-```text
+```ini
[Install]
WantedBy=multi-user.target
The auto-discovery is enabled by default.
To disable it, you can create a file in the services directory called onkyo.cfg with the following content:
-```text
+```ini
org.openhab.onkyo:enableAutoDiscovery=false
```
Model specific
-```text
+```java
onkyo:TX-NR818:avr-livingroom [ipAddress="192.168.1.100", port=60128]
```
Generic model
-```text
+```java
onkyo:onkyoAVR:avr-livingroom [ipAddress="192.168.1.100", port=60128]
```
Optionally you can specify the refresh interval by `refreshInterval` parameter.
-```text
+```java
onkyo:onkyoAVR:avr-livingroom [ipAddress="192.168.1.100", port=60128, refreshInterval=30]
```
Maximum volume level can also be configured by `volumeLimit` parameter.
This prevent setting receiver volume level too high, which could damage your speakers or receiver.
-```text
+```java
onkyo:onkyoAVR:avr-livingroom [ipAddress="192.168.1.100", port=60128, volumeLimit=50]
```
Note that this is applied after the volume limiting took place.
-```text
+```java
onkyo:onkyoAVR:avr-livingroom [ipAddress="192.168.1.100", port=60128, volumeScale=2]
```
The auto-discovery is enabled by default.
To disable it, you can create a file in the services directory called pioneeravr.cfg with the following content:
-```text
+```ini
#Put your configuration here
org.openhab.pioneeravr:enableAutoDiscovery=false
```
You can use the GUI on the bindings page (click on the pulseaudio binding then "Expand for details"), or create a `<openHAB-conf>/services/pulseaudio.cfg` file and use the above options like this:
-```text
+```ini
binding.pulseaudio:sink=true
binding.pulseaudio:source=true
binding.pulseaudio:sinkInput=false
Examples on how to do searches from rules, or you can also change an item to take input by using `oh-input-item` using metadata called `Default list item widget`.
-
Search for all stations that contain `hit` in their name, and auto select the first result.
-```
+```java
Radio_Station.sendCommand("hit")
```
Search and auto select the station if you know the UUID from the website.
-```
+```java
Radio_Station.sendCommand("b6a490e8-f498-4a7c-b024-607b3d997614")
```
Clear any manual search results using the above two methods, and `REFRESH` back to using the normal filter channels.
-```
+```java
Radio_Station.sendCommand(REFRESH)
```
Items file example for a SUN-12K-SG04LP3-EU inverter
-```text
+```java
Number:Temperature AC_Temperature "AC Temperature [%.1f °C]" (solarman) {channel="solarman:logger:local:inverter-ac-temperature", unit="°C"}
Number Alert "Alert [%s]" (solarman) {channel="solarman:logger:local:alert-alert"}
Number:ElectricPotential Battery_Absorption_V "Battery Absorption V [%.2f V]" (solarman) {channel="solarman:logger:local:battery-battery-absorption-v", unit="V"}
telegram.items
-```php
+```java
String telegramMessage "Telegram Message" { channel = "telegram:telegramBot:2b155b22:lastMessageText" }
```
telegram.items
-```php
+```java
String telegramReplyId "Telegram Reply Id" { channel = "telegram:telegramBot:2b155b22:replyId" }
```
With Karaf you can use the following command sequence:
-```text
+```shell
log:set TRACE org.openhab.binding.velux
log:tail
```
This, of course, is possible on command line with the commands:
-```text
+```shell
% openhab-cli console log:set TRACE org.openhab.binding.velux
% openhab-cli console log:tail org.openhab.binding.velux
```
On the other hand, if you prefer a textual configuration, you can append the logging definition with:
-```text
+```xml
<logger name="org.openhab.binding.velux" level="TRACE">
<appender-ref ref="FILE" />
</logger>
Add the following lines to the logger configuration file (`userdata\etc\org.ops4j.pax.logging.cfg`):
-```text
+```ini
log4j2.logger.yamaha.name = org.openhab.binding.yamahareceiver
log4j2.logger.yamaha.level = TRACE
```
Given the following JSON string:
-`[{ "device": { "location": "Outside", "status": { "temperature": 23.2 }}}]`
+```json
+[{ "device": { "location": "Outside", "status": { "temperature": 23.2 }}}]
+```
The expression `$.device.location` extracts the string `Outside`.
The JsonPath expression `$.device.status.temperature` extracts the string `23.2`.
### Items
-```
+```java
String Temperature_json "Temperature [JSONPATH($.device.status.temperature):%s °C]" {...}
Number Temperature "Temperature [%.1f °C]"
```
### Rules
-```php
+```java
rule "Convert JSON to Item Type Number"
- when
+when
Item Temperature_json changed
- then
+then
// use the transformation service to retrieve the value
val newValue = transform("JSONPATH", "$.device.status.temperature", Temperature_json.state.toString)
// post the new value to the Number Item
Temperature.postUpdate( newValue )
- end
+end
```
Now the resulting Number can also be used in the label to [change the color](https://docs.openhab.org/configuration/sitemaps.html#label-and-value-colors) or in a rule as a value to compare.
-
## Differences to standard JsonPath
Compared to standard JsonPath, the transformation returns single values instead of arrays.
**.items**
-```csv
+```java
String Temperature_str "Temperature [REGEX(.*=(\\d*\\.\\d*).*):%s °C]" {...}
Number Temperature "Temperature [%.1f °C]"
```
**.rules**
-```php
+```java
rule "Convert String to Item Number"
- when
+when
Item Temperature_str changed
- then
+then
// use the transformation service to retrieve the value
val newValue = transform("REGEX", ".*=(\\d*\\.\\d*).*", Temperature_str.state.toString)
// post the new value to the Number Item
Temperature.postUpdate( newValue )
- end
+end
```
Now the resulting Number can also be used in the label to [change the color](https://docs.openhab.org/configuration/sitemaps.html#label-and-value-colors) or in a rule as value for comparison.
### .rules
-```php
+```java
rule "Convert XML to Item Type Number"
- when
+when
Item Temperature_xml changed
- then
+then
// use the transformation service to retrieve the value
// Simple
val mytest = transform("XPATH", "/*[name()='PTZStatus']
Its contents should look similar to:
-```text
+```ini
org.openhab.voice.pipertts:preloadModel=true
```
In case you would like to set up these settings via a text file, you can edit the file `runtime.cfg` in `$OPENHAB_ROOT/conf/services` and set the following entries:
-```text
+```ini
org.openhab.voice:defaultTTS=pipertts
```
Its contents should look similar to:
-```
+```ini
org.openhab.voice.rustpotterks:threshold=0.5
org.openhab.voice.rustpotterks:averagedthreshold=0.2
org.openhab.voice.rustpotterks:scoreMode=max
In case you would like to setup these settings via a text file, you can edit the file `runtime.cfg` in `$OPENHAB_ROOT/conf/services` and set the following entries:
-```
+```ini
org.openhab.voice:defaultKS=rustpotterks
org.openhab.voice:keyword=hey openhab
org.openhab.voice:listeningItem=myItemForDialog
Its contents should look similar to:
-```
+```ini
org.openhab.voice.voskstt:preloadModel=false
org.openhab.voice.voskstt:singleUtteranceMode=true
org.openhab.voice.voskstt:maxTranscriptionSeconds=60