IKEA Tradfri Color Changing bulb on Hue Bridge no control of colors

Ah ok. I did it.
But it still does not work. Here the Loog of
tail -500lf /var/log/openhab2/openhab.log
tail -500lf /var/log/openhab2/events.log | grep Schl_Bambus

Can you recognize something unusual?


[21:06:38] Snop007@openHABianPi:~$ tail -500lf /var/log/openhab2/events.log | grep Schl_Bambus
2018-03-07 20:38:11.759 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 4
2018-03-07 20:38:11.772 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 2 to 4
2018-03-07 20:43:40.987 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_brightness' received command 50
2018-03-07 20:43:53.912 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_brightness' received command 50
2018-03-07 20:52:28.960 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_Effect => hue:0200:00178821c409:6:effect' has been removed.
2018-03-07 20:52:28.966 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 20:52:28.973 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_color => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 20:52:28.981 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_Alert => hue:0200:00178821c409:6:alert' has been removed.
2018-03-07 20:52:28.990 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_brightness => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 20:52:29.013 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_colorpicker => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 20:52:29.036 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_Color => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 20:52:29.769 [.ItemChannelLinkAddedEvent] - Link 'Schl_Bambus_bu_brightness-hue:0200:00178821c409:6:color' has been added.
2018-03-07 20:52:29.771 [.ItemChannelLinkAddedEvent] - Link 'Schl_Bambus_bu_colorpicker-hue:0200:00178821c409:6:color' has been added.
2018-03-07 20:52:29.781 [.ItemChannelLinkAddedEvent] - Link 'Schl_Bambus_bu_color-hue:0200:00178821c409:6:color' has been added.
2018-03-07 20:52:30.354 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from NULL to 0.71000000
2018-03-07 20:52:30.487 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_brightness changed from NULL to 0.71000000
2018-03-07 20:52:30.495 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from NULL to 54,100,71
2018-03-07 20:52:35.923 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 9
2018-03-07 20:52:35.944 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 0.71000000 to 9
2018-03-07 20:52:38.725 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command ON
2018-03-07 20:52:38.736 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from 54,100,71 to 54,100,100
2018-03-07 20:52:39.593 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command ON
2018-03-07 20:52:41.159 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command ON
2018-03-07 20:52:42.222 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command OFF
2018-03-07 20:52:42.235 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from 54,100,100 to 54,100,0
2018-03-07 20:52:43.773 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command ON
2018-03-07 20:52:43.784 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from 54,100,0 to 54,100,100
2018-03-07 20:52:46.399 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command ON
2018-03-07 20:52:48.976 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 7
2018-03-07 20:52:48.991 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 9 to 7
2018-03-07 20:52:53.426 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 4
2018-03-07 20:52:53.442 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 7 to 4
2018-03-07 20:55:33.260 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_color => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 20:55:33.272 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_brightness => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 20:55:33.306 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_colorpicker => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 20:55:33.756 [.ItemChannelLinkAddedEvent] - Link 'Schl_Bambus_bu-hue:0200:00178821c409:6:color' has been added.
2018-03-07 20:55:33.776 [.ItemChannelLinkAddedEvent] - Link 'Schl_Bambus_bu_Color-hue:0200:00178821c409:6:color' has been added.
2018-03-07 20:55:33.783 [.ItemChannelLinkAddedEvent] - Link 'Schl_Bambus_bu_brightness-hue:0200:00178821c409:6:color' has been added.
2018-03-07 20:55:33.786 [.ItemChannelLinkAddedEvent] - Link 'Schl_Bambus_bu_Effect-hue:0200:00178821c409:6:effect' has been added.
2018-03-07 20:55:33.790 [.ItemChannelLinkAddedEvent] - Link 'Schl_Bambus_bu_Alert-hue:0200:00178821c409:6:alert' has been added.
2018-03-07 20:55:33.792 [.ItemChannelLinkAddedEvent] - Link 'Schl_Bambus_bu_colorpicker-hue:0200:00178821c409:6:color' has been added.
2018-03-07 20:55:33.796 [.ItemChannelLinkAddedEvent] - Link 'Schl_Bambus_bu_color-hue:0200:00178821c409:6:color' has been added.
2018-03-07 20:55:34.204 [vent.ItemStateChangedEvent] - Schl_Bambus_bu changed from NULL to ON
2018-03-07 20:55:34.209 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from NULL to 0.71000000
2018-03-07 20:55:34.212 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from NULL to 54,100,71
2018-03-07 20:55:34.215 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_Alert changed from NULL to NONE
2018-03-07 20:55:34.233 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_brightness changed from NULL to 0.71000000
2018-03-07 20:55:34.243 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_Color changed from NULL to 54,100,71
2018-03-07 21:03:53.967 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 9
2018-03-07 21:03:53.994 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 0.71000000 to 9
2018-03-07 21:04:13.950 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 5
2018-03-07 21:04:13.975 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 9 to 5
2018-03-07 21:04:21.417 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 6
2018-03-07 21:04:21.448 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 5 to 6
2018-03-07 21:05:42.499 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 4
2018-03-07 21:05:42.537 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 6 to 4
2018-03-07 21:06:56.984 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 3
2018-03-07 21:06:57.009 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 4 to 3
2018-03-07 21:07:08.475 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 5
2018-03-07 21:07:08.538 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 3 to 5
2018-03-07 21:07:19.033 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 7
2018-03-07 21:07:19.045 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 5 to 7
2018-03-07 21:12:54.710 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_Effect => hue:0200:00178821c409:6:effect' has been removed.
2018-03-07 21:12:54.715 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 21:12:54.726 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_color => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 21:12:54.738 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_Alert => hue:0200:00178821c409:6:alert' has been removed.
2018-03-07 21:12:54.741 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_brightness => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 21:12:54.776 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_colorpicker => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 21:12:54.792 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_Color => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 21:16:32.301 [.ItemChannelLinkAddedEvent] - Link 'Schl_Bambus_bu_color-hue:0200:00178821c409:6:color' has been added.
2018-03-07 21:16:32.321 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from NULL to 54,100,71
2018-03-07 21:16:39.163 [temChannelLinkRemovedEvent] - Link 'Schl_Bambus_bu_color => hue:0200:00178821c409:6:color' has been removed.
2018-03-07 21:16:39.224 [.ItemChannelLinkAddedEvent] - Link 'Schl_Bambus_bu_color-hue:0200:00178821c409:6:color' has been added.
2018-03-07 21:16:39.237 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from NULL to 54,100,71
2018-03-07 21:17:03.971 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 4
2018-03-07 21:17:03.996 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from NULL to 4
2018-03-07 21:17:08.457 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 8
2018-03-07 21:17:08.466 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 4 to 8
2018-03-07 21:17:12.451 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 3
2018-03-07 21:17:12.469 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 8 to 3
2018-03-07 21:17:13.937 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command ON
2018-03-07 21:17:13.951 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from 54,100,71 to 54,100,100
2018-03-07 21:17:14.459 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command ON
2018-03-07 21:17:16.314 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command ON
2018-03-07 21:17:17.088 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command OFF
2018-03-07 21:17:17.107 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from 54,100,100 to 54,100,0
2018-03-07 21:17:19.335 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command ON
2018-03-07 21:17:19.342 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from 54,100,0 to 54,100,100
2018-03-07 21:17:23.039 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 6
2018-03-07 21:17:23.058 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 3 to 6
2018-03-07 21:19:18.112 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 4
2018-03-07 21:19:18.134 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 6 to 4
2018-03-07 21:19:24.448 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 9
2018-03-07 21:19:24.471 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 4 to 9
2018-03-07 21:19:25.626 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command ON
2018-03-07 21:19:26.201 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command OFF
2018-03-07 21:19:26.219 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from 54,100,100 to 54,100,0
2018-03-07 21:19:27.290 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command ON
2018-03-07 21:19:27.299 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from 54,100,0 to 54,100,100
2018-03-07 21:19:28.221 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command ON
2018-03-07 21:19:29.237 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command OFF
2018-03-07 21:19:29.255 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from 54,100,100 to 54,100,0
2018-03-07 21:19:30.386 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_color' received command ON
2018-03-07 21:19:30.409 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from 54,100,0 to 54,100,100

