JSR223 Jython unset item

Hello,

I’m in the process of translating my rules from rules DSL to JSR 223 Jython.
Now I need a little support.
In one rule I need to unset an item under certain conditions. I tried the following:
sendCommandCheckFirst("itemName", UNDEF)
and also
sendCommandCheckFirst("itemName", NULL)
but both do not work.

Both result in an error
TypeError: sendCommand(): 2nd arg can't be coerced to String, java.lang.Number, org.eclipse.smarthome.core.types.Command

How can I accieve, what I’m trying in jython?

Best regards
Sven

Pass them as Strings. But you’ll run into another error. You cannot command an Item to NULL or UNDEF, only update.

postUpdateCheckFirst("itemName", "UNDEF")
postUpdateCheckFirst("itemName", "NULL")
1 Like

Hello Rich,

thank you for your fast response, it was really helpful.
Also your 9 episodes “Journey to JSR223 Python” was inspiring to me.

Best regards
Sven