# \#rules-dsl

**URL:** https://community.openhab.org/tag/rules-dsl/3757.md?match_all_tags=true&page=1&tags%5B%5D=rules-dsl

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

**Page:** 2

---

## [How to ignore the string item if its UNDEF](https://community.openhab.org/t/how-to-ignore-the-string-item-if-its-undef/158068)

<div class="topic-metadata">

**Author:** [@vanja](https://community.openhab.org/u/vanja)\
**Replies:** 10\
**Last updated:** [August 28, 2024, 5:43pm UTC](https://community.openhab.org/t/how-to-ignore-the-string-item-if-its-undef/158068 "2024-08-28T17:43:29Z")

</div>

I hope that’s not too much to ask from good old DSL engine, but can I omit using either of the strings if their state is UNDEF? So, if I do not receive the artist, currently my KodiSummary string item is updated to: “UN…

---

## [OH3: persistence maximumSince produces error](https://community.openhab.org/t/oh3-persistence-maximumsince-produces-error/157803)

<div class="topic-metadata">

**Author:** [@Max\_G](https://community.openhab.org/u/Max_G)\
**Replies:** 2\
**Last updated:** [August 14, 2024, 1:01pm UTC](https://community.openhab.org/t/oh3-persistence-maximumsince-produces-error/157803 "2024-08-14T13:01:01Z")

</div>

OH 3.4.3 on rPi4 with 4GB Running this rule: rule "trial" when Time cron "5 0/1 8 ? \* \* \*" then val RULE\_ID = 01 val AVERAGE\_EXPORT\_RECENT\_DAYS = 2 val RECENT\_AVERAGE\_EXPORT …

---

## [Help with order of execution within a rule](https://community.openhab.org/t/help-with-order-of-execution-within-a-rule/157759)

<div class="topic-metadata">

**Author:** [@vanja](https://community.openhab.org/u/vanja)\
**Replies:** 6\
**Last updated:** [August 13, 2024, 2:40am UTC](https://community.openhab.org/t/help-with-order-of-execution-within-a-rule/157759 "2024-08-13T02:40:11Z")

</div>

HI, I would like the last 3 lines of the rule to be executed only after he went through 4 x if conditions. I guess Thread::sleep or Timer will work, but is there a smarter way? rule "Set AC Limit" when Item TimeOfD…

---

## [Rule not working since the upgrade from 4.0 to 4.2](https://community.openhab.org/t/rule-not-working-since-the-upgrade-from-4-0-to-4-2/157738)

<div class="topic-metadata">

**Author:** [@vanja](https://community.openhab.org/u/vanja)\
**Replies:** 5\
**Last updated:** [August 11, 2024, 12:03pm UTC](https://community.openhab.org/t/rule-not-working-since-the-upgrade-from-4-0-to-4-2/157738 "2024-08-11T12:03:33Z")

</div>

Hi, any reason this: kWh\_Today.postUpdate ((kWh.deltaSince(now.with(LocalTime.of(0,0,0,0)))).floatValue) does not work anymore? 2024-08-11 13:47:59.388 \[ERROR\] \[internal.handler.ScriptActionHandler\] - Script executio…

---

## [Group multiple if then x in dsl rules](https://community.openhab.org/t/group-multiple-if-then-x-in-dsl-rules/157718)

<div class="topic-metadata">

**Author:** [@vanja](https://community.openhab.org/u/vanja)\
**Replies:** 11\
**Last updated:** [August 11, 2024, 10:33am UTC](https://community.openhab.org/t/group-multiple-if-then-x-in-dsl-rules/157718 "2024-08-11T10:33:04Z")

</div>

Hi, example: rule "test" when Item test1 changed or Item test2 changed then if(triggeringItemName.state == "test1" && example1.state == ON ) { stuff.sendCommand(ON) } if(t…

---

## [Rules not Displaying in Settings-\>Rules](https://community.openhab.org/t/rules-not-displaying-in-settings-rules/157688)

<div class="topic-metadata">

**Author:** [@apskinner](https://community.openhab.org/u/apskinner)\
**Replies:** 6\
**Last updated:** [August 9, 2024, 8:57pm UTC](https://community.openhab.org/t/rules-not-displaying-in-settings-rules/157688 "2024-08-09T20:57:52Z")

</div>

openHAB 4.2.0 Release Build running on PI3B I had a SD card go bad so I installed a new openhabian to a new card and then recreated bindings etc (Yes my backup also failed) I use text files for all my rules, items, etc…

---

## [\[SOLVED\] Battert low rule misfiring](https://community.openhab.org/t/solved-battert-low-rule-misfiring/157603)

<div class="topic-metadata">

**Author:** [@vanja](https://community.openhab.org/u/vanja)\
**Replies:** 11\
**Last updated:** [August 4, 2024, 12:53pm UTC](https://community.openhab.org/t/solved-battert-low-rule-misfiring/157603 "2024-08-04T12:53:56Z")

</div>

Hi, i have a rule that supposed to email me when some battery is low. It worked fine, but now it seems it went crazy and it emails me every time some battery changes. WHen I inspect the event log, I see a battery chan…

---

## [Rules-dsl: error after update from 4.1.1 to 4.2: 'doubleValue' is not a member of 'org.openhab.core.types.State'](https://community.openhab.org/t/rules-dsl-error-after-update-from-4-1-1-to-4-2-doublevalue-is-not-a-member-of-org-openhab-core-types-state/157223)

<div class="topic-metadata">

**Author:** [@Duke\_Jones](https://community.openhab.org/u/Duke_Jones)\
**Replies:** 2\
**Last updated:** [July 15, 2024, 2:43pm UTC](https://community.openhab.org/t/rules-dsl-error-after-update-from-4-1-1-to-4-2-doublevalue-is-not-a-member-of-org-openhab-core-types-state/157223 "2024-07-15T14:43:40Z")

</div>

Hi, I have a few rules in which I have accessed “doubleValue” so far. var Number dev = Math::abs((IGLR2\_ValveOpening.deviationSince(now.minusMinutes(30))).doubleValue) After the update to 4.2, I get the following erro…

---

## [Which JavaScript?](https://community.openhab.org/t/which-javascript/156603)

<div class="topic-metadata">

**Author:** [@Max\_G](https://community.openhab.org/u/Max_G)\
**Replies:** 12\
**Last updated:** [June 9, 2024, 8:06am UTC](https://community.openhab.org/t/which-javascript/156603 "2024-06-09T08:06:35Z")

</div>

My question is more about clarification of names… I’m planning to migrate from 3.4 to 4.x Before I do, I want convert my DSL rules to JavaScript. There is talk about ECMA, ECMAscript 2021 and 2022, and JavaScript on t…

---

## [Rule Error - but where?](https://community.openhab.org/t/rule-error-but-where/156079)

<div class="topic-metadata">

**Author:** [@anne\_hh](https://community.openhab.org/u/anne_hh)\
**Replies:** 2\
**Last updated:** [May 18, 2024, 7:35pm UTC](https://community.openhab.org/t/rule-error-but-where/156079 "2024-05-18T19:35:54Z")

</div>

openHab 4.2.0: i have messages like this in the log: 2024-05-18 16:58:01.525 \[ERROR\] \[ernal.handler.ScriptConditionHandler\] - Script execution failed: Could not cast NULL to org.openhab.core.library.types.DateTimeType; …

---

## [OH3: Cannot reference the field 'Const\_Email\_Admin' before it is defined](https://community.openhab.org/t/oh3-cannot-reference-the-field-const-email-admin-before-it-is-defined/155785)

<div class="topic-metadata">

**Author:** [@Max\_G](https://community.openhab.org/u/Max_G)\
**Replies:** 6\
**Last updated:** [May 8, 2024, 12:11am UTC](https://community.openhab.org/t/oh3-cannot-reference-the-field-const-email-admin-before-it-is-defined/155785 "2024-05-08T00:11:06Z")

</div>

openHABian 3.4.1 on rPi4 with 4GB I have a bunch of rules that send an email to me. However, I want to make this more manageable, so that it can b changed in one location. My idea was to create an string item Const\_E…

---

## [Ephemeris issues with custom xml](https://community.openhab.org/t/ephemeris-issues-with-custom-xml/154025)

<div class="topic-metadata">

**Author:** [@paglatz](https://community.openhab.org/u/paglatz)\
**Replies:** 5\
**Last updated:** [February 20, 2024, 3:36pm UTC](https://community.openhab.org/t/ephemeris-issues-with-custom-xml/154025 "2024-02-20T15:36:16Z")

</div>

Hi all, and maybe directly @rlkoshak :wink: since hours im trying to configure Ephemeris. I configured it via the Ui to Germany, Baden-Württemberg, and weekends to SATURDAY, SUNDAY and the city to wn. With the default …

---

## [Problem with Hue switches randomly reporting 4XXX action when pressing any of the other buttons](https://community.openhab.org/t/problem-with-hue-switches-randomly-reporting-4xxx-action-when-pressing-any-of-the-other-buttons/149896)

<div class="topic-metadata">

**Author:** [@nelson.aponte](https://community.openhab.org/u/nelson.aponte)\
**Replies:** 14\
**Last updated:** [February 14, 2024, 3:22pm UTC](https://community.openhab.org/t/problem-with-hue-switches-randomly-reporting-4xxx-action-when-pressing-any-of-the-other-buttons/149896 "2024-02-14T15:22:45Z")

</div>

I’m running OH 4.0.3 on an RPi 4 with CentOS 8. When I upgraded to 4.03 from 3.4, I also implemented the API v2. After that, I started facing an issue with the rule that handles the actions from the Dimmer Switch, where…

---

## [DSL vs Javascript Math](https://community.openhab.org/t/dsl-vs-javascript-math/152099)

<div class="topic-metadata">

**Author:** [@Farmboy94](https://community.openhab.org/u/Farmboy94)\
**Replies:** 20\
**Last updated:** [December 23, 2023, 5:57pm UTC](https://community.openhab.org/t/dsl-vs-javascript-math/152099 "2023-12-23T17:57:38Z")

</div>

So I am trying to run this equation in openhab, in dsl it all works except needing to have a negative base in an exponential expression. It doesn’t like that, it just returns NaN. My question is, can Javascript actuall…

---

## [\[SOLVED\] Two Rules stopped working on OpenHAB 4.0.4](https://community.openhab.org/t/solved-two-rules-stopped-working-on-openhab-4-0-4/151731)

<div class="topic-metadata">

**Author:** [@mjeshurun](https://community.openhab.org/u/mjeshurun)\
**Replies:** 6\
**Last updated:** [December 3, 2023, 8:24pm UTC](https://community.openhab.org/t/solved-two-rules-stopped-working-on-openhab-4-0-4/151731 "2023-12-03T20:24:52Z")

</div>

Hi Friends, I’m currently using OpenHAB 4.0.4 on Unraid using a docker install. After updating to 4.0.4 two of my rules stopped working. They did work before and other rules appear to be working properly. One rule is …

---

## [Nullpointer hazard with timers?](https://community.openhab.org/t/nullpointer-hazard-with-timers/151636)

<div class="topic-metadata">

**Author:** [@Hundertvolt1](https://community.openhab.org/u/Hundertvolt1)\
**Replies:** 5\
**Last updated:** [November 29, 2023, 3:54pm UTC](https://community.openhab.org/t/nullpointer-hazard-with-timers/151636 "2023-11-29T15:54:26Z")

</div>

Hi all, I have a general question about timers in rules DSL. From what I found, it’s usual practice (and so did I many times in my config) to use timers in a fashion like: if (myTimer === null) { myTimer = createTim…

---

## [\[SOLVED\] Starting scenes (or other rules) with Rule DSL for e.g. Scene Management](https://community.openhab.org/t/solved-starting-scenes-or-other-rules-with-rule-dsl-for-e-g-scene-management/151346)

<div class="topic-metadata">

**Author:** [@PeterK](https://community.openhab.org/u/PeterK)\
**Replies:** 6\
**Last updated:** [November 20, 2023, 10:38pm UTC](https://community.openhab.org/t/solved-starting-scenes-or-other-rules-with-rule-dsl-for-e-g-scene-management/151346 "2023-11-20T22:38:41Z")

</div>

Hi, I wanted to test scenes in OpenHAB. I found a way to start scenes with JavaScript using the following code: rules.runRule('UID of scene', {}) The problem is that my complete scene management works with Rule DSL, b…

---

## [Not getting error statements when loading/parsing rules file](https://community.openhab.org/t/not-getting-error-statements-when-loading-parsing-rules-file/148946)

<div class="topic-metadata">

**Author:** [@PaulL1](https://community.openhab.org/u/PaulL1)\
**Replies:** 15\
**Last updated:** [September 4, 2023, 12:48am UTC](https://community.openhab.org/t/not-getting-error-statements-when-loading-parsing-rules-file/148946 "2023-09-04T00:48:53Z")

</div>

I’m writing some extensions to my rules to accommodate some new Shelly automations that I have. Recently I’ve noticed that when I write rules and upload the new rules file, I don’t get what I used to in the openhab log …

---

## [OH3: how to identify the error source / reason encountered in a rule (DSL)?](https://community.openhab.org/t/oh3-how-to-identify-the-error-source-reason-encountered-in-a-rule-dsl/148162)

<div class="topic-metadata">

**Author:** [@Max\_G](https://community.openhab.org/u/Max_G)\
**Replies:** 4\
**Last updated:** [July 31, 2023, 11:14am UTC](https://community.openhab.org/t/oh3-how-to-identify-the-error-source-reason-encountered-in-a-rule-dsl/148162 "2023-07-31T11:14:42Z")

</div>

OH3 openHABian on rPi4 with 4GB 2023-07-30 10:26:41.167 \[ERROR\] \[internal.handler.ScriptActionHandler\] - Script execution of rule with UID 'weather-1' failed: Index 2 out of bounds for length 1 in weather This is the …

---

## [OH4, UoM, and DSL rules](https://community.openhab.org/t/oh4-uom-and-dsl-rules/148064)

<div class="topic-metadata">

**Author:** [@RealBrianWarner](https://community.openhab.org/u/RealBrianWarner)\
**Replies:** 1\
**Last updated:** [July 27, 2023, 7:57am UTC](https://community.openhab.org/t/oh4-uom-and-dsl-rules/148064 "2023-07-27T07:57:08Z")

</div>

Platform information: Hardware: Raspberry Pi 4 OS: OpenHabian Java Runtime Environment: OpenJDK 17 openHAB version: 4.0.0 Hi, I just upgraded to 4.0.0, and am trying to make sure I understand the consequences of the…

---

## [How to retrieve the receivedCommand from the triggeringItem?](https://community.openhab.org/t/how-to-retrieve-the-receivedcommand-from-the-triggeringitem/147949)

<div class="topic-metadata">

**Author:** [@fennepa](https://community.openhab.org/u/fennepa)\
**Replies:** 2\
**Last updated:** [July 24, 2023, 5:58am UTC](https://community.openhab.org/t/how-to-retrieve-the-receivedcommand-from-the-triggeringitem/147949 "2023-07-24T05:58:06Z")

</div>

Hello, I have difficulties getting this concept to work for my items type = dimmer: When I copy/paste the code into DSL on my openHAB 3.4.4 installation I ran into this syntax issue: Type mismatch: cannot convert from…

---

## [Rule debug possibility in logs changed with openHAB 3.4?](https://community.openhab.org/t/rule-debug-possibility-in-logs-changed-with-openhab-3-4/147724)

<div class="topic-metadata">

**Author:** [@Cplant](https://community.openhab.org/u/Cplant)\
**Replies:** 4\
**Last updated:** [July 14, 2023, 8:07pm UTC](https://community.openhab.org/t/rule-debug-possibility-in-logs-changed-with-openhab-3-4/147724 "2023-07-14T20:07:37Z")

</div>

Two years ago I wrote a couple of rules (Javascript and RuleDSL) on openHAB 3.2 and 3.3, with the default openHAB logging settings printing out everything I needed to write & debug my rules. When something did not work, …

---

## [Rule with Unit of Measurement Speed \[km/h\] =\> slash to escape?](https://community.openhab.org/t/rule-with-unit-of-measurement-speed-km-h-slash-to-escape/147606)

<div class="topic-metadata">

**Author:** [@Matthias\_Kaufmann](https://community.openhab.org/u/Matthias_Kaufmann)\
**Replies:** 9\
**Last updated:** [July 10, 2023, 8:37pm UTC](https://community.openhab.org/t/rule-with-unit-of-measurement-speed-km-h-slash-to-escape/147606 "2023-07-10T20:37:10Z")

</div>

Hi all, I have a rule and want to compare the maximum Wind speed of the last 15 Minutes to a defined max value to know if I want to re-open my awning after automatic closing due to wind. Nothing too special, but I get i…

---

## [Feed surplus energy produced by photovoltaics into the hot water](https://community.openhab.org/t/feed-surplus-energy-produced-by-photovoltaics-into-the-hot-water/147129)

<div class="topic-metadata">

**Author:** [@slax91](https://community.openhab.org/u/slax91)\
**Replies:** 15\
**Last updated:** [July 10, 2023, 1:35pm UTC](https://community.openhab.org/t/feed-surplus-energy-produced-by-photovoltaics-into-the-hot-water/147129 "2023-07-10T13:35:35Z")

</div>

Good morning everybody. I do have two components connected to my Openhab based on a raspberry 4. The Battery and photovoltaics on the roof and the modbus based water tank. I am able to read and write everything and eve…

---

## [Can Lambda Function Access external data that is not an item](https://community.openhab.org/t/can-lambda-function-access-external-data-that-is-not-an-item/147159)

<div class="topic-metadata">

**Author:** [@Lamerjack](https://community.openhab.org/u/Lamerjack)\
**Replies:** 6\
**Last updated:** [June 12, 2023, 1:26pm UTC](https://community.openhab.org/t/can-lambda-function-access-external-data-that-is-not-an-item/147159 "2023-06-12T13:26:31Z")

</div>

Platform information: Hardware: NANOPI NEO 2 Plis/1GB Ram/16 Storage OS: Armbian with Kernel 5.15 openHAB version:3.3 or 4.0 I want a create a function that is easy replicable to create Random answer to avoid to get a…

---

## [JSONPath in DSL Rules](https://community.openhab.org/t/jsonpath-in-dsl-rules/146718)

<div class="topic-metadata">

**Author:** [@LeeC77](https://community.openhab.org/u/LeeC77)\
**Replies:** 2\
**Last updated:** [May 26, 2023, 7:52am UTC](https://community.openhab.org/t/jsonpath-in-dsl-rules/146718 "2023-05-26T07:52:08Z")

</div>

Hi I’m trying to use JSONPath in a DSL rule to sum the a value from a set of records returned in a JSON response to a URL call. The syntax of the JSON path command I’m using is var newvalue = (transform("JSONPATH"…

---

## [\[OH3\] Using global HashMap in Lambda in DSL Rules](https://community.openhab.org/t/oh3-using-global-hashmap-in-lambda-in-dsl-rules/143662)

<div class="topic-metadata">

**Author:** [@Eddy1015](https://community.openhab.org/u/Eddy1015)\
**Replies:** 6\
**Last updated:** [January 22, 2023, 8:31pm UTC](https://community.openhab.org/t/oh3-using-global-hashmap-in-lambda-in-dsl-rules/143662 "2023-01-22T20:31:20Z")

</div>

Platform information: Hardware: Raspberry Pi 3 Model B Plus Rev 1.3 OS: Linux openhabian 5.15.84-v7+ #1613 SMP Thu Jan 5 11:59:48 GMT 2023 armv7l Java Runtime Environment: openjdk version “11.0.16” 2022-07-19 OpenJDK …

---

## [After Update to OH3.4 one issue in ruleDSL](https://community.openhab.org/t/after-update-to-oh3-4-one-issue-in-ruledsl/142429)

<div class="topic-metadata">

**Author:** [@kl8ter](https://community.openhab.org/u/kl8ter)\
**Replies:** 19\
**Last updated:** [December 26, 2022, 11:06am UTC](https://community.openhab.org/t/after-update-to-oh3-4-one-issue-in-ruledsl/142429 "2022-12-26T11:06:33Z")

</div>

Hello after the Update to OH3.4 i got an error: var YRain = (Rain\_Today.previousState().state as QuantityType\<Number\>) YRain = YRain.toUnit("mm") sendCommand(Rain\_Yesterday,YRain) error msg Could not cast 1.4 to or…

---

## [Create item in rules DSL with a quantity type](https://community.openhab.org/t/create-item-in-rules-dsl-with-a-quantity-type/141751)

<div class="topic-metadata">

**Author:** [@MartOs](https://community.openhab.org/u/MartOs)\
**Replies:** 7\
**Last updated:** [December 12, 2022, 3:41pm UTC](https://community.openhab.org/t/create-item-in-rules-dsl-with-a-quantity-type/141751 "2022-12-12T15:41:18Z")

</div>

I can add a new item in rules DSL with var temporaryItem = new NumberItem("testItem") but how do I create a “Number:Illuminance” item? Other things I can do are temporaryItem.label = "testItem Label" // Change label …

---

## [averageBetween and sumBetween is undefined for NumberItem](https://community.openhab.org/t/averagebetween-and-sumbetween-is-undefined-for-numberitem/140498)

<div class="topic-metadata">

**Author:** [@ulfwin](https://community.openhab.org/u/ulfwin)\
**Replies:** 6\
**Last updated:** [November 1, 2022, 8:53pm UTC](https://community.openhab.org/t/averagebetween-and-sumbetween-is-undefined-for-numberitem/140498 "2022-11-01T20:53:48Z")

</div>

I’m trying to get an average over time for a number item. My first issue is that the average seems to break when there are future values in influxdb. I get the following: 2022-10-31 19:59:43.353 \[WARN \] \[rg.openhab.core…

[Previous page](https://community.openhab.org/tag/rules-dsl/3757.md?match_all_tags=true&tags%5B%5D=rules-dsl)

[Next page](https://community.openhab.org/tag/rules-dsl/3757.md?match_all_tags=true&page=2&tags%5B%5D=rules-dsl)