Output of

tail -500lf /var/log/openhab2/openhab.log

is missing.

As you see in the event.log, the items are updated with the values from the channel, which is wrong. I assume, you have removed the channels from the items now?

2018-03-07 20:52:30.354 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from NULL to 0.71000000
2018-03-07 20:52:30.487 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_brightness changed from NULL to 0.71000000
2018-03-07 20:52:30.495 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_color changed from NULL to 54,100,71

This indicates, that the dummy item “Schl_Bambus_bu_colorpicker” receives a number and the rule should be triggered

2018-03-07 21:17:23.039 [ome.event.ItemCommandEvent] - Item 'Schl_Bambus_bu_colorpicker' received command 6
2018-03-07 21:17:23.058 [vent.ItemStateChangedEvent] - Schl_Bambus_bu_colorpicker changed from 3 to 6

So it’s necessary, that you update the rules-file with the log entry to show, what happens and if the rule is triggered.

I have removed the channels. But was that it?
Thats the look of tail -500lf /var/log/openhab2/openhab.log

2018-03-07 22:09:25.137 [ERROR] [lipse.smarthome.io.net.exec.ExecUtil] - couldn't execute commandLine '/etc/openhab2/scripts/hue_tradfri_color.sh 6 Schl_Bambus_bu_brightness 9'
java.io.IOException: Cannot run program "/etc/openhab2/scripts/hue_tradfri_color.sh": error=13, Keine Berechtigung
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) ~[?:?]
	at java.lang.Runtime.exec(Runtime.java:620) ~[?:?]
	at java.lang.Runtime.exec(Runtime.java:450) ~[?:?]
	at java.lang.Runtime.exec(Runtime.java:347) ~[?:?]
	at org.eclipse.smarthome.io.net.exec.ExecUtil.executeCommandLine(ExecUtil.java:65) ~[?:?]
	at org.eclipse.smarthome.model.script.actions.Exec.executeCommandLine(Exec.java:43) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1085) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1060) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:991) ~[?:?]
	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:141) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:901) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:864) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:223) ~[?:?]
	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:215) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:446) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:227) ~[?:?]
	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:215) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:189) ~[?:?]
	at org.eclipse.smarthome.model.script.runtime.internal.engine.ScriptImpl.execute(ScriptImpl.java:82) ~[?:?]
	at org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl.lambda$2(RuleEngineImpl.java:343) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.io.IOException: error=13, Keine Berechtigung
	at java.lang.UNIXProcess.forkAndExec(Native Method) ~[?:?]
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:247) ~[?:?]
	at java.lang.ProcessImpl.start(ProcessImpl.java:134) ~[?:?]
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ~[?:?]
	... 33 more


