# \#javascripting

**URL:** https://community.openhab.org/tag/javascripting/4803.md

[Latest](https://community.openhab.org/latest.md) · [Categories](https://community.openhab.org/categories.md) · [Tags](https://community.openhab.org/tags.md)

---

## [JS: get the "source" of the last value change of an item](https://community.openhab.org/t/js-get-the-source-of-the-last-value-change-of-an-item/169212)

<div class="topic-metadata">

**Author:** [@binderth](https://community.openhab.org/u/binderth)\
**Replies:** 3\
**Last updated:** [May 4, 2026, 7:39pm UTC](https://community.openhab.org/t/js-get-the-source-of-the-last-value-change-of-an-item/169212 "2026-05-04T19:39:21Z")

</div>

running OH5.1.4 on docker. I’d like to get the source of the last value change of an item in a rule. in the logs it’s clear: If I changed the light via a switch: source: org.openhab.core.thing$knx:device:THING:CHANNEL …

---

## [Infinite loop due to missing let statement and call by reference](https://community.openhab.org/t/infinite-loop-due-to-missing-let-statement-and-call-by-reference/161521)

<div class="topic-metadata">

**Author:** [@Christian\_Feininger](https://community.openhab.org/u/Christian_Feininger)\
**Replies:** 3\
**Last updated:** [January 8, 2025, 5:02pm UTC](https://community.openhab.org/t/infinite-loop-due-to-missing-let-statement-and-call-by-reference/161521 "2025-01-08T17:02:47Z")

</div>

Hello, I am not very good in JavaScript however I am running into a problem by calling a function where the parameters handed over to the function are treated as call by reference instead of call by value. I understood …

---

## [Dynamic Charts filled by JavaScript Scripting](https://community.openhab.org/t/dynamic-charts-filled-by-javascript-scripting/161043)

<div class="topic-metadata">

**Author:** [@Christian\_Feininger](https://community.openhab.org/u/Christian_Feininger)\
**Replies:** 3\
**Last updated:** [December 23, 2024, 9:20am UTC](https://community.openhab.org/t/dynamic-charts-filled-by-javascript-scripting/161043 "2024-12-23T09:20:43Z")

</div>

Hello, I trying to create a chart which shows the hourly cost of current coming from tibber. I do have all cost in seperate items per hour stored. Furthermore I have a seperate switch for every hour of the day where I c…

---

## [item.persistence.lastUpdate() not always working](https://community.openhab.org/t/item-persistence-lastupdate-not-always-working/158534)

<div class="topic-metadata">

**Author:** [@Bloodboy](https://community.openhab.org/u/Bloodboy)\
**Replies:** 4\
**Last updated:** [October 11, 2024, 6:56pm UTC](https://community.openhab.org/t/item-persistence-lastupdate-not-always-working/158534 "2024-10-11T18:56:36Z")

</div>

Hello everyone, after the migration to version 4.2.1 I have the following behavior, but I’m not sure if it was the same before: In a js-rule I call the .persistence.lastUpdate() and have the problem that very often nul…

---

## [Update 4.2: JSScripting date comparisons](https://community.openhab.org/t/update-4-2-jsscripting-date-comparisons/157278)

<div class="topic-metadata">

**Author:** [@binderth](https://community.openhab.org/u/binderth)\
**Replies:** 2\
**Last updated:** [July 19, 2024, 6:54am UTC](https://community.openhab.org/t/update-4-2-jsscripting-date-comparisons/157278 "2024-07-19T06:54:22Z")

</div>

running OH 4.2.0-release on openHABian since upgrade from 4.1.2. I’m trying to compare an JSON delivered date with the current time. the item TIB\_Prices is a JSON with the current value: \[ { "startsAt": "2024-07…

---

## [Lux dependent script](https://community.openhab.org/t/lux-dependent-script/156609)

<div class="topic-metadata">

**Author:** [@stamate\_viorel](https://community.openhab.org/u/stamate_viorel)\
**Replies:** 8\
**Last updated:** [June 7, 2024, 8:03pm UTC](https://community.openhab.org/t/lux-dependent-script/156609 "2024-06-07T20:03:22Z")

</div>

Hello I am ripping my hair out. So here I have a lux sensor and some light the ideea is simple when it gets dark turn some lights on only once then at 11pm turn some lights off and in the morning at sunrise turn the rem…

---

## [SOLVED: Datetime accuracy in javascript only milliseconds](https://community.openhab.org/t/solved-datetime-accuracy-in-javascript-only-milliseconds/152054)

<div class="topic-metadata">

**Author:** [@holger\_hees](https://community.openhab.org/u/holger_hees)\
**Replies:** 4\
**Last updated:** [December 18, 2023, 9:32am UTC](https://community.openhab.org/t/solved-datetime-accuracy-in-javascript-only-milliseconds/152054 "2023-12-18T09:32:44Z")

</div>

If I call console.log(time.ZonedDateTime.now().nano()); in my Rule, I get something like 867000000 which are 867.000000 milliseconds, without micro and nano part Is there a way to increase the accuracy to nanosecond…

---

## [JSR223 Scripting in Java - Beta4](https://community.openhab.org/t/jsr223-scripting-in-java-beta4/147075)

<div class="topic-metadata">

**Author:** [@weberjn](https://community.openhab.org/u/weberjn)\
**Replies:** 4\
**Last updated:** [August 2, 2023, 6:53pm UTC](https://community.openhab.org/t/jsr223-scripting-in-java-beta4/147075 "2023-08-02T18:53:34Z")

</div>

Beta 4 of JSR223 Java Scripting for openHAB is released to GitHub - weberjn/org.openhab.automation.javascripting . It works like Groovy Scripting only with Java as language. Beta 4 is built against openHAB 4.0.0-SNAP…

---

## [\[BUG?\] JSScripting Quantity not adding](https://community.openhab.org/t/bug-jsscripting-quantity-not-adding/148042)

<div class="topic-metadata">

**Author:** [@cinadr](https://community.openhab.org/u/cinadr)\
**Replies:** 2\
**Last updated:** [July 26, 2023, 2:44pm UTC](https://community.openhab.org/t/bug-jsscripting-quantity-not-adding/148042 "2023-07-26T14:44:19Z")

</div>

Hi! This might be a bug. I can only test in JSScripting currently. OH version is 4.0.0 release. The code: var a = Quantity('0.0 mm'); var b = Quantity('0.2 mm'); console.log(a); a.add(b); console.log(a); a.add('0.2 m…

---

## [JSR223 Scripting in Java](https://community.openhab.org/t/jsr223-scripting-in-java/145190)

<div class="topic-metadata">

**Author:** [@weberjn](https://community.openhab.org/u/weberjn)\
**Replies:** 1\
**Last updated:** [March 14, 2023, 9:25am UTC](https://community.openhab.org/t/jsr223-scripting-in-java/145190 "2023-03-14T09:25:05Z")

</div>

I’ve released Beta 2 of Java Scripting for openHAB to GitHub - weberjn/org.openhab.automation.javascripting . It works similar to Groovy Scripting, only with Java as language. Beta 2 supports Rules definitions with Jav…
