Skip to content

Commit

Permalink
Provide example in JavaScript (#15286)
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Laursen <[email protected]>
  • Loading branch information
jlaur authored Jul 22, 2023
1 parent a6cbf37 commit 0fe1447
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion bundles/org.openhab.transform.vat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,28 @@ Number CurrentSpotPrice "Current Spot Price incl. VAT [VAT(12.5):%s]" <price>

Add Danish VAT to price:

```java
:::: tabs

::: tab DSL

```javascript
var Number price = 499
logInfo("Price", "Price incl. VAT: " + transform("VAT", "DK", price.toString))
```

:::

::: tab JavaScript

```javascript
var price = 499;
console.log("Price incl. VAT: " + actions.Transformation.transform("VAT", "DK", price.toString()));
```

:::

::::

## Usage as a Profile

The functionality of this `TransformationService` can also be used in a `Profile` on an `ItemChannelLink`.
Expand Down

0 comments on commit 0fe1447

Please sign in to comment.