Error assign a value to null

Hi,

I just added a String Item and a DateTime Item, and in a rule, I want to set the string, and date to actual date.
I get the error:
Script execution of rule with UID ‘catEventListener-1’ failed: An error occurred during the script execution: Cannot assign a value in null context. in catEventListener

Is that correct:
Anwesend is my String and LastSeen my DateTime

       Anwesend_Online = "auswärts"
        LastSeen.postUpdate(now.toLocalDateTime.toString)

I think the date should work, but the Anwesend_Online is not initalized. how can I do this to avoid the error message above?
Thanks,
Klaus

We need lots more detail. Which version of OH?

Logs? It’s very helpful to see the full error in context.

How did you create the rule? Show the full code for the rule (if created in the UI, click the “Code” tab and past the YAML you see there here

Openhab 3 stable, rules file manually created.
I have already the solution:

       Anwesend_Online.postUpdate("auswärts")
        LastSeen.postUpdate(now.toLocalDateTime.toString)

and for an Switch you have to change this way:

SwitchItemName.postUpdate(OFF)

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.