It works​:+1::ok_hand:. Thank you very much!!!

I assume, it was a missing executable flag?

After I executed these commands, it went now

chown openhab.openhab /etc/openhab2/scripts/hue_tradfri_color.sh
chmod 770 /etc/openhab2/scripts/hue_tradfri_color.sh

Hello, I would add a second lamp now. Do I have to supplement the rules.rules only with the second lamp?

Does a second script have to be made from hue_tradfri_color.sh as hue_tradfri_color1.sh?

Can you recommend a script editor for Mac?

Thanks a lot

Hello,
based on the workaround from ei_Gelb_Geek I created a script where it is possible to use the colorpicker. It’s not perfect, but in many cases the bulb takes on the color I picked in OH.
The script takes the HSB value as input, translates it into RGB, then XYZ and finally into xy.

#!/bin/bash

# -- $1 = Bulb ID -- $2 = HSB Value           

openhab_ip="192.168.xxx.xxx:80"
rest_api="yyy"     --api key 

#Functions
function round_down {
    echo $(printf %.$2f $(echo "scale=$2;(((10^$2)*$1))/(10^$2)" | bc))
};

function inverse_rgb {
    if (( $(echo "$1 < 0.04045" | bc -l) ));
    then
        echo $(bc <<< "scale=9; $1/12.92")
    else
        echo $(bc -l <<< "scale=9; e(2.4*l(($1+0.055)/1.055))")
    fi
};


#1 convert HSB to RGB
IFS=',' read -r -a HSBarray <<< "$2"

H=${HSBarray[0]}
S=${HSBarray[1]}
B=${HSBarray[2]}
    #echo "HSB:"$H, $S, $B

H=$(bc <<< "scale=9; $H/360")
B=$(bc <<< "scale=9; $B/100")
S=$(bc <<< "scale=9; $S/100")
    #echo "HSB:"$H, $S, $B

i=$(bc <<< "scale=9; $H*6")
i=$(round_down $i 0);
    #echo $i
f=$(bc <<< "scale=9; $H*6-$i")
    #echo $f
p=$(bc <<< "scale=9; $B*(1-$S)")
    #echo $p
q=$(bc <<< "scale=9; $B*(1-$f*$S)")
    #echo $q
t=$(bc <<< "scale=9; $B*(1-(1-$f)*$S)")
    #echo $t
icase=$(bc <<< "scale=0; $i%6")
    #echo $icase
case "$icase" in
"0")
    r=$B
    g=$t
    b=$p
    ;;
"1")
    r=$q
    g=$B
    b=$p
    ;;
"2")
    r=$p
    g=$B
    b=$t
    ;;
"3")
    r=$p
    g=$q
    b=$B
    ;;
"4")
    r=$t
    g=$p
    b=$B
    ;;
"5")
    r=$B
    g=$p
    b=$q
    ;;
esac
    #echo $r, $g, $b
