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,14 +175,14 @@ 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` |
| ----------------- | -------------------- | :---------: | ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| 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` |
| color_temperature | Number | R/W | Color temperature in Kelvin. The value range is determined by each individual light | `colortemperaturelight`, `extendedcolorlight`, `lightgroup` |
| effect | String | R/W | Effect selection. Allowed commands are set dynamically | `colorlight` |
| effectSpeed | Number | W | Effect Speed | `colorlight` |
| lock | Switch | R/W | Lock (ON) or unlock (OFF) the doorlock | `doorlock` |
| lock | Switch | R/W | Lock (ON) or unlock (OFF) the doorlock | `doorlock` |
| ontime | Number:Time | W | Timespan for which the light is turned on | all lights |
| position | Rollershutter | R/W | Position of the blind | `windowcovering` |
| heatsetpoint | Number:Temperature | R/W | Target Temperature in °C | `thermostat` |
@ -192,7 +192,7 @@ Other devices support
| alert | String | W | Turn alerts on. Allowed commands are `none`, `select` (short blinking), `lselect` (long blinking) | `warningdevice`, `lightgroup`, `dimmablelight`, `colorlight`, `extendedcolorlight`, `colortemperaturelight` |
| all_on | Switch | R | All lights in group are on | `lightgroup` |
| any_on | Switch | R | Any light in group is on | `lightgroup` |
| scene | String | W | Recall a scene. Allowed commands are set dynamically | `lightgroup` |
| scene | String | W | Recall a scene. Allowed commands are set dynamically | `lightgroup` |
**NOTE:** For groups `color` and `color_temperature` are used for sending commands to the group.
Their state represents the last command send to the group, not necessarily the actual state of the group.
@ -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

