[SOLVED] Rules vs Scripts?

Thanks for you reply @rossko57
Most of the time the rule works ok by pressing a physical switch or when using a Siri command.
It’s only sometimes that it hangs or doesn’t work.
These items are all linked to real devices. I have 14 ZWave nodes in total, with 3-4 switches on each node.

Can you please suggest a better rule format that will solve the traffic jam problem?
Many thanks for your help :pray:

Good point. I usually wait a minute or two before I repress the switch that runs the rule.

Thank you @5iver for the detailed answer :slight_smile:

  1. I have 14 zwave nodes on my system. And each node has 3-4 switches.
    I have not checked the debug log. I don’t really know how to do that.

  2. In OpenHAB Inbox, I can see 4 old zwave devices I deleted in the past and are no longer in my house. Are those Ghost nodes? when I removed them from my house I deleted them from the Things list, but I did not run the exclusion command. Is there a way to exclude them now?

  3. my OpenHAB system is installed on Raspberry pi 4 with 4gb of memory running Raspberry Pi OS with the desktop UI. Other than OpenHAB and the web browser, I don’t really use any other apps.

  4. I use rules a few times a day, depending on the rule. For example, I usually run the Good Morning and Good Night rules once a day each. But I have another rule that turns ON a bathroom fan every time I turn on the light in that room. There is only one command in the bathroom fan rule, so it most likely isn’t causing a command traffic jam. Nevertheless, even though the bathroom fan rule only has one command, sometimes there is a 20-30 seconds delay before the fan actually turns ON.

Can you please share an example script so I know how to change my rules to?

Is there post I can subscribe to, to know when the libraries are updated, so I can install them using the Eclipse Marketplace? Installing from openhab ui will make my life much easier, since I’m not a developer.

1 Like

Thanks @Nick_Wilkinson
My OpenHAB system is smaller than yours with about 14 zwave nodes.
In OpenHAB Inbox, I can see 4 old zwave devices I deleted in the past and are no longer in my house. Are those Ghost nodes? when I removed them from my house I deleted them from OpenHAB’s Things list, but I did not run the exclusion command. Is there a way to exclude them now?

The documentation covers this…

Yep! This is very likely the source of your issues.

In Habmin, add the device from the Inbox, then Configuration> Things> select ghost node> Tools (top right corner)> Show advanced settings> Set device as FAILED. Then Remove device from controller. Then delete the Thing. Repeat for all the ghost nodes. Then start discovery for the Z-Wave binding. If they show up again, it did not work, which is what most people report. From there, search the forum for the PC Controller software from SiLabs, which is a very handy tool.

Investigate further after the ghosts are busted. Chances are it will be zippy again.

Share a DSL rule and I will convert it to Jython for you.

The Jython and helper library add-ons are actually already in the marketplace (:shushing_face:)… along with Groovy, jRuby and Kotlin (not working yet). :shushing_face:! I have some polishing up to do, but hope to make an announcement this weekend. Until then, :shushing_face:! The Jython libraries need to be installed before the Jython add-on, or they will not be available in your scripts. Also, the library add-on has older libraries that need to be updated.

I will be posting a new topic about this, but I will ping the Jython beta add-on topic too.

3 Likes

If you still have the device you can plug them in/hook them up and exclude them. For the Aeotec Z-stick you are able to un-plug it from your computer hold the button for a few seconds until it starts to blink and walk around to each Z-Wave Device to trigger the device exclusion.

If you don’t have the devices anymore Scott’s suggestion might work. This hasn’t worked for me in the past.

I’ve downloaded PC control and haven’t had the time to understand it yet but believe there is a way to remove them.

A last resort would be to rebuild your Z-Wave Network. Last time I did this I moved to the the recommended approach of using the .item files https://www.openhab.org/docs/configuration/. This allows for all the items to be recreated quickly by just updating the Node ID in the file.

2 Likes

Ok, just my two cents on that…
I would suggest a fresh installation with the “openhabian-package”


