Actually, if I wasn’t allergic to Java and looked at the openhab binding more I would have noticed the author apparently did reverse engineer all the local commands:
He posted in Ability to control Philips/Wiz Connected WIFI Smart LED lights? a few days ago.
Anyway, I modified [wilvancleve]'s nodeRed flow a bit to just ignore the command passed in the topic so I can send the full params object and use the MQTT template schema to configure the light. For now I think I’ll just do template lights using the smartthings entities I already have setup for these bulbs for state, I mostly wanted the faster response time on the commands. (light.template apparently doesn’t support RGB :()
[
{
"id": "3bfa4c0a.55a6e4",
"type": "tab",
"label": "MQTT to Wiz",
"disabled": false,
"info": ""
},
{
"id": "f8e03d02.b904a",
"type": "json",
"z": "3bfa4c0a.55a6e4",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 310,
"y": 340,
"wires": [
[
"5b5538a.6f768c8"
]
]
},
{
"id": "39ef9bf6.b126f4",
"type": "comment",
"z": "3bfa4c0a.55a6e4",
"name": "Relay MQTT to UDP",
"info": "",
"x": 170,
"y": 260,
"wires": []
},
{
"id": "5b5538a.6f768c8",
"type": "function",
"z": "3bfa4c0a.55a6e4",
"name": "relay to udp",
"func": "// expects the mqtt topic to be wizlight/ip/command\n\nvar command = msg.topic.split(\"/\")[2];\n\nmsg.ip = msg.topic.split(\"/\")[1];\n\nvar obj = {}; \nobj = msg.payload;\n \nvar p = {};\n\nvar pl = {method:\"setPilot\", \n id:527, \n env:\"pro\", \n params : obj};\n\nmsg.payload = pl\n\nmsg.port = 38899\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 490,
"y": 340,
"wires": [
[
"eb39d4e7.006d18"
]
]
},
{
"id": "62afb6be.881218",
"type": "mqtt in",
"z": "3bfa4c0a.55a6e4",
"name": "Wizlight In",
"topic": "wizlight/#",
"qos": "0",
"datatype": "auto",
"broker": "",
"x": 160,
"y": 340,
"wires": [
[
"f8e03d02.b904a"
]
]
},
{
"id": "fae3fd3b.f7733",
"type": "udp out",
"z": "3bfa4c0a.55a6e4",
"name": "UDP auto port/ip",
"addr": "",
"iface": "",
"port": "",
"ipv": "udp4",
"outport": "38899",
"base64": false,
"multicast": "false",
"x": 1070,
"y": 200,
"wires": []
},
{
"id": "eb39d4e7.006d18",
"type": "json",
"z": "3bfa4c0a.55a6e4",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 690,
"y": 340,
"wires": [
[
"6840d6e1.111ea8"
]
]
},
{
"id": "f345a1c5.4bbbf",
"type": "repeat",
"z": "3bfa4c0a.55a6e4",
"name": "Triple It Up",
"repetitions": "3",
"elseOutput": false,
"outputs": 1,
"x": 810,
"y": 200,
"wires": [
[
"fae3fd3b.f7733",
"eb39d4e7.006d18"
]
]
},
{
"id": "6840d6e1.111ea8",
"type": "delay",
"z": "3bfa4c0a.55a6e4",
"name": "",
"pauseType": "delay",
"timeout": "25",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 870,
"y": 340,
"wires": [
[
"f345a1c5.4bbbf"
]
]
}
]
light:
- platform: mqtt
name: "wizbulb MQTT"
schema: template
command_topic: "wizlight/ip_address/set"
command_on_template: >
{"state": true
{%- if brightness is defined -%}
,"dimming": {{ (brightness/254*100)| int }}
{%- endif -%}
{%- if red is defined and green is defined and blue is defined -%}
,"r":{{ red }},"g":{{ green }},"b":{{ blue }}
{%- endif -%}
{%- if color_temp is defined -%}
,"temp":{{ (1000000/color_temp)| int}}
{%- endif -%}
{%- if white_value is defined -%}
,"w":{{ white_value }}
{%- endif -%}
}
command_off_template: '{"state":false}'
#note these are just populated to get the MQTT platform to enable the relevant supported_features, not currently reading state from the bulb
brightness_template: '{{ value_json.dimming }}'
red_template: '{{ value_json.r }}'
green_template: '{{ value_json.g }}'
blue_template: '{{ value_json.b }}'
color_temp_template: '{{ value_json.temp }}'
white_value_template: '{{ value_json.w }}'