mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 23:22:02 +01:00
Provide example in JavaScript (#15286)
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
a6cbf37b75
commit
0fe144708c
@ -15,11 +15,28 @@ Number CurrentSpotPrice "Current Spot Price incl. VAT [VAT(12.5):%s]" <price>
|
|||||||
|
|
||||||
Add Danish VAT to price:
|
Add Danish VAT to price:
|
||||||
|
|
||||||
```java
|
:::: tabs
|
||||||
|
|
||||||
|
::: tab DSL
|
||||||
|
|
||||||
|
```javascript
|
||||||
var Number price = 499
|
var Number price = 499
|
||||||
logInfo("Price", "Price incl. VAT: " + transform("VAT", "DK", price.toString))
|
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
|
## Usage as a Profile
|
||||||
|
|
||||||
The functionality of this `TransformationService` can also be used in a `Profile` on an `ItemChannelLink`.
|
The functionality of this `TransformationService` can also be used in a `Profile` on an `ItemChannelLink`.
|
||||||
|
Loading…
Reference in New Issue
Block a user