But it should be solved now. Test it.
This means that Casambi, via Homebridge, has a range from CoolWhite (222) to WarmWhite (454) of 232 steps.
As Domoticz uses from 0-255 I have stretched the range, if the data is going from Casambi to Domoticz a little and squeezed it, when it goes from Domoticz to Casambi.
You will find the complete flow below, but it is somewhat modified, compared with the previous one.
I will explain a little.
The top flow is for Casambi to Domoticz, only for dimmable lights, while the flow in the middle has the extra possibility for the color temperature.
There is no flow for color (RGB) lamps. If you need that, it has to be made.
I made the flows somewhat universal.
As I understand you can connect only one device to the Homebridge node, called Choose accessory/service"
In the change node, called "Set topic" I have set the IDX number (in Domoticz) as topic.
So you can connect multiple "Dimmable lamp + Set topic" combinations to the Function node.
So you have to modify the change node and set your own Domoticz IDX.
Of course you might have to modify the MQTT nodes.
For the flow, used from Domoticz, you have to set the IDX in the switch node, called "Filter Idx".
You can expand the switch node to, as many lamps as you have.
You have to copy the "Function" and "Homebridge" node, but be carefully that you copy the right combination for your lamp.
The top is for dimmable lights only, while the bottom has the color temperature option.
If it is to your satisfaction, you can remove all debug (green) nodes and the 2 inject (grey) nodes.
Code: Select all
[{"id":"1bc01ca7.84b35b","type":"hb-event","z":"d5124b20.0bd73","name":"","Homebridge":"","Manufacturer":"","Service":"","device":"","conf":"ad94f0af.d9b61","x":210,"y":100,"wires":[["1e59e9f8.5e134e"]]},{"id":"13ed1826.3acc98","type":"inject","z":"d5124b20.0bd73","name":"Dimmable Lamp","props":[{"p":"payload"},{"p":"topic","v":"22","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"On\":true,\"Brightness\":70}","payloadType":"json","x":240,"y":160,"wires":[["dc14e084.45a228","35a3d452.9a70bc"]]},{"id":"5f7466a6.2b332","type":"debug","z":"d5124b20.0bd73","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":220,"wires":[]},{"id":"dc14e084.45a228","type":"function","z":"d5124b20.0bd73","name":"","func":"if (msg.payload.On === true)\n\n{\n msg.payload = {\n \"command\": \"switchlight\",\n \"idx\": msg.topic,\n \"switchcmd\": \"Set Level\",\n \"level\": msg.payload.Brightness\n }\n}\n\nelse if (msg.payload.On === false)\n\n{\n msg.payload = {\n \"command\": \"switchlight\",\n \"idx\": msg.topic,\n \"switchcmd\": \"Off\",\n };\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":160,"wires":[["5f7466a6.2b332","569d39cb.d79c68"]]},{"id":"4b0c5fb4.e0158","type":"function","z":"d5124b20.0bd73","name":"","func":"if (msg.payload.On === true)\n{\n msg.payload = {\n \"command\": \"setcolbrightnessvalue\",\n \"idx\": msg.topic,\n \"brightness\": msg.payload.Brightness,\n \"color\": {\n \"m\": 2,\n \"t\": parseInt((msg.payload.ColorTemperature -222) * (255/232))\n }\n }\n} \nelse if (msg.payload.On === false)\n{\n msg.payload = {\n \"command\": \"switchlight\",\n \"idx\": msg.topic,\n \"switchcmd\": \"Off\"\n };\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":340,"wires":[["40e4b0fb.b1c758","1caf3621.faef12"]]},{"id":"569d39cb.d79c68","type":"mqtt out","z":"d5124b20.0bd73","name":"Domoticz In","topic":"domoticz/in","qos":"","retain":"","broker":"c2d9657a.d81bf8","x":630,"y":160,"wires":[]},{"id":"35a3d452.9a70bc","type":"debug","z":"d5124b20.0bd73","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":220,"wires":[]},{"id":"f7cae54f.ce536","type":"inject","z":"d5124b20.0bd73","name":"Dimmable Lamp +Temp","props":[{"p":"payload"},{"p":"topic","v":"23","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"On\":true,\"Brightness\":50,\"ColorTemperature\":454}","payloadType":"json","x":220,"y":340,"wires":[["368e6d35.53640a","4b0c5fb4.e0158"]]},{"id":"368e6d35.53640a","type":"debug","z":"d5124b20.0bd73","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":400,"wires":[]},{"id":"40e4b0fb.b1c758","type":"debug","z":"d5124b20.0bd73","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":400,"wires":[]},{"id":"1caf3621.faef12","type":"mqtt out","z":"d5124b20.0bd73","name":"Domoticz In","topic":"domoticz/in","qos":"","retain":"","broker":"c2d9657a.d81bf8","x":630,"y":340,"wires":[]},{"id":"764137d0.7ee2f","type":"mqtt in","z":"d5124b20.0bd73","name":"Domoticz Out","topic":"domoticz/out","qos":"2","datatype":"json","broker":"c2d9657a.d81bf8","x":130,"y":562,"wires":[["c218839c.7b098"]]},{"id":"9167765.52c4f08","type":"debug","z":"d5124b20.0bd73","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":482,"wires":[]},{"id":"c218839c.7b098","type":"switch","z":"d5124b20.0bd73","name":"Filter Idx","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"22","vt":"str"},{"t":"eq","v":"23","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":562,"wires":[["c4df2cec.242588"],["c639dbd.b51c8a8","34360a5e.048fde"]]},{"id":"c4df2cec.242588","type":"function","z":"d5124b20.0bd73","name":"","func":"switch (msg.payload.nvalue) {\n \n case 0: //Uit\n msg.payload = {\"On\":false,\"Brightness\":0};\n break;\n\n case 1: //Aan\n case 2: //Dimmer stand\n msg.payload = {\"On\":true,\"Brightness\":parseInt(msg.payload.svalue1)};\n break;\n\n \n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":522,"wires":[["9167765.52c4f08","b01aad6.2c131d"]]},{"id":"b01aad6.2c131d","type":"hb-control","z":"d5124b20.0bd73","name":"","Homebridge":"","Manufacturer":"","Service":"","device":"","conf":"361f342f.410a7c","x":730,"y":522,"wires":[]},{"id":"52348e9f.df7248","type":"debug","z":"d5124b20.0bd73","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":662,"wires":[]},{"id":"34360a5e.048fde","type":"debug","z":"d5124b20.0bd73","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":510,"y":662,"wires":[]},{"id":"c639dbd.b51c8a8","type":"function","z":"d5124b20.0bd73","name":"","func":"switch (msg.payload.nvalue) {\n \n case 0: //Uit\n msg.payload = {\"On\":false,\"Brightness\":0};\n break;\n \n case 1: //Aan\n case 10: //Color Temperature\n case 15: //Dimmer stand\n msg.payload = {\"On\":true,\"Brightness\":parseInt(msg.payload.svalue1),\"ColorTemperature\":parseInt((msg.payload.Color.t) * (232/255) + 222)};\n break;\n\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":602,"wires":[["52348e9f.df7248","c5dd41b3.9f6b28"]]},{"id":"c5dd41b3.9f6b28","type":"hb-control","z":"d5124b20.0bd73","name":"","Homebridge":"","Manufacturer":"","Service":"","device":"","conf":"361f342f.410a7c","x":730,"y":602,"wires":[]},{"id":"22f1313.67945ce","type":"hb-event","z":"d5124b20.0bd73","name":"","Homebridge":"","Manufacturer":"","Service":"","device":"","conf":"ad94f0af.d9b61","x":210,"y":280,"wires":[["3de8f322.a34b6c"]]},{"id":"1e59e9f8.5e134e","type":"change","z":"d5124b20.0bd73","name":"Set topic","rules":[{"t":"set","p":"topic","pt":"msg","to":"22","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":100,"wires":[["dc14e084.45a228"]]},{"id":"3de8f322.a34b6c","type":"change","z":"d5124b20.0bd73","name":"Set topic","rules":[{"t":"set","p":"topic","pt":"msg","to":"23","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":280,"wires":[["4b0c5fb4.e0158"]]},{"id":"ad94f0af.d9b61","type":"hb-conf","z":"","username":"12345"},{"id":"c2d9657a.d81bf8","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"361f342f.410a7c","type":"hb-conf","z":"","username":"12345"}]
Awaiting your test result.