Simple rule not working (Value in Null context)

439 views
Skip to first unread message

achse...@gmail.com

unread,
Jan 21, 2015, 7:57:48 AM1/21/15
to
Hi there again.

I got a rule that i dont get working, anoyone got a good idea?

var Timer _timer_005_A = null

rule "Test Down 2"
when
    Item Jalousie5 changed
    or
    Item Licht_Sensor_Tuer changed
then
  if ((Jalousie5.state >= 0)) {
    if ((Licht_Sensor_Tuer.state < 5)) {
      if (_timer_005_A == null) {
        _timer_005_A = createTimer(now.plusSeconds(1)
) [|
          _timer_005_A.cancel()
          _timer_005_A = null
          sendCommand(Jalousie5, OFF)
        ]
      }
    }
    else if(_timer_005_A != null) {
      _timer_005_A.cancel()
      _timer_005_A = null
    }
  }
end



All i get into my log is:

22:18:25.554 ERROR o.o.c.s.ScriptExecutionThread[
:50]- Error during the execution of rule 'Test Down': Cannot assign a value in null context.

I also swapped all the "Null" with "0" but didnt help either


The rule should just check if its dark outside and if the window shutter isnt down already should move it down. Currently the timer is 1 second, should be longer if the rule would be working for sure...

Thank you

Bye

Klaus Maria Pfeiffer

unread,
Jan 24, 2015, 5:31:57 AM1/24/15
to ope...@googlegroups.com, achse...@gmail.com
hi!

Am 2015-01-21 um 13:57 schrieb achse...@gmail.com:
> Error during the execution of rule 'Test Down': Cannot assign a value in
> null context.

could it be that your items Jalousie5 and Licht_Sensor_Tuer are
triggering an other rule at the same time?

have a look at
https://groups.google.com/forum/#!msg/openhab/3OHBFnliUe8/j8Ebx0o6DuMJ

gre3tings, Klaus

--
Klaus Maria Pfeiffer
chat: xmpp:hoedl...@jabber.rekmp.net
blog: http://blog.kmp.or.at/
twitter: @hoedlmoser
pgp: 0xeb7a9021

Alex Karls

unread,
Jan 24, 2015, 6:40:34 AM1/24/15
to achse...@gmail.com
maybe it`s not a problem with the variable. can you ensure that all state values are set and not empty or NULL? sometimes, after a fresh restart of the system, specially without persistence, the values need a trigger to be set. what type of sensors are used? got the same problem once with zwave devices.. keep in mind that new items, rules and sitemaps do a "reset" of states when no persistence model is in use

achse...@gmail.com

unread,
Jan 26, 2015, 5:10:53 PM1/26/15
to ope...@googlegroups.com, achse...@gmail.com, klaus.m....@kmp.or.at
Thank you guys, it was the problem with the double trigger. I only read the beginning and the end of the thread you posted, and saw they were talking about a solution in future. Didnt see they had a good solution in the middle, sorry for that.

Problem solved

Ben Jones

unread,
May 17, 2015, 6:06:18 AM5/17/15
to ope...@googlegroups.com, klaus.m....@kmp.or.at, achse...@gmail.com
This might have now been resolved - https://github.com/openhab/openhab/pull/2363
Reply all
Reply to author
Forward
0 new messages