Add JRuby examples in READMEs (#16948)

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
jimtng 2024-06-29 06:10:03 +10:00 committed by Ciprian Pascu
parent 54b32a2236
commit 1495404c72
8 changed files with 400 additions and 183 deletions

View File

@ -10,7 +10,7 @@ There is one bridge (`deconz`) that manages the connection to the deCONZ softwar
These sensors are supported:
| Device type | Resource Type | Thing type |
|-----------------------------------|-----------------------------------|------------------------|
| --------------------------------- | --------------------------------- | ---------------------- |
| Presence Sensor | ZHAPresence, CLIPPresence | `presencesensor` |
| Power Sensor | ZHAPower, CLIPPower | `powersensor` |
| Consumption Sensor | ZHAConsumption | `consumptionsensor` |
@ -33,7 +33,7 @@ These sensors are supported:
Additionally, lights, window coverings (blinds), door locks and thermostats are supported:
| Device type | Resource Type | Thing type |
|--------------------------------------|-----------------------------------------------|-------------------------|
| ------------------------------------ | --------------------------------------------- | ----------------------- |
| Dimmable Light | Dimmable light, Dimmable plug-in unit | `dimmablelight` |
| On/Off Light | On/Off light, On/Off plug-in unit, Smart plug | `onofflight` |
| Color Temperature Light | Color temperature light | `colortemperaturelight` |
@ -61,7 +61,7 @@ If your device is not discovered, please check the DEBUG log for unknown devices
These configuration parameters are available:
| Parameter | Description | Type | Default |
|------------------|-------------------------------------------------------------------------------------------------------------------------|---------|---------|
| ---------------- | ----------------------------------------------------------------------------------------------------------------------- | ------- | ------- |
| host | Host address (hostname / ip) of deCONZ interface | string | n/a |
| httpPort | Port of deCONZ HTTP interface | string | 80 |
| port | Port of deCONZ Websocket (optional, can be filled automatically) **(Advanced)** | string | n/a |
@ -125,7 +125,7 @@ Bridge deconz:deconz:homeserver [ host="192.168.0.10", apikey="ABCDEFGHIJ" ]
The sensor devices support some of the following channels:
| Channel Type ID | Item Type | Access Mode | Description | Thing types |
|-----------------------|--------------------------|-------------|-------------------------------------------------------------------------------------------|---------------------------------------------------|
| --------------------- | ------------------------ | ----------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------- |
| airquality | String | R | Airquality as string | airqualitysensor |
| airqualityppb | Number:Dimensionless | R | Airquality (in parts-per-billion) | airqualitysensor |
| alarm | Switch | R | Status of an alarm: `ON` = alarm was triggered; `OFF` = no alarm | alarmsensor |
@ -175,7 +175,7 @@ The `last_seen` channel is added when it is available AND the `lastSeenPolling`
Other devices support
| Channel Type ID | Item Type | Access Mode | Description | Thing types |
|-------------------|----------------------|:-----------:|---------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
| ----------------- | -------------------- | :---------: | ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| brightness | Dimmer | R/W | Brightness of the light | `dimmablelight`, `colortemperaturelight` |
| switch | Switch | R/W | State of a ON/OFF device | `onofflight` |
| color | Color | R/W | Color of an multi-color light | `colorlight`, `extendedcolorlight`, `lightgroup` |
@ -202,7 +202,7 @@ Their state represents the last command send to the group, not necessarily the a
The dimmer switch additionally supports trigger channels.
| Channel Type ID | Description | Thing types |
|-----------------|--------------------------|----------------------|
| --------------- | ------------------------ | -------------------- |
| buttonevent | Event for switch pressed | switch, colorcontrol |
| gestureevent | Event for gestures | switch |
@ -211,7 +211,7 @@ Both will be added during runtime if supported by the switch.
`gestureevent` can trigger one of the following events:
| Gesture | Event |
|----------------------------------|-------|
| -------------------------------- | ----- |
| GESTURE_NONE | 0 |
| GESTURE_SHAKE | 1 |
| GESTURE_DROP | 2 |
@ -229,13 +229,13 @@ Thing actions can be used to manage the network and its content.
The `deconz` thing supports a thing action to allow new devices to join the network:
| Action name | Input Value | Return Value | Description |
|------------------------|----------------------|--------------|----------------------------------------------------------------------------------------------------------------|
| ---------------------- | -------------------- | ------------ | -------------------------------------------------------------------------------------------------------------- |
| `permitJoin(duration)` | `duration` (Integer) | - | allows new devices to join for `duration` seconds. Allowed values are 1-240, default is 120 if no value given. |
The `lightgroup` thing supports thing actions for managing scenes:
| Action name | Input Value | Return Value | Description |
|---------------------|-----------------|--------------|-------------------------------------------------------------------------------------------|
| ------------------- | --------------- | ------------ | ----------------------------------------------------------------------------------------- |
| `createScene(name)` | `name` (String) | `newSceneId` | Creates a new scene with the name `name` and returns the new scene's id (if successfull). |
| `deleteScene(id)` | `id` (Integer) | - | Deletes the scene with the given id. |
| `storeScene(id)` | `id` (Integer) | - | Store the current group's state as scene with the given id. |
@ -305,20 +305,10 @@ then
end
```
# Thing Actions Example
## Thing Actions Example
:::: tabs
::: tab JavaScript
```javascript
deconzActions = actions.get("deconz", "deconz:lightgroup:00212E040ED9:5");
retVal = deconzActions.createScene("TestScene");
deconzActions.storeScene(retVal["newSceneId"]);
```
:::
::: tab DSL
```java
@ -329,6 +319,26 @@ end
:::
::: tab JavaScript
```javascript
deconzActions = actions.get("deconz", "deconz:lightgroup:00212E040ED9:5");
retVal = deconzActions.createScene("TestScene");
deconzActions.storeScene(retVal["newSceneId"]);
```
:::
::: tab JRuby
```ruby
deconz_thing = things["deconz:lightgroup:00212E040ED9:5"]
retval = deconz_thing.create_scene("TestScene")
deconz_thing.store_scene(retval["newSceneId"])
```
:::
::::
### Troubleshooting

View File

@ -191,18 +191,18 @@ The next `ON` command uses these values instead of the default (or configuration
## Channels
| Type-ID | Thing | Item | Description |
|-----------------|---------------------|----------------------|----------------------------------------------------|
|brightness |dimmer, tunablewhite |Switch, Dimmer | controls the brightness |
|color |color |Switch, Dimmer, Color | allows to set the color and brightness |
|color_temperature|tunablewhite |Number | allows to set the color temperature |
|brightness_r |color |Switch, Dimmer | controls the brightness of the red channel |
|brightness_g |color |Switch, Dimmer | controls the brightness of the green channel |
|brightness_b |color |Switch, Dimmer | controls the brightness of the blue channel |
|brightness_cw |tunablewhite |Switch, Dimmer | controls the brightness of the cool white channel |
|brightness_ww |tunablewhite |Switch, Dimmer | controls the brightness of the warm white channel |
|control |chaser |String | allows to change the chaser steps |
|switch |chaser |Switch | turns the chaser ON or OFF |
|mute |(all bridges) |Switch | mutes the DMX output of the bridge |
| ----------------- | -------------------- | --------------------- | ------------------------------------------------- |
| brightness | dimmer, tunablewhite | Switch, Dimmer | controls the brightness |
| color | color | Switch, Dimmer, Color | allows to set the color and brightness |
| color_temperature | tunablewhite | Number | allows to set the color temperature |
| brightness_r | color | Switch, Dimmer | controls the brightness of the red channel |
| brightness_g | color | Switch, Dimmer | controls the brightness of the green channel |
| brightness_b | color | Switch, Dimmer | controls the brightness of the blue channel |
| brightness_cw | tunablewhite | Switch, Dimmer | controls the brightness of the cool white channel |
| brightness_ww | tunablewhite | Switch, Dimmer | controls the brightness of the warm white channel |
| control | chaser | String | allows to change the chaser steps |
| switch | chaser | Switch | turns the chaser ON or OFF |
| mute | (all bridges) | Switch | mutes the DMX output of the bridge |
_Note:_ the string send to the control channel of chaser things has to be formatted like the `steps` configuration of the chaser thing.
If the new string is invalid, the old configuration will be used.
@ -216,19 +216,19 @@ There is a separate instance for each bridge, which can be retrieved e.g. throug
::: tab DSL
```php
```java
val dmxActions = getActions("dmx","dmx:sacn-bridge:mydmxbridge")
```
where the first parameter always has to be `dmx` and the second is the full Thing UID of the bridge that should be used.
Once this action instance is retrieved, you can invoke the `sendFade(String channels, String fade, Boolean resumeAfter)` method on it:
```php
```java
dmxActions.sendFade("1:41/3","10000:255,255,255:-1", false)
```
The parameters are the same as in a chaser thing configuration.
Defining more than one step in `fadeString` is supported, too.
Defining more than one step in `fadeString` is supported.
:::
@ -237,11 +237,22 @@ Defining more than one step in `fadeString` is supported, too.
The first parameter always has to be `dmx` and the second is the full Thing UID of the bridge that should be used.
```javascript
actions.get("dmx","dmx:sacn-bridge:mydmxbridge").sendFade("1:41/3","10000:255,255,255:-1", false);
actions.get("dmx","dmx:sacn-bridge:mydmxbridge").sendFade("1:41/3", "10000:255,255,255:-1", false);
```
The sendFade parameters are the same as in a chaser thing configuration.
Defining more than one step in `fadeString` is supported, too.
Defining more than one step in `fadeString` is supported.
:::
::: tab JRuby
```ruby
things["dmx:sacn-bridge:mydmxbridge"].send_fade("1:41/3", "10000:255,255,255:-1", false)
```
The `send_fade` parameters are the same as in a chaser thing configuration.
Defining more than one step in `fadeString` is supported.
:::

View File

@ -13,7 +13,7 @@ All channels are available for thing type `service`.
### `service` Thing Configuration
| Name | Type | Description | Default | Required |
|-----------------------|---------|----------------------------------------------------------------------|---------------|----------|
| --------------------- | ------- | -------------------------------------------------------------------- | ------------- | -------- |
| priceArea | text | Price area for spot prices (same as bidding zone) | | yes |
| currencyCode | text | Currency code in which to obtain spot prices | DKK | no |
| gridCompanyGLN | integer | Global Location Number of the Grid Company | | no |
@ -48,7 +48,7 @@ It will not impact channels, see [Electricity Tax](#electricity-tax) for further
### Channel Group `electricity`
| Channel | Type | Description |
|--------------------------|--------------------------|----------------------------------------------------------------------------------------|
| ------------------------ | ------------------------ | -------------------------------------------------------------------------------------- |
| spot-price | Number:EnergyPrice | Spot price in DKK or EUR per kWh |
| grid-tariff | Number:EnergyPrice | Grid tariff in DKK per kWh. Only available when `gridCompanyGLN` is configured |
| system-tariff | Number:EnergyPrice | System tariff in DKK per kWh |
@ -104,6 +104,35 @@ rules.when()
:::
::: tab JRuby
```ruby
rule "Calculate total price" do
channel "energidataservice:service:energidataservice:electricity#event", triggered: "DAY_AHEAD_AVAILABLE"
run do
# Persistence methods will call LocalDate#to_zoned_date_time which converts it
# to a ZonedDateTime in the default system zone, with 00:00 as its time portion
start = LocalDate.now
spot_prices = SpotPrice.all_states_between(start, start + 2.days)
next unless spot_prices # don't proceed if the persistence result is nil
time_series = TimeSeries.new # the default policy is replace
spot_prices.each do |spot_price|
total_price = spot_price.state +
GridTariff.persisted_state(spot_price.timestamp).state +
SystemTariff.persisted_state(spot_price.timestamp).state +
TransmissionGridTariff.persisted_state(spot_price.timestamp).state +
ElectricityTax.persisted_state(spot_price.timestamp).state
time_series.add(spot_price.timestamp, total_price)
end
TotalPrice.persist(time_series)
end
end
```
:::
::::
#### Currencies
@ -149,7 +178,7 @@ If your company is not in the list, or the filters are not working, they can be
To override filters, the channel `grid-tariff` has the following configuration parameters:
| Name | Type | Description | Default | Required | Advanced |
|-----------------|---------|----------------------------------------------------------------------------------------------------------------------------------|---------|----------|----------|
| --------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------- | ------- | -------- | -------- |
| chargeTypeCodes | text | Comma-separated list of charge type codes | | no | yes |
| notes | text | Comma-separated list of notes | | no | yes |
| start | text | Query start date parameter expressed as either YYYY-MM-DD or dynamically as one of `StartOfDay`, `StartOfMonth` or `StartOfYear` | | no | yes |
@ -172,13 +201,13 @@ See also [Datahub Price List](https://www.energidataservice.dk/tso-electricity/D
_N1:_
| Parameter | Value |
|-----------------|------------|
| --------------- | ------- |
| chargeTypeCodes | CD,CD R |
| notes | |
_Nord Energi Net:_
| Parameter | Value |
|-----------------|------------|
| --------------- | ---------- |
| chargeTypeCodes | TAC |
| notes | Nettarif C |
| start | StartOfDay |
@ -212,7 +241,7 @@ These channels will not be updated when the configured price area is not DK1 or
Advanced channel `event` can trigger the following events:
| Event | Description |
|----------------------|--------------------------------|
| ------------------- | ------------------------------ |
| DAY_AHEAD_AVAILABLE | Day-ahead prices are available |
## Thing Actions
@ -234,7 +263,7 @@ It comes in four variants with different input parameters.
The result is a `Map` with the following keys:
| Key | Type | Description |
|--------------------|--------------|-------------------------------------------------------|
| ------------------ | ------------ | ----------------------------------------------------- |
| CheapestStart | `Instant` | Start time of cheapest calculated period |
| LowestPrice | `BigDecimal` | The total price when starting at cheapest start |
| MostExpensiveStart | `Instant` | Start time of most expensive calculated period |
@ -243,7 +272,7 @@ The result is a `Map` with the following keys:
#### `calculateCheapestPeriod` from Duration
| Parameter | Type | Description |
|--------------------|-----------------------------|--------------------------------------------------------|
| ------------- | ---------- | --------------------------------------- |
| earliestStart | `Instant` | Earliest start time allowed |
| latestEnd | `Instant` | Latest end time allowed |
| duration | `Duration` | The duration to fit within the timeslot |
@ -261,7 +290,7 @@ var Map<String, Object> result = actions.calculateCheapestPeriod(now.toInstant()
#### `calculateCheapestPeriod` from Duration and Power
| Parameter | Type | Description |
|--------------------|-----------------------------|--------------------------------------------------------|
| ------------- | --------------------- | --------------------------------------- |
| earliestStart | `Instant` | Earliest start time allowed |
| latestEnd | `Instant` | Latest end time allowed |
| duration | `Duration` | The duration to fit within the timeslot |
@ -279,7 +308,7 @@ var Map<String, Object> result = actions.calculateCheapestPeriod(now.toInstant()
#### `calculateCheapestPeriod` from Power Phases
| Parameter | Type | Description |
|--------------------|-----------------------------|--------------------------------------------------------|
| -------------- | --------------------------- | ------------------------------------------------------ |
| earliestStart | `Instant` | Earliest start time allowed |
| latestEnd | `Instant` | Latest end time allowed |
| durationPhases | `List<Duration>` | List of durations for the phases |
@ -324,7 +353,7 @@ This is to ensure that the full program will finish before the provided `latestE
#### `calculateCheapestPeriod` from Energy per Phase
| Parameter | Type | Description |
|--------------------|-----------------------------|--------------------------------------------------------|
| ------------------ | ---------------------- | ------------------------------------- |
| earliestStart | `Instant` | Earliest start time allowed |
| latestEnd | `Instant` | Latest end time allowed |
| totalDuration | `Duration` | The total duration of all phases |
@ -356,7 +385,7 @@ var Map<String, Object> result = actions.calculateCheapestPeriod(now.toInstant()
### `calculatePrice`
| Parameter | Type | Description |
|--------------------|-----------------------------|--------------------------------------------------------|
| --------- | --------------------- | ------------------------ |
| start | `Instant` | Start time |
| end | `Instant` | End time |
| power | `QuantityType<Power>` | Linear power consumption |
@ -375,7 +404,7 @@ var price = actions.calculatePrice(now.toInstant(), now.plusHours(4).toInstant,
### `getPrices`
| Parameter | Type | Description |
|--------------------|-----------------------------|--------------------------------------------------------|
| --------------- | -------- | --------------------------------------------------- |
| priceComponents | `String` | Comma-separated list of price components to include |
**Result:** `Map<Instant, BigDecimal>`
@ -384,7 +413,7 @@ The parameter `priceComponents` is a case-insensitive comma-separated list of pr
These components can be requested:
| Price component | Description |
|------------------------|--------------------------|
| ---------------------- | ------------------------ |
| SpotPrice | Spot price |
| GridTariff | Grid tariff |
| SystemTariff | System tariff |
@ -448,7 +477,7 @@ In case persistence is only needed for charts and/or accessing prices from rules
::: tab DSL
```javascript
```java
import java.time.Duration
import java.util.ArrayList
import java.util.Map
@ -579,6 +608,69 @@ var result = edsActions.calculateCheapestPeriod(time.Instant.now(), time.Instant
:::
::: tab JRuby
```ruby
eds = things["energidataservice:service:energidataservice"]
price_map = eds.get_prices
hour_start = Instant.now.truncated_to(ChronoUnit::HOURS)
logger.info "Current total price excl. VAT: #{price_map[hour_start]}"
price_map = eds.get_prices("SpotPrice,GridTariff")
logger.info "Current spot price + grid tariff excl. VAT: #{price_map[hour_start]}"
price = eds.calculate_price(Instant.now, 1.hour.from_now.to_instant, 150 | "W")
logger.info "Total price for using 150 W for the next hour: #{price}" if price
duration_phases = [
37.minutes,
8.minutes,
4.minutes,
2.minutes,
4.minutes,
36.minutes,
41.minutes,
104.minutes
]
consumption_phases = [
162.162 | "W",
750 | "W",
1500 | "W",
3000 | "W",
1500 | "W",
166.666 | "W",
146.341 | "W",
0 | "W"
],
result = eds.calculate_cheapest_period(ZonedDateTime.now.to_instant,
24.hours.from_now.to_instant,
duration_phases,
consumption_phases)
logger.info "Cheapest start #{result["CheapestStart"]}"
logger.info "Lowest price #{result["LowestPrice"]}"
logger.info "Highest price #{result["HighestPrice"]}"
logger.info "Most expensive start #{result["MostExpensiveStart"]}"
# This is a simpler version taking advantage of the fact that each interval here represents 0.1 kWh of consumed energy.
# In this example we have to provide the total duration to make sure we fit the latest end. This is because there is no
# registered consumption in the last phase.
# Here we are using an alternative way of constructing an array of Durations.
# The `#minutes` method on an Integer object returns a corresponding Duration object.
duration_phases = [37, 8, 4, 2, 4, 36, 41].map { |i| i.minutes }
result = eds.calculate_cheapest_period(ZonedDateTime.now.to_instant,
24.hours.from_now.to_instant,
236.minutes,
duration_phases,
0.1 | "kWh")
```
:::
::::
### Persistence Rule Example
@ -587,7 +679,7 @@ var result = edsActions.calculateCheapestPeriod(time.Instant.now(), time.Instant
::: tab DSL
```javascript
```java
var hourStart = now.plusHours(2).truncatedTo(ChronoUnit.HOURS)
var price = SpotPrice.historicState(hourStart).state
logInfo("Spot price two hours from now", price.toString)
@ -605,6 +697,16 @@ console.log("Spot price two hours from now: " + price);
:::
::: tab JRuby
```ruby
hour_start = 2.hours.from_now.truncated_to(ChronoUnit::HOURS)
price = SpotPrice.persisted_state(hour_start)
logger.info "Spot price two hours from now: #{price}"
```
:::
::::
### Trigger Channel Example
@ -613,7 +715,7 @@ console.log("Spot price two hours from now: " + price);
::: tab DSL
```javascript
```java
rule "Day-ahead event"
when
Channel 'energidataservice:service:energidataservice:electricity#event' triggered 'DAY_AHEAD_AVAILABLE'
@ -638,4 +740,17 @@ rules.when()
:::
::: tab JRuby
```ruby
rule "Day-ahead event" do
channel "energidataservice:service:energidataservice:electricity#event", triggered: "DAY_AHEAD_AVAILABLE"
run do
logger.info "Day-ahead prices for the next day are now available"
end
end
```
:::
::::

View File

@ -694,9 +694,17 @@ In scripts:
:::: tabs
::: tab DSL
```java
Var_1.sendCommand(REFRESH)
```
:::
::: tab JavaScript
``` javascript
```javascript
import org.openhab.core.types.RefreshType
...
Var_1.sendCommand(RefreshType.REFRESH)
@ -704,10 +712,10 @@ Var_1.sendCommand(RefreshType.REFRESH)
:::
::: tab DSL
::: tab JRuby
``` php
Var_1.sendCommand(REFRESH)
```ruby
Var_1.refresh
```
:::
@ -727,7 +735,7 @@ The problem can be solved by increasing the `bufferSize` value in the bridge con
openHAB and the CCU are using different values for the same state of a rollershutter.
Examples: HmIP-BROLL, HmIP-FROLL, HmIP-BBL, HmIP-FBL and HmIP-DRBLI4
| | Open | Closed |
|---------|------|--------|
| ------- | ---- | ------ |
| openHAB | 0% | 100% |
| CCU | 100% | 0% |

View File

@ -159,6 +159,7 @@ val List<String> attachmentUrlList = newArrayList(
val mailActions = getActions("mail","mail:smtp:sampleserver")
mailActions.sendHtmlMailWithAttachments("mail@example.com", "Test subject", "<h1>Header</h1>This is the mail content.", attachmentUrlList)
```
:::
::: tab JavaScript
@ -167,7 +168,6 @@ mailActions.sendHtmlMailWithAttachments("mail@example.com", "Test subject", "<h1
val mailActions = actions.get("mail","mail:smtp:samplesmtp")
val success = mailActions.sendMail("mail@example.com", "Test subject", "This is the mail content.")
success = mailActions.sendMail("mail1@example.com, mail2@example.com", "Test subject", "This is the mail content sent to multiple recipients.")
```
```javascript
@ -182,7 +182,26 @@ mailActions.sendHtmlMailWithAttachments("mail@example.com", "Test subject", "<h1
:::
::: tab JRuby
```ruby
mail = things["mail:smtp:samplesmtp"]
success = mail.send_mail("mail@example.com", "Test subject", "This is the mail content.")
success = mail.send_mail("mail1@example.com, mail2@example.com", "Test subject", "This is the mail content sent to multiple recipients.")
```
```ruby
attachment_urls = [
"http://some.web/site/snap.jpg&param=value",
"file:///tmp/201601011031.jpg"
]
things["mail:smtp:sampleserver"].send_html_mail_with_attachments("mail@example.com", "Test subject", "<h1>Header</h1>This is the mail content.", attachment_urls)
```
:::
::::
## Mail Headers
The binding allows one to add custom e-mail headers to messages that it sends.
@ -194,7 +213,6 @@ See the example below.
::: tab DSL
```java
rule "Send Mail with a 'Reference' header; for threaded view in e-mail client"
when
@ -205,6 +223,7 @@ then
mailActions.sendMail("mail@example.com", "Test subject", "Test message text")
end
```
:::
::: tab JavaScript
@ -217,5 +236,15 @@ mailActions.sendMail("mail@example.com", "Test subject", "Test message text")
:::
::: tab JRuby
```ruby
mail = things["mail:smtp:sampleserver"]
mail.add_header("Reference", "<unique-thread-identifier>")
mail.send_mail("mail@example.com", "Test subject", "Test message text")
```
:::
::::
Note: in the case of the "Reference" header, the `<unique-thread-identifier>` has to be an ASCII string enclosed in angle brackets.

View File

@ -9,7 +9,7 @@ It connects to many other devices through serial ports or wired contacts and exp
The OmniPro/Lumina controller acts as a "bridge" for accessing other connected devices.
| Omni type | Hardware Type | Things |
|:---------------------------|:-------------------------------------------------|:----------------------------------|
| :------------------------- | :----------------------------------------------- | :-------------------------------- |
| Controller | Omni (Pro II, IIe, LTe), Lumina | `controller` (omni, lumina) |
| Lights | Built-in, UPB, HLC | `unit`, `dimmable`, `upb`, `room` |
| Thermostats | Omnistat, Omnistat2 | `thermostat` |
@ -56,7 +56,7 @@ The devices are identified by the device number that the OmniLink bridge assigns
The devices support some of the following channels:
| Channel Type ID | Item Type | Description | Thing types supporting this channel |
|-----------------------------|----------------------|----------------------------------------------------------------------------------------------|-----------------------------------------------------|
| --------------------------- | -------------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| `activate_keypad_emergency` | Number | Activate a burglary, fire, or auxiliary keypad emergency alarm on Omni based models. | `area` |
| `alarm_burglary` | Switch | Indicates if a burglary alarm is active. | `area` |
| `alarm_fire` | Switch | Indicates if a fire alarm is active. | `area` |
@ -131,7 +131,7 @@ The devices support some of the following channels:
The devices support some of the following trigger channels:
| Channel Type ID | Description | Thing types supporting this channel |
|-------------------------------|--------------------------------------------------------------------------------------|-------------------------------------|
| ---------------------------- | --------------------------------------------------------------------- | ----------------------------------- |
| `all_on_off_event` | Event sent when an all on/off event occurs. | `area`, `lumina_area` |
| `phone_line_event` | Event sent when the phone line changes state. | `controller` |
| `ac_power_event` | Event sent when AC trouble conditions are detected. | `controller` |
@ -151,18 +151,28 @@ There is a separate instance for each contoller, which can be retrieved through:
:::: tabs
::: tab DSL
```java
val omnilinkActions = getActions("omnilink", "omnilink:controller:home")
```
:::
::: tab JavaScript
``` javascript
```javascript
var omnilinkActions = actions.get("omnilink", "omnilink:controller:home");
```
:::
::: tab DSL
::: tab JRuby
``` php
val omnilinkActions = getActions("omnilink", "omnilink:controller:home")
In JRuby, Action methods are available directly on the Thing object.
```ruby
omni_link = things["omnilink:controller:home"]
```
:::
@ -174,18 +184,26 @@ Once this action instance is retrieved, you can invoke the `synchronizeControlle
:::: tabs
::: tab DSL
```java
omnilinkActions.synchronizeControllerTime("America/Denver")
```
:::
::: tab JavaScript
``` javascript
```javascript
omnilinkActions.synchronizeControllerTime("America/Denver");
```
:::
::: tab DSL
::: tab JRuby
``` php
omnilinkActions.synchronizeControllerTime("America/Denver")
```ruby
omni_link.synchronize_controller_time("America/Denver")
```
:::

View File

@ -56,7 +56,7 @@ The following Things and OpenWebNet `WHOs` are supported:
### For MyHOME Radio - Zigbee
| Category | WHO | Thing Type IDs | Description | Status |
| -------------------- | :----: | :---------------------------------------------------: | --------------------------------------------------------------------- | ------------------------------------ |
| ------------------ | :---: | :---------------------------------------------------: | ---------------------------------------------------------------- | ------------------------------------ |
| Gateway Management | `13` | `zb_gateway` | MyHOME Radio - Zigbee USB Gateway (models: BTI-3578 / LG 088328) | Tested: BTI-3578 and LG 088328 |
| Lighting | `1` | `zb_dimmer`, `zb_on_off_switch`, `zb_on_off_switch2u` | Radio Zigbee dimmers, switches and 2-unit switches | Tested: BTI-4591, BTI-3584, BTI-4585 |
| Automation | `2` | `zb_automation` | Radio Zigbee roller shutters | |
@ -245,7 +245,7 @@ For a `bus_light_group` Thing to be updated properly, at least one light Thing b
### Alarm channels
| Channel Type ID (channel ID) | Applies to Thing Type IDs | Item Type | Description | Read/Write |
|------------------------------|----------------------------------------|-------------|--------------------------------------------------------------------------------|:-----------:|
| ---------------------------- | ------------------------------------ | --------- | ------------------------------------------------------------------------------ | :--------: |
| `state` | `bus_alarm_system`, `bus_alarm_zone` | Switch | Alarm system or zone is active (`ON`) or inactive (`OFF`) | R |
| `network` | `bus_alarm_system` | Switch | Alarm system network state (`ON` = network ok, `OFF` = no network) | R |
| `battery` | `bus_alarm_system` | String | Alarm system battery state (`OK`, `FAULT`, `UNLOADED`) | R |
@ -258,11 +258,11 @@ For a `bus_light_group` Thing to be updated properly, at least one light Thing b
**NOTE** Channels marked in the table with `Advanced = Y` can be shown on the UI from Thing configuration > Channels tab > check `Show advanced`.
| Channel Type ID (channel ID) | Applies to Thing Type IDs | Item Type | Description | Read/Write | Advanced |
| ---------------------------- | -------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | :--------: | :------: |
| ---------------------------- | -------------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------: | :------: |
| `temperature` | `bus_thermo_zone`, `bus_thermo_sensor` | Number:Temperature | Currently sensed temperature for zone or sensor | R | N |
| `setpointTemperature` | `bus_thermo_zone`, `bus_thermo_cu` | Number:Temperature | The zone or Central Unit manual setpoint temperature | R/W | N |
| `targetTemperature` | `bus_thermo_zone` | Number:Temperature | The current zone target temperature according to `mode`, `setpointTemperature` and `localOffset` | R | Y
|`function` | `bus_thermo_zone`, `bus_thermo_cu` | String | The zone set thermo function (`COOLING`, `HEATING`, `GENERIC`) or the Central Unit thermo function (`COOLING`, `HEATING`) | R/W | N |
| `targetTemperature` | `bus_thermo_zone` | Number:Temperature | The current zone target temperature according to `mode`, `setpointTemperature` and `localOffset` | R | Y |
| `function` | `bus_thermo_zone`, `bus_thermo_cu` | String | The zone set thermo function (`COOLING`, `HEATING`, `GENERIC`) or the Central Unit thermo function (`COOLING`, `HEATING`) | R/W | N |
| `mode` | `bus_thermo_zone`, `bus_thermo_cu` | String | The zone set mode (`AUTO`, `MANUAL`, `OFF`, `PROTECTION`) or the Central Unit set mode (`WEEKLY`, `MANUAL`, `SCENARIO`, `HOLIDAY`, `VACATION`, `OFF`, `PROTECTION`) | R/W | N |
| `speedFanCoil` | `bus_thermo_zone` | String | The zone fancoil speed: `AUTO`, `SPEED_1`, `SPEED_2`, `SPEED_3` | R/W | N |
| `actuators` | `bus_thermo_zone` | String | The zone actuator(s) status: `OFF`, `ON`, `OPENED`, `CLOSED` , `STOP`, `OFF_FAN_COIL`, `ON_SPEED_1`, `ON_SPEED_2`, `ON_SPEED_3`, `OFF_SPEED_1`, `OFF_SPEED_2`, `OFF_SPEED_3` | R | Y |
@ -380,11 +380,25 @@ logInfo("EventLog", "Response: " + result.responseMessages);
:::
::: tab JRuby
```ruby
openwebnet = things["openwebnet:bus_gateway:mybridge"]
result = openwebnet.send_message("*22*22#4#9*2#1##")
logger.info "Result: #{result}"
result = openwebnet.send_message_with_response("*22*22#4#9*2#1##")
logger.info "Success: #{result["success"]}"
logger.info "Response: #{result["responseMessages"]}"
```
:::
::::
## Full Example
### openwebnet.things:
### openwebnet.things
MyHOME BUS/SCS gateway and Things configuration:
@ -426,7 +440,7 @@ Bridge openwebnet:zb_gateway:myZBgateway [ serialPort="COM3" ] {
}
```
### openwebnet.items:
### openwebnet.items
Example items linked to MyHOME - BUS/SCS devices:

View File

@ -19,7 +19,7 @@ Add Danish VAT to price:
::: tab DSL
```javascript
```java
var Number price = 499
logInfo("Price", "Price incl. VAT: " + transform("VAT", "DK", price.toString))
```
@ -35,6 +35,18 @@ console.log("Price incl. VAT: " + actions.Transformation.transform("VAT", "DK",
:::
::: tab JRuby
```ruby
price = 499
# The currency name can be either a Symbol or a String
# The input value doesn't need to be converted to string, however, the return value is a String
price_incl_vat = transform(:vat, :DK, price)
logger.info "Price incl. VAT: #{price_incl_vat}"
```
:::
::::
## Usage as a Profile