Need help getting Hue Sensors working

  • 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:
    I added Phillip Hue bindings and added all of my lights in PaperUI. Everything works great there.

Now I’m attempting to add Hue Sensors using info from this posting.

Below is a summary of changes made based on that thread. My question is where am I supposed to see the Hue Sensor? I don’t see them in PaperUI: Things or Control. I’ve tested the sensor using these guide https://www.developers.meethue.com/documentation/getting-started. Also in the HabPanel when I add a widget, I see these Items in the drop down:
Skur_HUE_Motion
[] Skur_HUE_Temp

but they don’t do anything.

  • Please post configurations (if applicable):
    I added HTTP binding in PaperUI. I tried searching HTTP in inbox. Nothing.

Javascript Transformation is is installed.

\Rasberry_IP\openHAB2-conf\transform\getHueTemperature.js

(function(i) {
    var json = JSON.parse(i);
    return ((json['state']['temperature']))/100;
})(input)

\Rasberry_IP\openHAB2-conf\transform\getHueMotionEvent.js

(function(i) {
    var json = JSON.parse(i);
    return ((json['state']['presence'])) == true ? "ON" : "OFF";
})(input)

\Rasberry_IP\openHAB2-conf\sitemaps\Hue_Sensors.sitemap (note part of this was from the HomeBuilder site)

sitemap our_home label="Our Home" {
    Frame label="Ground Floor" icon="groundfloor" {
        Group item=GF_Bedroom
        Group item=GF_Downstairs
    }

    Frame label="First Floor" icon="firstfloor" {
        Group item=FF_Bedroom
    }

    Frame {
		Text 	item=Skur_HUE_Temp // Notice that I have the text formatting in my items file.
        }
    }
}

\Rasberry_IP\openHAB2-conf\services\addons.cfg
binding = hue,http1 [edit 01/09/2018] removed quotes from this line (was binding = "hue,http1"
transformation = “javascript” [edit 01/09/2018] removed quotes from this line (was transformation = “javascript”

\Rasberry_IP\openHAB2-conf\services\http.cfg
hueCache.url=HUE_IP/api/secret_key/sensors [edit] 01/08/2018 - I now know this should have been hueCache.url=HTTP://HUE_IP/api/secret_key/sensors
hueCache.updateInterval=3000

\Rasberry_IP\openHAB2-conf\items\Hue_Sensors.items (Note I tried using and not using the hueCache)

Switch 	Skur_HUE_Motion <present>	(gSkur) { http="<[hueCache/19:3000:JS(getHueMotionEvent.js)]" }
Number	Skur_HUE_Temp	"Skur temp [%.2f °C]"	<temperature>	(gSkur) { http="<[hueCache/6:300000:JS(getHueTemperature.js)]" }

PS as this is my first post, Hello and BTW I’m very impressed with everything I’ve seen in openHAB. The setup was a breeze.

  • If logs where generated please post these here using code fences:

The sensors are quite manual. They will show up under items in PaperUI (I think you might have to turn off simple mode to see items). The way I found my way around Hue sensors was by seeing what the commands did. The hue is quite nice in that if you type “hueCache” into a webrowser you should see the outputs.

So first see if you have your Hue details correct so open up the following in a browser. “hueCache” or http://<HUE_IP>/api/<secret_key>/sensors/ That should show you the state of the sensors.

OK, that is a clue. I had enabled simple mode because previous research suggested to enable it (which is what got everything else HUE working). I forgot to mention that above and it wasn’t even mentioned in my reference thread. So I disabled simple mode, now I see [Items] under Configurations, and one of the Sensor items: Skur_HUE_Motion. I don’t see that I an do anything with this. Reading documentation about PaperUI, I understand that it is not yet a replacement for editing text files. Perhaps I shouldn’t expect the Paper UI to work for the Hue Sensors. That’s fine, I can edit text files. But unless I didn’t follow the original thread correctly something’s missing. Assuming I have a typo somewhere for the Skur_HUE_Temp & focusing only on the Skur_HUE_Motion, which at least shows up in the Paper UI, where can I see that I’m reading this sensor? I suspect their is some noob setup step missing.

your item url is wrong

try

Number Skur_HUE_Temp “Skur temp [%.2f °C]” (gSkur) { http="<[http://ip/api/APIKEY/sensors/6:3000:JS(getHueTemperature.js)]" }

the http:// was missing in your url

Please add Code Tags…

your code goes here

hueCache.url=http://HUE_IP/api/secret_key/sensors

secret_key with your personal Key replaced?

Thanks for noticing that. Trying with the missing http:// and yes I have the personal key in there. The developers.meethue.com site documentation makes it easy to see what is going on.

I don’t think I did any code tags. I put everything I did in my original post. Do you mean the .js files? I posted those.

But I think I’ve made progress. With some help identifying the missing http:// in the Item URL & turning off Simple Mode in the System: Item Linking UI, Now I see under Configuration | Items:

Skur temp
Skur_HUE_Tempcontent_copy
Number

and

Skur_HUE_Motion
Switch

When I add these in HabPanel they don’t do anything & I don’t see these as “things” or in the Control of the PaperUI. What I want to do is read the temperature data, motion sensor status, and to turn the motion sensors on and off.

I found some additional errors my \addons.cfg (I edited the original post to reflect those changes).

Now the Skur_HUE_Motion and Skur_HUE_Temp work in the HabPanel.

So it was the missing HTTP in the .items (Thanks piranha & ei_Gelb_Geek) and the aforementioned quotes.

Thank you!!!

Use in your Postings Code Tags :wink: