From 0fe144708c0c5e140ffdd313e1655be2a4a0dd21 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Sat, 22 Jul 2023 22:37:48 +0200 Subject: [PATCH] Provide example in JavaScript (#15286) Signed-off-by: Jacob Laursen --- bundles/org.openhab.transform.vat/README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.transform.vat/README.md b/bundles/org.openhab.transform.vat/README.md index a39046905d340..00ac4c7899a8c 100644 --- a/bundles/org.openhab.transform.vat/README.md +++ b/bundles/org.openhab.transform.vat/README.md @@ -15,11 +15,28 @@ Number CurrentSpotPrice "Current Spot Price incl. VAT [VAT(12.5):%s]" 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`.