Thanks to iWPL and mortommy I also use the hue motion with openhab 2, but I have a little difference in the Hue API CLIP debugger:
{"1":{
"state":{
"daylight":null,
"lastupdated":"none"},
"config":{
"on":true,
"configured":false,
"sunriseoffset":30,
"sunsetoffset":-30},
"name":"Daylight",
"type":"Daylight",
"modelid":"PHDL00",
"manufacturername":"Philips",
"swversion":"1.0"},
"2":{
"state":{
"temperature":2101,
"lastupdated":"2016-11-04T16:18:18"},
"config":{
"on":true,
"battery":100,
"reachable":true,
"alert":"none",
"ledindication":false,
"usertest":false,
"pending":[]},
"name":"Hue temperature sensor 1",
"type":"ZLLTemperature",
"modelid":"SML001",
"manufacturername":"Philips",
"swversion":"6.1.0.18912",
"uniqueid":"##:##:##:##:##:##:##:##-##-####"},
"3":{
"state":{
"presence":false,
"lastupdated":"2016-11-04T16:05:19"},
"config":{
"on":true,
"battery":100,
"reachable":true,
"alert":"none",
"ledindication":false,
"usertest":false,
"sensitivity":2,
"sensitivitymax":2,
"pending":[]},
"name":"Wohnzimmer Sensor",
"type":"ZLLPresence",
"modelid":"SML001",
"manufacturername":"Philips",
"swversion":"6.1.0.18912",
"uniqueid":"##:##:##:##:##:##:##:##-##-####"},
"4":{
"state":{
"lightlevel":5864,
"dark":true,
"daylight":false,
"lastupdated":"2016-11-04T16:19:15"},
"config":{
"on":true,
"battery":100,
"reachable":true,
"alert":"none",
"tholddark":65534,
"tholdoffset":7000,
"ledindication":false,
"usertest":false,
"pending":[]},
"name":"Hue ambient light sensor 1",
"type":"ZLLLightLevel",
"modelid":"SML001",
"manufacturername":"Philips",
"swversion":"6.1.0.18912",
"uniqueid":"##:##:##:##:##:##:##:##-##-####"},
"5":{
"state":{
"status":0,
"lastupdated":"2016-11-04T16:08:04"},
"config":{
"on":true,
"reachable":true},
"name":"MotionSensor 3.Companion",
"type":"CLIPGenericStatus",
"modelid":"PHA_STATE",
"manufacturername":"Philips",
"swversion":"1.0",
"uniqueid":"MotionSensor 3.Companion",
"recycle":true}}
so my .items file would be:
String HueMotionEvent "Hue Motion Detected [%s]" <present> (Motion, Sensors) { http="<[http://_HueHubIP_/api/_SecretID_/sensors/3:5000:JS(getHueMotionEvent.js)]" }
DateTime HueMotionEventDate "Hue Motion Detected at [%1$tR]" (Motion, Sensors) { http="<[http://_HueHubIP_/api/_SecretID_/sensors/3:5000:JS(getHueMotionEventDate.js)]" }
Number HueTemp "Hue Temperature [%.1f °C]" (Temp, Sensors) { http="<[http://_HueHubIP_/api/_SecretID_/sensors/2:60000:JS(getHueTemp.js)]" }
DateTime HueTempDate "Hue Temp Date [%1$td.%1$tm.%1$tY %1$tR]" (Motion, Sensors) { http="<[http://_HueHubIP_/api/_SecretID_/sensors/2:5000:JS(getHueTempDate.js)]" }
String HueLight "Hue Light Level [%s]" (LightLevel, Sensors) { http="<[http://_HueHubIP_/api/_SecretID_/sensors/4:60000:JS(getHueLight.js)]" }
String HueDark "Hue Dark [%s]" (LightLevel, Sensors) { http="<[http://_HueHubIP_/api/_SecretID_/sensors/4:5000:JS(getHueDark.js)]" }
String HueDay "Hue Daytime [%s]" (LightLevel, Sensors) { http="<[http://_HueHubIP_/api/_SecretID_/sensors/4:5000:JS(getHueDay.js)]" }
For understanding how the transform for other variables is done I attach my getHueLight.js which is in the transform folder:
(function(i) {
var json = JSON.parse(i);
return ((json['state']['lightlevel']));
})(input)
Some things I had problems with where the following:
Have fun, maybe this helps people with the same issues.