Fibaro button script

One day everything works, the next day I get weird errors in log

At the moment I’m having difficulties with a Fibaro button script. It should control my media player devices (on/off/pause/mute etc.). It has been working over a year. It has been working with OH3 as well. Suddenly today I started to get weird error messages in log, but I’m unable to figure out what’s actually wrong.

The error message:
2021-04-13 22:46:16.600 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'BUTTONS-1' failed: An error occurred during the script execution: Could not invoke method: org.openhab.core.model.script.actions.BusEvent.sendCommand(org.openhab.core.items.Item,java.lang.String) on instance: null in BUTTONS

The code:

rule "Red button"

when
    Item ZWaveNode006FGPB101Arealpushbuttonswitchavailableinseveralcolors_SceneNumber received update
then
    logInfo("BUTTONS.rules","Red button pressed. Action: " + ZWaveNode006FGPB101Arealpushbuttonswitchavailableinseveralcolors_SceneNumber.state)
    ButtonAction.sendCommand(ZWaveNode006FGPB101Arealpushbuttonswitchavailableinseveralcolors_SceneNumber.state)
end

I have an item “ButtonAction” (number) created in OH3. Every time the ZWave button get pressed, the state is being send to the “ButtonAction” item. This is done this way, because I have several other buttons doing the same actions. This way there is only one object (ButtonAction) holding the status of the switch.

But today this stopped working.

Any idea what causing this?

  • Platform information:
    • Hardware: RaspberryPI4B
    • OS: Raspbian
    • openHAB version: 3.0.1

This error seems to indicate that there is nothing in ButtonAction, that is, this is not currently a recognized item name and so can’t have sendCommand applied to it. Check to make sure that the ButtonAction item is actually still in your list of item, that you haven’t accidentally deleted it, etc.

No, that’s not it. The item still exists and I can change the value for example from HabPanel and make the action work. It’s only this script which is not currently working correctly and I can’t figure out why is that.

Try making sure that the state you’re sending is cast to a string.

ButtonAction.sendCommand(ZWaveNode006FGPB101Arealpushbuttonswitchavailableinseveralcolors_SceneNumber.state.toString)

By the way, have you tried using the follow profile for this instead of a rule?

It doesn’t make sense to me, how sending a sting to number item would help. I don’t really want to change the code either, since there’s nothing wrong with it. Today I came home from work and tested the buttons. Both working fine. I did nothing to the code. This is not the first time a script stops working while it causes weird log entries.