[SOLVED]
Sorry guys, it was human error…
The webhook posted here is correct…and that’s how it should be…
However I probably got mixed-up somewhere, and what I was creating as a webhook did not look like the webhook posted here.
IMPORTANT:
Managed to learn something new. When trying to send commands to your Philips Hue bridge…You CANNOT use passed on variables in your webhook, such as "{{SPARK_EVENT_VALUE}}"
, because this will send the Philips Hue command in quotations.
Received data [b'{"on":"true"}']
The Hue bridge WILL return an error of the “unknown command” sort if you use "{{SPARK_EVENT_VALUE}}"
, so don’t.
The solution is to create a webhook that has the command that you want to send in it (like the one in this post). Thus, if you want to change the command you have to use a different webhook.
At the same time, the Spark.publish()
command can be re-written like:
Spark.publish("webhook_name"); //where webhook_name is the name of your webhook
Also worth mentioning, "noDefaults":true
is a must. As without it the webhook will inject additional data from your Spark.publish call into your request (just as mentioned in the webhook documentation). So, this will send extra parameters to the Hue bridge which will result in an error being received back.
That’s it. I hope that this helps other people who are trying to control their Philips Hue Lights with their Photon/Core.