Need help troubleshooting a rule

  • Platform information: Raspberry Pi Nano
    • Hardware: Raspberry Pi Nano
    • OS: Rasbian image from openHABian
    • Java Runtime Environment:Zulu Embedded OpenJDK Java 8
    • openHAB version: 2
  • Issue of the topic: Need help troubleshooting a rule.

I want to setup a rule that uses the presence status on my Philip Hue hub but I can’t get it to trigger reliably. When I change the value on the hub from “true” to “false” and back again using CLIP API Debugger, I see the change in a HABPanel dummy widget as ON or OFF. So I know the Item and Java script is working. But nothing shows up in the log. Then later I see that the rule did work.

  • Please post configurations (if applicable):
    • Items configuration related to the issue
String	HUE_HuePresence_JosephIphone	"HUE_HuePresence_JosephIphone[%s]"	<present>	(gSkur) { http="<[HTTP://10.0.0.126/api/<My API key>/sensors/13:300000:JS(getHuePresense.js)]"}

(function(i) {
    var json = JSON.parse(i);
    return ((json['state']['presence'])) == true ? "TRUE" : "FALSE";
})(input)
  • Sitemap configuration related to the issue n/a

  • Rules code related to the issue

rule "Joseph is away rule"

when
Item HUE_HuePresence_JosephIphone changed   // note, I also tried "received command" here

then
logInfo("Alexa","changed: ")

end

  • Services configuration related to the issue
    hue Binding

No errors in the log when I save the rule:

  • If logs where generated please post these here using code fences:
2018-01-19 13:21:32.296 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'HomeThearter.rules'

The rule seams to be OK.
Post the events.log please.

Hi,
Just to make sure the issue is not caused due to a typo: Is your file named getHuePresense.js or getHuePresence.js?

Kurt

getHuePresense.js is the filename.

The openhab.log says this when I save the rule:

2018-04-07 07:31:28.686 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘AlexaJoseph_is_away_Reminder.rules’

When I change the setting on the hub, nothing gets logged. Then for no reason the following gets logged at other times:

2018-04-06 16:11:28.156 [INFO ] [eclipse.smarthome.model.script.Alexa] - changed:

Events.log:
2018-04-07 08:05:47.545 [vent.ItemStateChangedEvent] - HUE_Presence_Joseph_iPhone changed from OFF to ON

What I just figured out is there is a 4 minute delay between when I change the value on the Hue hub and when the rule runs even though the events.log shows the change right away. That doesn’t happen on other items.