Debounce [3.2.0;3.4.9]

Ok; thanks for the help anyways!

I am unable to test this now since I avoid updates during winter time :smile:

I used npm from debian repo to install the helper, perhaps that is the issue. Unfortunately I do not use the openhabian, I am not sure what you refer with that.

openHABian comes with a config tool to install/remove lots of third party stuff like Mosquito, Frontal, etc. openhab-rules-tools is included among those.

I believe new installs of openHABian will install it by default.

Hi,
I am new in rule templates at all and I am feeling to be an idiot, since I cannot find any rule or blockly template below “Settings>Automation>Languages & Technologies” as described in the docs.


My question here: What is overseen by myself to install rule templates?
I try to find help since hours on the web
 but it seems, I am the only one who’s affected


I use openhabian 3.4.0 (migrated over the time from 2.something) on a RasPi 4.
Most of the config comes from files, but step by step moving to UI.

May somebody is able to point me to the right direction.
Thanks!

Debounce is just a template for a rule. It doesn’t create any rule by itself.

You have to create a new rule an select the debounce template for your new rule.

For example:

Resulting in the actual rule:

Hi Christian,
thanks for your short time reply.
But what should I say: If I click on the plus sign inside the rule list to add a new rule, the upcoming window does not showcase ‘Create from Template’ as you see in the following picture:

If you scroll down within “automation” you should see the rules templates. As the rules templates are online you need a working internet connection so that they show up

Hi Locke,
thanks, since it looks like to be a more general problem in my installation environment, I opened an extra thread, outside of ‘debounce’.
/Mav

You have to enable the marketplace under settings - community marketplace (or something like that).

1 Like

Hi Rich,
thanks for the hint. The setting were enabled already, but disabling and re-enabling solved the problem
 the missing sections now appeared.
BR
/Mav

For a long time I was looking for a feature to lower the knx traffic while updating temperature values from one “Resol”-binding to the “knx”-binding without typing tons of rules. So at this point thanks for that!

Formerly I had an item definition to “follow” the Resol data and update the values to knx:


Number:Temperature ResolEMS1_buffer_top "temp top [%.1f %unit%]"  (gResol)  { channel="resol:device:VBUS:DeltaSol_MX-Modules:temperature_module_1_sensor_1", channel="knx:device:bridge:IPRouter:proxy_resol_temp_buffer_top" [profile="follow"] }

This “follow”-profile works, but the values are being updated every 6 to 10 seconds. Far too much traffic within the knx line with a lot of unused data.

I tried the following item definition to ‘debounce’ the Resol binding temperature values by 3 minutes:


Number:Temperature    raw_resol_temp_buffer_top        "raw: Resol temp buffer top [%.1f] °C"        (gProxy)    {channel="resol:device:VBUS:DeltaSol_MX-Modules:temperature_module_1_sensor_1"}

Number:Temperature    debounced_resol_temp_buffer_top "debounced: Resol temp buffer top [%.1f] °C"        (gProxy)    {debounce="raw_resol_temp_buffer_top"[timeout="3m"], channel="knx:device:bridge:IPRouter:proxy_resol_temp_buffer_top" [profile="follow"]}

EDIT

I missed the group. The Item now is member of the group ‘Debounce’.

I misunderstod the concept. Should be “RAW-Item with ‘debounce’-profile to update proxy”. Therefor I tried this:


Group                 Debounce                  "Debounce"

Number:Temperature    raw_resol_test          "raw: Resol test - temp buffer top [%.1f] °C"          (Debounce)    { debounce="debounced_resol_test"[timeout="1m"], channel="resol:device:VBUS:DeltaSol_MX-Modules:temperature_module_1_sensor_1"}

Number:Temperature    debounced_resol_test    "debounced: Resol test - temp buffer top [%.1f] °C"    (gProxy)    { channel="knx:device:bridge:IPRouter: proxy_resol_temp_buffer_top" [profile="follow"]}

The item ‘debounced_resol_test’ is not updated.

OH 3.4.3 with “openhab_rules_tools” and “JS Scripting” installed.

Did I miss something? I tried several things, but found no solution. No hints within the logs as far as I can see.

Thanks,
Dirk

The “raw” Item should be linked to the Channel.

The “raw” Item should be a member of the Debounce Group.

The "debounced " Item should not be linked to anything. No channels, no follow profile, nothing. The only source of it’s state will come from the Debounce rule. If you need to cause the debounced value to be sent back out to another Channel, you can link the Item to a Channel but set the “command” option to “true”.

This version of the rule template was written in Nashorn JS so nothing else needs to be installed. If you are running this on OH 4, please use Debounce [4.0.0.0;4.1.0.0) instead. Note that if you remove the template and readd it after moving to OH 4 it will install this version. OH 4 requires the JS Scripting add-on to be installed but it also has a lot of error checking and if there is something wrong it will report it.

thanks @rlkoshak - I got it working. For some reason the group was not correct configured as trigger for the rule.

What is striking: The first value is written to the proxy item once the timer has expired for the first time. My stats are updated every 6-10 seconds through the “Resol” -binding. However, the proxy item remains NULL and only after the specified debounce time period has elapsed the proxy item had received a value. From my point of view, it would make more sense, if the first incoming value would already been send to the proxy item in case the item never got a value before. Especially when the debounce time is ‘very’ long (for example hours). In my case it is just 3 minutes and it is no problem, that one has to wait 3 minutes (for example on a restart) before the first usable values are coming in.

Thanks!

That’s working as designed.

With default persistence configs that restore the state of all Items on startup, this case will only happen once, when the Item is first created. After that point it will always have a state so I don’t really see a need to add that as an option (note the opposite is equally as valid, always wait the debounce period, which adds a good bit of complexity to the rule to support a rare case.

If the debounce is that long you probably should not use this rule template and instead code something that can handle a restart of OH more gracefully. But even so, in that case a manual update of the debounce Item when it’s first created would address that problem.

Hi @rlkoshak ,
I’ve just upgraded from 3.4 to 4.0.3 and it has stopped working.
I’ve read that you can change the script type to application/javascript;version=ECMAScript-2021, but I’ve changed the two instances of application/javascript to application/javascript;version=ECMAScript-2021 and it still doesn’t work.
How should I do this?
Thanks.

Ideally you should delete the rules, remove the rule template, and install the rewritten rule that was rewritten for OH 4. Debounce [4.0.0.0;4.9.9.9]

If you want to try to keep this old version you need to either:

  • Install the Nashorn JS add-on and change the type to application/javascript;version=ECMAScript-5.1

  • Install the GraalVM add-on and leave the type application/javascript

But I’ve rewritten all of my rule templates for OH 4 and you should really move to the newer ones. I’m not going to maintain these 3.x versions of the template and the new ones work better and have better error checking. Some of the rule templates have changed behaviors slightly so be sure to read the docs for the template.

Thank you, Rich, I hadn’t seen the new one. I’ll try it.