on a recent version. I had some similar issues in the past that I was trying to fix but at the end that fresh installation solved everything and my system is doing a great job ever since!

Good luck!

1 Like

Unfortunately, I don’t have the ghost devices anymore. They didn’t work properly, so I needed to return them to the store and get replacements devices.

Thanks for the detailed explanation :pray:
Unfortunately, I was not successful in removing the Ghost Nodes using the FAIL and Remove device from controller commands.
I’ll try the PC controller software solution.

1 Like

After uninstalling two unnecessary bindings (Sonos binding and Samsung TV binding) I’m now in a big pickle, because all my rules stopped working and Homekit Integration also stopped working :scream:
I tried rebooting my Raspberry Pi, but it didn’t help.
I tried to reinstall the Rule Engine (Experimental) add-on, but that didn’t help.
And I also tried to create completely new rules files, and that didn’t help either.
I don’t know what could have caused the these failures.
I could really use a suggestion how to fix this issue :cry:

It seems my super basic computer developer skills are not sufficient to write proper Jython scripts.
Is it possible to create items Groups to control a few switches by pressing a single switch?
Or is this type of functionality only possible using rules and scripts?

Yes, absolutely!

In short:

  1. Define your Group Item
  2. Add each individual Item to your group using (yourGroupItemName) within the Item configuration.
  3. Add the Group Item to your Sitemap. If it’s a switch, it will switch all the members of that group in one go!
2 Likes

That sounds like a promising rules replacement.
Can Groups be defined in a way so that when the trigger switch is set to ON, all rollershutters in the groups will be opened by X%, and when the trigger switch is set to OFF all rollershutters will be closed?

Is X% the same X every time, or does this X change?

I think this is kind of possible using mappings, but it definitely depends on how you’ve setup your member Items.

1 Like

It will be the same x% everytime.
For example, when I set the trigger switch to ON, I would like all the living room rollershutters to open by 30%, and the bedroom rollershutter to open by 10%.
And when I set the trigger switch to OFF, I would like all the rollershutters in the apartment to close completely.

Ah, different members of a Group with different settings? No, I don’t think that is possible without rules.

1 Like

Do you think it will be possible If I set all rollershutters (including the bedroom) to open by 30%?

Maybe. Share your Items configuration and we’ll see…

This is an example rule I would like to replace with a script or group, because I had occasions the rule didn’t work properly (and from tonight all my rules stopped working altogether, for no apparent reason. Even simple rules with one command).

rule "Good Night"
when
    Item BedLeft_Switch3 changed from OFF to ON
then
    sendCommand(Entrance_Switch2, OFF)
    sendCommand(Entrance_Switch4, OFF)
    sendCommand(Bathroom_Switch2, OFF)
    sendCommand(Bathroom_Switch3, OFF)
    sendCommand(Bathroom_Switch4, OFF)
    sendCommand(Kitchen_Switch1, OFF)
    sendCommand(Kitchen_Switch2, OFF)
    sendCommand(SalonTV_Switch1, OFF)
    sendCommand(SalonTV_Switch2, OFF)
    sendCommand(SalonTV_Switch4, OFF)
    sendCommand(SalonDesk_Switch1, OFF)
    sendCommand(Balcony_Switch1, OFF)
    sendCommand(Balcony_Switch2, OFF)
    sendCommand(Bedroom_Switch2, OFF)
    sendCommand(Bedroom_Switch4, OFF)

    sendCommand(BedRight_Dimmer3, 100)
    sendCommand(SalonWindow_Dimmer3, 100)
    sendCommand(SalonDesk_Dimmer3, 100)
    sendCommand(SalonBalcony_Dimmer1, 100)
    sendCommand(SalonBalcony_Dimmer2, 100)
    sendCommand(Balcony_Dimmer3, 0)
end

Right, that rule is in your OP too. But we need to see your Items configurations in order to properly determine how to setup the mappings.