R=$(bc <<< "scale=9; $r*255")
G=$(bc <<< "scale=9; $g*255")
B=$(bc <<< "scale=9; $b*255")
    #echo $R, $G, $B

#2 convert RGB to XYZ
    #2a Inverse sRGB Companding
r=`inverse_rgb $r`
g=`inverse_rgb $g`
b=`inverse_rgb $b`
#echo $r, $g, $b

    #2b RGB Matrix Calculation
m1[0]=0.4124564
m1[1]=0.3575761
m1[2]=0.1804375
m2[0]=0.2126729
m2[1]=0.7151522
m2[2]=0.072175
m3[0]=0.0193339
m3[1]=0.119192
m3[2]=0.9503041
rgb[0]=$r
rgb[1]=$g
rgb[2]=$b

X=0
for (( c=0; c<3; c++ ));
do
   X=$(bc <<< "scale=9; $X+${m1[$c]}*${rgb[$c]}")
done
Y=0
for (( c=0; c<3; c++ ));
do
   Y=$(bc <<< "scale=9; $Y+${m2[$c]}*${rgb[$c]}")
done
Z=0
for (( c=0; c<3; c++ ));
do
   Z=$(bc <<< "scale=9; $Z+${m3[$c]}*${rgb[$c]}")
done
    #echo $X, $Y, $Z

#3 convert XYZ to xy
x=$(bc <<< "scale=9; $X/($X+$Y+$Z)")
y=$(bc <<< "scale=9; $Y/($X+$Y+$Z)")
    #echo $x, $y
x="0"$x
y="0"$y

#4 Send via RestAPI
curl -s -H  "Accept: application/json" -X PUT --data '{ "on": true, "xy": ['"$x"','"$y"']}' http://$openhab_ip/api/$rest_api/lights/$1/state

2 Likes

Visual Studio Code is also for Mac btw … :wink:

I’m experiencing another issue, please, owners of the same Tradfri colour bulb + Hue hub, confirm.

If I change colors via Hue app, the Philips bulb maintains the selected color forever, the Tradfri bulb after a while changes automatically to white (as the bulb at a certain point in time from colour bulb becomes white bulb only … but if you change again the color via Hue app, no issues at all … till next “reset”).

Can you please double-check? idea is to set both Tradfri colour bulb and one Hue product with a color, then leave both lamps ON for a while.

Please let me know if you have the same issue.
thanks

Andrea

Hi,

yes I faced the exact same behaviour.

I always thought this was some kind of “power cut” that happenes in my electricity environment.
It is like you would just really shortly turn off the light.
When turning it off and on it is always just white.

Could someone check if this also happens with the tradfri bridge?

I didn’t see the same behavior with Tradfri bridge before … Actually, today I’ve tested again the issue, and never happened (at least in the last 5 hours).

mmm … :slight_smile:

I can confirm this behavior.

Just bought three Tradfri bulbs. The two color bulbs do not work with Hue. Firmware is 1.3.002

Hi guys,

now i bought a tradfri gatewa and a remote control and another new bulb. Now i am running OH 2.5 M2 and my bulbs are upgraded to firmware 1.3.009 and color control is working now.

Thomas

@Jens_Schanz how can i use dynamic variables instead of static ones, ie, how can i replace the rules execute command (executeCommandLine("/etc/openhab2/scripts/hue_tradfri_color.sh 6 Schl_Bambus_bu_brightness " + Schl_Bambus_bu_colorpicker.state)) in the script for the number of the specific bulb, and the color that i picked in ColorPicker?

Hi,

as I know the script isn’t necessary anymore.
In OpenHAB >2.5 everything works out of the box.

If you want to use the script, please have a look at IKEA Tradfri Color Changing bulb on Hue Bridge no control of colors
@DomDom16 maybee has the solution for your problem.

Rgrds
Jens

Yep. That is the script i’ve been using. It works perfecty form the command line. I would like to know please, how to pass the values form color picket into the comand line.
I don’t know much about the internals of openhab to know how to obtain a variable within a colorpicker and then to pass it to the script.
Can you help me please?

But with 1.3.002 is still not working?

While Ikea bulbs don’t have this issue anymore with newer firmware, this issue still is the case for Müller tint and LivarnoLux (Lidl) bulbs.

I can change the colors in the Hue and Hue Essentials app. I can not change them in OpenHAB.

Well, that’s not entirely true.

If I select a color in the app, then OpenHAB can change the colors, but I can not select warm white tones.
If I select a warm-white tone in the app, then OpenHAB can change the warm-white tone, but can not select colors.

This is the case for both above brands of bulbs, connected to a Philips Hue hub, using OpenHAB 2.5.12

/M