@ -190,19 +190,19 @@ 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 |
| 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 |
_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,11 +48,11 @@ 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 |
| transmission-grid-tariff | Number:EnergyPrice | Transmission grid tariff in DKK per kWh |
| transmission-grid-tariff | Number:EnergyPrice | Transmission grid tariff in DKK per kWh |
| electricity-tax | Number:EnergyPrice | Electricity tax in DKK per kWh |
| reduced-electricity-tax | Number:EnergyPrice | Reduced electricity tax in DKK per kWh. For electric heating customers only |
| co2-emission-prognosis | Number:EmissionIntensity | Estimated prognosis for CO₂ emission following the day-ahead market in g/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
@ -148,12 +177,12 @@ The tariffs are downloaded using pre-configured filters for the different [Grid
If your company is not in the list, or the filters are not working, they can be manually overridden.
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 |
| offset | text | Query start date offset expressed as an ISO 8601 duration | | no | yes |
| 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 |
| offset | text | Query start date offset expressed as an ISO 8601 duration | | no | yes |
The parameters `chargeTypeCodes` and `notes` are logically combined with "AND", so if only one parameter is needed for the filter, only provide this parameter and leave the other one empty.
Using any of these parameters will override the pre-configured filter entirely.
@ -171,14 +200,14 @@ See also [Datahub Price List](https://www.energidataservice.dk/tso-electricity/D
##### Filter Examples
_N1:_
| Parameter | Value |
|-----------------|------------|
| chargeTypeCodes | CD,CD R |
| notes | |
| Parameter | Value |
| --------------- | ------- |
| chargeTypeCodes | CD,CD R |
| notes | |
_Nord Energi Net:_
| Parameter | Value |
|-----------------|------------|
| --------------- | ---------- |
| chargeTypeCodes | TAC |
| notes | Nettarif C |
| start | StartOfDay |
@ -211,9 +240,9 @@ 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 |
| 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 |
@ -242,11 +271,11 @@ 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 |
| Parameter | Type | Description |
| ------------- | ---------- | --------------------------------------- |
| earliestStart | `Instant` | Earliest start time allowed |
| latestEnd | `Instant` | Latest end time allowed |
| duration | `Duration` | The duration to fit within the timeslot |
This is a convenience method that can be used when the power consumption is not known.
The calculation will assume linear consumption and will find the best timeslot based on that.
@ -260,12 +289,12 @@ 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 |
| power | `QuantityType<Power>` | Linear power consumption |
| Parameter | Type | Description |
| ------------- | --------------------- | --------------------------------------- |
| earliestStart | `Instant` | Earliest start time allowed |
| latestEnd | `Instant` | Latest end time allowed |
| duration | `Duration` | The duration to fit within the timeslot |
| power | `QuantityType<Power>` | Linear power consumption |
This action is identical to the variant above, but with a known linear power consumption.
As a result the price is also included in the result.
@ -278,12 +307,12 @@ 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 |
| powerPhases | `List<QuantityType<Power>>` | List of power consumption for each corresponding phase |
| Parameter | Type | Description |
| -------------- | --------------------------- | ------------------------------------------------------ |
| earliestStart | `Instant` | Earliest start time allowed |
| latestEnd | `Instant` | Latest end time allowed |
| durationPhases | `List<Duration>` | List of durations for the phases |
| powerPhases | `List<QuantityType<Power>>` | List of power consumption for each corresponding phase |
This variant is similar to the one above, but is based on a supplied timetable.
@ -323,13 +352,13 @@ 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 |
| durationPhases | `List<Duration>` | List of durations for the phases |
| energyUsedPerPhase | `QuantityType<Energy>` | Fixed amount of energy used 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 |
| durationPhases | `List<Duration>` | List of durations for the phases |
| energyUsedPerPhase | `QuantityType<Energy>` | Fixed amount of energy used per phase |
This variant will assign the provided amount of energy into each phase.
The use case for this variant is a simplification of the previous variant.
@ -355,11 +384,11 @@ 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 |
| Parameter | Type | Description |
| --------- | --------------------- | ------------------------ |
| start | `Instant` | Start time |
| end | `Instant` | End time |
| power | `QuantityType<Power>` | Linear power consumption |
**Result:** Price as `BigDecimal`.
@ -374,9 +403,9 @@ var price = actions.calculatePrice(now.toInstant(), now.plusHours(4).toInstant,
### `getPrices`
| Parameter | Type | Description |
|--------------------|-----------------------------|--------------------------------------------------------|
| priceComponents | `String` | Comma-separated list of price components to include |
| 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` |
@ -130,19 +130,19 @@ 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` |
| `battery_event` | Event sent when battery trouble conditions are detected. | `controller` |
| `dcm_event` | Event sent when digital communicator trouble conditions are detected. | `controller` |
| `energy_cost_event` | Event sent when the cost of energy changes. | `controller` |
| `camera_trigger_event` | Event sent when a camera trigger is detected. | `controller` |
| `upb_link_activated_event` | Event sent when a UPB link is activated. | `controller` |
| `upb_link_deactivated_event` | Event sent when a UPB link is deactivated. | `controller` |
| `activated_event` | Event sent when a button is activated. | `button` |
| `switch_press_event` | Event sent when an ALC, UPB, Radio RA, or Starlite switch is pressed. | `dimmable`, `upb` |
| 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` |
| `battery_event` | Event sent when battery trouble conditions are detected. | `controller` |
| `dcm_event` | Event sent when digital communicator trouble conditions are detected. | `controller` |
| `energy_cost_event` | Event sent when the cost of energy changes. | `controller` |
| `camera_trigger_event` | Event sent when a camera trigger is detected. | `controller` |
| `upb_link_activated_event` | Event sent when a UPB link is activated. | `controller` |
| `upb_link_deactivated_event` | Event sent when a UPB link is deactivated. | `controller` |
| `activated_event` | Event sent when a button is activated. | `button` |
| `switch_press_event` | Event sent when an ALC, UPB, Radio RA, or Starlite switch is pressed. | `dimmable`, `upb` |
## Rule Actions
@ -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

@ -41,25 +41,25 @@ The following Things and OpenWebNet `WHOs` are supported:
### For MyHOME - BUS/SCS
| Category | WHO | Thing Type IDs | Description | Status |
| Category | WHO | Thing Type IDs | Description | Status |
| ----------------------------- | :-------------: | :--------------------------------------------------------------------------------: | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Gateway Management | `13` | `bus_gateway` | Any IP gateway supporting OpenWebNet protocol should work | Successfully tested: F452, F453, F453AV,F454, F455, MyHOMEServer1, MyHOME_Screen10, MyHOME_Screen3,5, MH201, MH202, MH200N. Some connection stability issues/gateway resets reported with MH202 |
| Lighting | `1` | `bus_on_off_switch`, `bus_dimmer`, `bus_light_group` | BUS switches and dimmers and groups of them | Successfully tested: F411/2, F411/4, F411U2, F422, F429. Some discovery issues reported with F429 (DALI Dimmers) |
| Automation | `2` | `bus_automation` | BUS roller shutters, with position feedback and auto-calibration | Successfully tested: LN4672M2 |
| Temperature Control | `4` | `bus_thermo_zone`, `bus_thermo_sensor`, `bus_thermo_cu` | Thermo zones management and temperature sensors (probes) | Successfully tested: Thermostats H/LN4691, HS4692, KG4691; sensors (probes): L/N/NT4577 + 3455; Central Units 4-zones (models L/N/NT/HD/HC/HS4695) and 99-zones (model 3550). See [Channels - Thermo](#configuring-thermo) for more details |
| Alarm | `5` | `bus_alarm_system`, `bus_alarm_zone` | BUS Alarm system and zones | Successfully tested: Burglar-alarm Unit 3486 |
| Auxiliary (AUX) | `9` | `bus_aux` | AUX commands | Successfully tested: AUX configured for Burglar-alarm Unit 3486. **Only sending AUX commands is supported** |
| Gateway Management | `13` | `bus_gateway` | Any IP gateway supporting OpenWebNet protocol should work | Successfully tested: F452, F453, F453AV,F454, F455, MyHOMEServer1, MyHOME_Screen10, MyHOME_Screen3,5, MH201, MH202, MH200N. Some connection stability issues/gateway resets reported with MH202 |
| Lighting | `1` | `bus_on_off_switch`, `bus_dimmer`, `bus_light_group` | BUS switches and dimmers and groups of them | Successfully tested: F411/2, F411/4, F411U2, F422, F429. Some discovery issues reported with F429 (DALI Dimmers) |
| Automation | `2` | `bus_automation` | BUS roller shutters, with position feedback and auto-calibration | Successfully tested: LN4672M2 |
| Temperature Control | `4` | `bus_thermo_zone`, `bus_thermo_sensor`, `bus_thermo_cu` | Thermo zones management and temperature sensors (probes) | Successfully tested: Thermostats H/LN4691, HS4692, KG4691; sensors (probes): L/N/NT4577 + 3455; Central Units 4-zones (models L/N/NT/HD/HC/HS4695) and 99-zones (model 3550). See [Channels - Thermo](#configuring-thermo) for more details |
| Alarm | `5` | `bus_alarm_system`, `bus_alarm_zone` | BUS Alarm system and zones | Successfully tested: Burglar-alarm Unit 3486 |
| Auxiliary (AUX) | `9` | `bus_aux` | AUX commands | Successfully tested: AUX configured for Burglar-alarm Unit 3486. **Only sending AUX commands is supported** |
| Basic, CEN & CEN+ Scenarios | `0`, `15`, `25` | `bus_scenario_control`, `bus_cen_scenario_control`, `bus_cenplus_scenario_control` | Basic and CEN/CEN+ Scenarios events and virtual activation | Successfully tested: CEN/CEN+ scenario control: HC/HD/HS/L/N/NT4680 and basic scenario modules F420/IR3456 + L4680 (WHO=0) |
| Dry Contact and IR Interfaces | `25` | `bus_dry_contact_ir` | Dry Contacts and IR Interfaces | Successfully tested: contact interfaces F428 and 3477; IR sensors: HC/HD/HS/L/N/NT4610 |
| Energy Management | `18` | `bus_energy_meter` | Energy Management | Successfully tested: F520, F521. Partially tested: F522, F523 |
| Dry Contact and IR Interfaces | `25` | `bus_dry_contact_ir` | Dry Contacts and IR Interfaces | Successfully tested: contact interfaces F428 and 3477; IR sensors: HC/HD/HS/L/N/NT4610 |
| Energy Management | `18` | `bus_energy_meter` | Energy Management | Successfully tested: F520, F521. Partially tested: F522, F523 |
### 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 | |
| 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 | |
## Discovery
@ -231,55 +231,55 @@ For a `bus_light_group` Thing to be updated properly, at least one light Thing b
| Channel Type ID (channel ID) | Applies to Thing Type IDs | Item Type | Description | Read/Write |
| --------------------------------------- | -------------------------------------------------------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------: |
| `switch` or `switch_01`/`02` for Zigbee | `bus_on_off_switch`, `bus_light_group`, `zb_on_off_switch`, `zb_on_off_switch2u` | Switch | To switch the device (or group) `ON` and `OFF` | R/W |
| `brightness` | `bus_dimmer`, `zb_dimmer` | Dimmer | To adjust the brightness value (Percent, `ON`, `OFF`) | R/W |
| `shutter` | `bus_automation` | Rollershutter | To activate roller shutters (`UP`, `DOWN`, `STOP`, Percent - [see Shutter position](#shutter-position)) | R/W |
| `switch` or `switch_01`/`02` for Zigbee | `bus_on_off_switch`, `bus_light_group`, `zb_on_off_switch`, `zb_on_off_switch2u` | Switch | To switch the device (or group) `ON` and `OFF` | R/W |
| `brightness` | `bus_dimmer`, `zb_dimmer` | Dimmer | To adjust the brightness value (Percent, `ON`, `OFF`) | R/W |
| `shutter` | `bus_automation` | Rollershutter | To activate roller shutters (`UP`, `DOWN`, `STOP`, Percent - [see Shutter position](#shutter-position)) | R/W |
| `scenario` | `bus_scenario_control` | String | Trigger channel for Basic scenario events [see possible values](#scenario-channels) | R (TRIGGER) |
| `button#X` | `bus_cen_scenario_control`, `bus_cenplus_scenario_control` | String | Trigger channel for CEN/CEN+ scenario events [see possible values](#scenario-channels) | R (TRIGGER) |
| `sensor` | `bus_dry_contact_ir` | Switch | If a Dry Contact Interface is `ON`/`OFF`, or if an IR Sensor is detecting movement (`ON`), or not (`OFF`) | R |
| `power` | `bus_energy_meter` | Number:Power | The current active power usage from Energy Meter | R |
| `energyToday` | `bus_energy_meter` | Number:Energy | Current day energy | R |
| `energyThisMonth` | `bus_energy_meter` | Number:Energy | Current month energy | R |
| `aux` | `bus_aux` | String | Possible commands: `ON`, `OFF`, `TOGGLE`, `STOP`, `UP`, `DOWN`, `ENABLED`, `DISABLED`, `RESET_GEN`, `RESET_BI`, `RESET_TRI`. Only `ON` and `OFF` are supported for now | R/W |
| `sensor` | `bus_dry_contact_ir` | Switch | If a Dry Contact Interface is `ON`/`OFF`, or if an IR Sensor is detecting movement (`ON`), or not (`OFF`) | R |
| `power` | `bus_energy_meter` | Number:Power | The current active power usage from Energy Meter | R |
| `energyToday` | `bus_energy_meter` | Number:Energy | Current day energy | R |
| `energyThisMonth` | `bus_energy_meter` | Number:Energy | Current month energy | R |
| `aux` | `bus_aux` | String | Possible commands: `ON`, `OFF`, `TOGGLE`, `STOP`, `UP`, `DOWN`, `ENABLED`, `DISABLED`, `RESET_GEN`, `RESET_BI`, `RESET_TRI`. Only `ON` and `OFF` are supported for now | R/W |
### 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 |
| `armed` | `bus_alarm_system` | Switch | Alarm system is armed (`ON`) or disarmed (`OFF`) | R |
| `alarm` | `bus_alarm_zone` | String | Current alarm for the zone (`SILENT`, `INTRUSION`, `TAMPERING`, `ANTI_PANIC`) | R |
| `timestamp` | `bus_alarm_zone` | DateTime | Current date and time of the zone's alarm event (YY/MM/DD hh:mm:ss) | R |
| 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 |
| `armed` | `bus_alarm_system` | Switch | Alarm system is armed (`ON`) or disarmed (`OFF`) | R |
| `alarm` | `bus_alarm_zone` | String | Current alarm for the zone (`SILENT`, `INTRUSION`, `TAMPERING`, `ANTI_PANIC`) | R |
| `timestamp` | `bus_alarm_zone` | DateTime | Current date and time of the zone's alarm event (YY/MM/DD hh:mm:ss) | R |
### Thermo channels
**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 |
| `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 |
| `heatingValves` | `bus_thermo_zone` | String | The zone heating valve(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 |
| `conditioningValves` | `bus_thermo_zone` | String | The zone conditioning valve(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 |
| `heating` | `bus_thermo_zone` | Switch | `ON` if the zone heating valve is currently active (meaning heating is On) | R | Y |
| `cooling` | `bus_thermo_zone` | Switch | `ON` if the zone conditioning valve is currently active (meaning conditioning is On) | R | Y |
| `localOffset` | `bus_thermo_zone` | String | The zone local offset status: `OFF`, `PROTECTION`, `MINUS_3`, `MINUS_2` , `MINUS_1`, `NORMAL`, `PLUS_1`, `PLUS_2`, `PLUS_3`, as set on the room thermostat physical knob | R | Y |
| `remoteControl` | `bus_thermo_cu` | String | The Central Unit Remote Control status: `ENABLED`, `DISABLED` | R | Y |
| `batteryStatus` | `bus_thermo_cu` | String | The Central Unit Battery status: `OK`, `KO` | R | Y |
| `weeklyProgram` | `bus_thermo_cu` | Number | The weekly program number (`1`, `2`, `3`) when Central Unit mode is `WEEKLY` | R/W | N |
| `scenarioProgram` | `bus_thermo_cu` | Number | The scenario program number (`1`, `2`, ... , `16`) when Central Unit mode is `SCENARIO` | R/W | N |
| `vacationDays` | `bus_thermo_cu` | Number | Number of days `1-255` the Central Unit will be set to Anti-freeze / Heat Protection temperature before returning to mode `WEEKLY` | R/W | N |
| `failureDiscovered` | `bus_thermo_cu` | Switch | Indicates if a Failure was discovered by the Central Unit (`ON`), or not (`OFF`) | R | Y |
| `atLeastOneProbeOff` | `bus_thermo_cu` | Switch | Indicates if at least one probe is in OFF mode (`ON`) or not (`OFF`) | R | Y |
| `atLeastOneProbeProtection` | `bus_thermo_cu` | Switch | Indicates if at least one probe is in PROTECTION mode (`ON`) or not (`OFF`) | R | Y |
| `atLeastOneProbeManual` | `bus_thermo_cu` | Switch | Indicates if at least one probe is in MANUAL mode (`ON`) or not (`OFF`) | R | Y |
| 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 |
| `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 |
| `heatingValves` | `bus_thermo_zone` | String | The zone heating valve(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 |
| `conditioningValves` | `bus_thermo_zone` | String | The zone conditioning valve(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 |
| `heating` | `bus_thermo_zone` | Switch | `ON` if the zone heating valve is currently active (meaning heating is On) | R | Y |
| `cooling` | `bus_thermo_zone` | Switch | `ON` if the zone conditioning valve is currently active (meaning conditioning is On) | R | Y |
| `localOffset` | `bus_thermo_zone` | String | The zone local offset status: `OFF`, `PROTECTION`, `MINUS_3`, `MINUS_2` , `MINUS_1`, `NORMAL`, `PLUS_1`, `PLUS_2`, `PLUS_3`, as set on the room thermostat physical knob | R | Y |
| `remoteControl` | `bus_thermo_cu` | String | The Central Unit Remote Control status: `ENABLED`, `DISABLED` | R | Y |
| `batteryStatus` | `bus_thermo_cu` | String | The Central Unit Battery status: `OK`, `KO` | R | Y |
| `weeklyProgram` | `bus_thermo_cu` | Number | The weekly program number (`1`, `2`, `3`) when Central Unit mode is `WEEKLY` | R/W | N |
| `scenarioProgram` | `bus_thermo_cu` | Number | The scenario program number (`1`, `2`, ... , `16`) when Central Unit mode is `SCENARIO` | R/W | N |
| `vacationDays` | `bus_thermo_cu` | Number | Number of days `1-255` the Central Unit will be set to Anti-freeze / Heat Protection temperature before returning to mode `WEEKLY` | R/W | N |
| `failureDiscovered` | `bus_thermo_cu` | Switch | Indicates if a Failure was discovered by the Central Unit (`ON`), or not (`OFF`) | R | Y |
| `atLeastOneProbeOff` | `bus_thermo_cu` | Switch | Indicates if at least one probe is in OFF mode (`ON`) or not (`OFF`) | R | Y |
| `atLeastOneProbeProtection` | `bus_thermo_cu` | Switch | Indicates if at least one probe is in PROTECTION mode (`ON`) or not (`OFF`) | R | Y |
| `atLeastOneProbeManual` | `bus_thermo_cu` | Switch | Indicates if at least one probe is in MANUAL mode (`ON`) or not (`OFF`) | R | Y |
### Notes on channels
@ -345,8 +345,8 @@ Actions can be used for example to send commands to the BUS for a WHOs not yet s
- `Boolean sendMessage(String message)` returns a `Boolean` = `true` if the `message` (OpenWebNet frame) was successfully sent via the gateway, `false` otherwise.
- `Map<String, Object> sendMessageWithResponse(String message)` same as previous one, but returns a `Map<String, Object>` with following keys:
- `success`: a `Boolean` = `true` if the `message` was sent successfully
- `responseMessages`: a `List<String>` object containing all returned frames as response to command sent
- `success`: a `Boolean` = `true` if the `message` was sent successfully
- `responseMessages`: a `List<String>` object containing all returned frames as response to command sent
Usage example:
@ -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