Automatically created objects by a Philips Hue v1 App

These are the scenes that are created automatically by a Philips Hue v1 (bridge v1) App. They look suspiciously simple.

{
 "scenes": {
 "C2gX9ZsFSLMydOt": {
 "name": "Relax",
 "lights": [
 "1"
 ],
 "owner": "xxx",
 "recycle": false,
 "locked": false,
 "appdata": {
 "version": 1,
 "data": "cU9We_r01_d01"
 },
 "picture": "",
 "lastupdated": "2019-12-16T17:33:52",
 "version": 2
 },
 "R-tUrp2kHUfVJWS": {
 "name": "Read",
 "lights": [
 "1"
 ],
 "owner": "xxx",
 "recycle": false,
 "locked": false,
 "appdata": {
 "version": 1,
 "data": "W2dMg_r01_d02"
 },
 "picture": "",
 "lastupdated": "2019-12-16T17:33:54",
 "version": 2
 },
 "h-RPB4RxcyrQDCI": {
 "name": "Concentrate",
 "lights": [
 "1"
 ],
 "owner": "xxx",
 "recycle": false,
 "locked": false,
 "appdata": {
 "version": 1,
 "data": "Droce_r01_d03"
 },
 "picture": "",
 "lastupdated": "2019-12-16T17:33:54",
 "version": 2
 },
 "kWUGFVk5Gkg-XET": {
 "name": "Energize",
 "lights": [
 "1"
 ],
 "owner": "xxx",
 "recycle": false,
 "locked": false,
 "appdata": {
 "version": 1,
 "data": "tQhCU_r01_d04"
 },
 "picture": "",
 "lastupdated": "2019-12-16T17:33:54",
 "version": 2
 },
 "LnVW3KduPhXCJlU": {
 "name": "Bright",
 "lights": [
 "1"
 ],
 "owner": "xxx",
 "recycle": false,
 "locked": false,
 "appdata": {
 "version": 1,
 "data": "CoTkg_r01_d05"
 },
 "picture": "",
 "lastupdated": "2019-12-16T17:33:54",
 "version": 2
 },
 "fvS98qg-kFYxs2u": {
 "name": "Dimmed",
 "lights": [
 "1"
 ],
 "owner": "xxx",
 "recycle": false,
 "locked": false,
 "appdata": {
 "version": 1,
 "data": "AsAn0_r01_d06"
 },
 "picture": "",
 "lastupdated": "2019-12-16T17:33:54",
 "version": 2
 },
 "8kz7tFP9mqkRyg2": {
 "name": "Nightlight",
 "lights": [
 "1"
 ],
 "owner": "xxx",
 "recycle": false,
 "locked": false,
 "appdata": {
 "version": 1,
 "data": "zF0lY_r01_d07"
 },
 "picture": "",
 "lastupdated": "2019-12-16T17:33:54",
 "version": 2
 },
 "McJwqpyji8vD7OS": {
 "name": "Savanna sunset",
 "lights": [
 "1"
 ],
 "owner": "xxx",
 "recycle": false,
 "locked": false,
 "appdata": {
 "version": 1,
 "data": "jhaQr_r01_d15"
 },
 "picture": "",
 "lastupdated": "2019-12-16T17:33:54",
 "version": 2
 },
 "MMPiGjG4skqYWI1": {
 "name": "Tropical twilight",
 "lights": [
 "1"
 ],
 "owner": "xxx",
 "recycle": false,
 "locked": false,
 "appdata": {
 "version": 1,
 "data": "AEgR2_r01_d16"
 },
 "picture": "",
 "lastupdated": "2019-12-16T17:33:54",
 "version": 2
 },
 "eHtlKrxQ8QJY50C": {
 "name": "Arctic aurora",
 "lights": [
 "1"
 ],
 "owner": "xxx",
 "recycle": false,
 "locked": false,
 "appdata": {
 "version": 1,
 "data": "zWOx5_r01_d17"
 },
 "picture": "",
 "lastupdated": "2019-12-16T17:33:54",
 "version": 2
 },
 "kLbjwM-78e8Eawz": {
 "name": "Spring blossom",
 "lights": [
 "1"
 ],
 "owner": "xxx",
 "recycle": false,
 "locked": false,
 "appdata": {
 "version": 1,
 "data": "io4hD_r01_d18"
 },
 "picture": "",
 "lastupdated": "2019-12-16T17:33:54",
 "version": 2
 }
 }
}

as well as the rules created for a Philips Hue Tap

{
 "rules": {
 "1": {
 "name": "Tap 2.3",
 "owner": "xxx",
 "created": "2019-08-06T18:10:07",
 "status": "enabled",
 "recycle": false,
 "conditions": [
 {
 "address": "/sensors/2/state/lastupdated",
 "operator": "dx"
 },
 {
 "address": "/sensors/2/state/buttonevent",
 "operator": "eq",
 "value": "17"
 }
 ],
 "actions": [
 {
 "address": "/groups/1/action",
 "method": "PUT",
 "body": {
 "scene": "LnVW3KduPhXCJlU"
 }
 }
 ]
 },
 "2": {
 "name": "Tap 2.1",
 "owner": "xxx",
 "created": "2019-08-06T18:10:07",
 "status": "enabled",
 "recycle": false,
 "conditions": [
 {
 "address": "/sensors/2/state/lastupdated",
 "operator": "dx"
 },
 {
 "address": "/sensors/2/state/buttonevent",
 "operator": "eq",
 "value": "34"
 }
 ],
 "actions": [
 {
 "address": "/groups/1/action",
 "method": "PUT",
 "body": {
 "on": false
 }
 }
 ]
 },
 "3": {
 "name": "Tap 2.2",
 "owner": "xxx",
 "created": "2019-08-06T18:10:07",
 "status": "enabled",
 "recycle": false,
 "conditions": [
 {
 "address": "/sensors/2/state/lastupdated",
 "operator": "dx"
 },
 {
 "address": "/sensors/2/state/buttonevent",
 "operator": "eq",
 "value": "16"
 }
 ],
 "actions": [
 {
 "address": "/groups/1/action",
 "method": "PUT",
 "body": {
 "scene": "LnVW3KduPhXCJlU"
 }
 }
 ]
 },
 "4": {
 "name": "Tap 2.4",
 "owner": "xxx",
 "created": "2019-08-06T18:10:07",
 "status": "enabled",
 "recycle": false,
 "conditions": [
 {
 "address": "/sensors/2/state/lastupdated",
 "operator": "dx"
 },
 {
 "address": "/sensors/2/state/buttonevent",
 "operator": "eq",
 "value": "18"
 }
 ],
 "actions": [
 {
 "address": "/groups/1/action",
 "method": "PUT",
 "body": {
 "scene": "LnVW3KduPhXCJlU"
 }
 }
 ]
 }
 },
 "sensors": {
 "2": {
 "state": {
 "buttonevent": 34,
 "lastupdated": "2019-08-06T18:11:03"
 },
 "config": {
 "on": true
 },
 "name": "Living switch",
 "type": "ZGPSwitch",
 "modelid": "ZGPSWITCH",
 "manufacturername": "Philips",
 "uniqueid": "00:00:00:00:00:45:01:02-03"
 }
 }
}

Looking inside a Hue E27 bulb

I just stumbled upon this site, where fred27 have disassembled a White E27 bulb.

Part of his findings (everything below is his):

Onboard you’ll find the largest IC is a SAM21R21E18A. This is a nice 32-bit ARM microcontroller with built-in Zigbee. It’s the brains and communications for the device.

There are a number of test point accessible on the underside of the PCB. It took a fair bit of following traces, checking continuity with a multimeter and probing with an oscilloscope, but I managed to work out what many of these were for. This is what I found:

TP1 – Ground
TP2 – SWCLK
TP3 – SWDIO
TP4 – Serial TX
TP5 – Serial RX
TP6 – LED output (about 32V)
TP7 – Regulated 3.3V power to microcontroller
TP8 – RESET
TP11 – Ground
TP25 – power supply to LM2204 regulator

So there a number of interesting signal here. TP1 and TP11 are the signal ground for the microcontroller and logic circuitry. TP7 is the regulated supply voltage.

SWCLK (TP2), SWDIO (TP3) and RESET (TP8) are interesting. You’d need these if you want to load new firmware onto the microcontroller or debug it. Interesting stuff, but this is arguably starting to head over the ethical line of hacking. It’s more complicated than we need anyway.

The serial port (TP4 and TP5) are also interesting. You see some debug output on TP4 as the device powers up. Nothing as you use the device and switch the bulb on and off so not much use to us. Once again, more complicated than we need. If you want to take a look, it’s 3.3V TTL 115200 8N1.

I told you it was possible to play around with the device safely, and it is. NEVER power your device from the mains whilst poking around. If you have a clean 3.3V supply you can connect that to TP7 and power the device that way. Better still is to supply a slightly higher voltage to TP25. It’s usually at about 24V but even 5V (e.g. from a USB charger) will do the job. You might not be able to light up the LED board but it will connect to you Hue hub. At this voltage but you will be able to look at signals, but most importantly you’ll be able to do it safely.

Setting up a Hue Tap Switch

Update 2019-12-08: While the bridge until now has ignored all attempts from me to pair the Tap Switch, it suddenly changed its opinion after it was restarted recently.

After the restart, the bridge paired with the Tap Switch immediately (empty POST to /sensors, press button on Tap Switch according to Zigbee-channel for 10+ seconds while monitoring pairing via GETs to /sensors/new)

The bridge detected the Tap

{
 "8": {
 "name": "Hue tap switch 1"
 },
 "lastscan": "2019-12-08T12:01:29"
}

and added this config to /sensors

{
 "state": {
 "buttonevent": null,
 "lastupdated": "none"
 },
 "config": {
 "on": true
 },
 "name": "Hue tap switch 1",
 "type": "ZGPSwitch",
 "modelid": "ZGPSWITCH",
 "manufacturername": "Philips",
 "uniqueid": "00:00:00:00:00:45:xx:xx-xx"
}

After it was added, it detected the first buttonpress without issues (event 34), but since then absolutely NO buttonpresses on the Tap switch have been registered on the bridge. No idea why.

I have tried pressing hard and softer (always click’ing), long and doubled – all to no effect.


Original pairing instructions

I tried to follow instructions from here

Reddit

Following instructions, holding button down for 10+ seconds, then click again to “verify the switch works” and nothing happens.

On this video, it works

Which button to hold depends on your ZigBee channel:

  • ZigBee channel: 11 = button 1
  • ZigBee channel: 15 = button 2
  • ZigBee channel: 20 = button 3
  • ZigBee channel: 25 = button 4

Any device has to initially be within 1 metre of the bridge to first pair it.

and from here

Reddit
Button 3 depressed for 10 seconds puts them in pairing mode.
The TAP switch doesn’t need to be reset, it is using Zigbee Green Power protocol and to reconnect it with another Hue bridge you just have to follow the commision instuctions in the Hue app to pair it with another Hue bridge……

It cannot connect directly to Smart Things Hub, because that one doesn’t support Zigbee Green Power protocol (yet?).


9to5mac
Cnet
huetips


Dissecting the Hue Tap Switch


No constant connection and some Zigbee discussions


https://huetips.com/tutorials/how-to-add-a-hue-tap/#b57845a1eb852f4b2

Press and hold for 10 seconds the button it tells you to on the screen. The button will be different every time you connect a new Hue Tap. Make sure you press down hard enough to where the Tap makes a click sound.

The hue tap uses a zigbee transmitter like your bulbs, make sure you are within a few feet of your bridge and are pressing down the button all the way until it clicks and hold it for 10 or 12 seconds.


Philips Hue – Simple Control page

I have been looking for a simple control-page for Philips Hue lights for several reasons. I really do not like the app and not the least that you are only able to control the Hue lights from the two main “smart”phone brands. Secondly, if you want a control-panel in the livingroom, you primarily want the simple actions – turn on and off with an immediately recognizable functionality.

Inspired by this work, the download is sadly not available any more.

I have made a similar page, which can be downloaded here.

Inside the .html file, you only have to modify these two lines

 bridge='10.0.0.1' // Set ip-address or DNS name of your Hue bridge 
 hash='Hue user-hash' // Set the username-hash which is registered on the Hue Bridge

To use it, you can either run it directly for your own pc, or place it on a server inside your own network.

Controlling non-reachable Philips Hue Lights

Like so many others, I am from time to time affected by my lights going non-reachable.

Even when the light is “reachable”: false, the light is surprisingly still controllable by the hue bridge (if you specifically ask the bridge to eg. turn the light on via the Hue API)

It is somewhat strange, how the bridge can do that, if it thinks that the light is not reachable. It is of course possible, that it just send the command in the blind.

But what sadly does not work, are the rules and the schedules, which only (seem to) work on “reachable”: true lights.

I have not found any way to make rules work on non-reachable lights, but schedules works just fine, if you just add the light to a group, and make the schedule operate on the group in stead.

For instance:
Make a group:

{
  "lights": [
    "9"
  ],
  "name": "SpecialLights",
  "type": "LightGroup"
}

the group were created with id “5”

Make a schedule on the group:

{
  "name": "SpecialLight-On-18",
  "description": "SpecialLight on around 18",
  "command": {
    "address": "/api/<apikey>/groups/5/action",
    "body": {
      "on": true
    },
    "method": "PUT"
  },
  "localtime": "W127/T18:01:00A00:16:00"
}

Now the schedules work just fine – even when the light is “reachable”: false

[srs_total_visitors]

Add Hue lights by serial no

It can be a pain to add new devices to Philips Hue – it takes quite some time and sometimes, it does not seem to want to work – even with “touchlink”.

Anyhow, it is always nice to have an alternative, and in the Hue app, you can also add devices by serial-number. But how does this work with the Hue API?.

This Reddit page suggest you can add lights using the Hue API by sending

{“deviceid”:[“SN”,”SN”,”SN”,”SN”,”SN”,”SN”,”SN”,”SN”,”SN”,”SN”]}

with most likely PUT (but it may be POST)

it is not clear, which object the json should be PUT to


This page says that you can POST this Json
{“deviceid”: “light_id”}
(…where light_id is the serial number printed on the side of the Hue bulb.) to this object
/api/[hash]/lights


drashsmith.com


After a little trial-and-error, I get an error if I try to either PUT or POST on the root object (ie http://[ip-address]/api/[username]) saying that neither PUT nor POST were accessible on this object.
PUT was also not accessible on the “lights” object, but when trying to POST “{“deviceid”:[“SN1″,”SN2″]}” to the lights object (http://[ip-address]/api/[username]/lights), I got this reply

[
{
“error”: {
“type”: 7,
“address”: “/lights/deviceid”,
“description”: “invalid value, SN1, for parameter, deviceid”
}
}
]

which seems to suggest, that the serials for new devices should be POST’ed to the “lights” object. When I try to post the same Json to the “sensors” object, I get the same error, but I am not sure, that you can use the same method for the “sensors” object – I cannot seem to find serials on my sensors.

Happy hunting.

[srs_total_visitors]

Philips Hue bridge – Cannot find a new bulb

When you buy a Philips Hue kit like the Dimmer with an extra bulb, the bulb is already linked to the dimmer. This means, that the bridge cannot find this bulb. First you have to instruct the bridge to takeover a bulb (from another bridge, a dimmer or similar), before it can be added.

This information is for the version 1 of the bridge (the round one), but I believe that method 2 also works for the newer bridge

There are 2 methods for doing this – depending on the version of the bridge firmware. In both cases, start by placing the bulb immediately next to the bridge (like 30 cm.)

  1. for older firmwares, telnet to port 30000 on the bridge and type
    [Link,Touchlink]
    and stop the telnet
  2. for newer firmwares, use your own code or the CLIP debugger and on the
    http://<ip>/api/<username>/config
    object, PUT the value
    {“touchlink”:true}

In both cases, the bulb should blink to signal that it can now be seen by the new bridge. Now you can use normal methods (like the app, CLIP debugger or own code) to link the bulb to the bridge.

Do not copy/paste the texts from above, since this will often result in “body contains invalid json” error messages. Type them by hand.

The same problem occurs, if you want to move the bulbs from one bridge to another without using the official app

To use the clip-debugger, you need to first find the ip-address of your hue-bridge, and then enter the url below into a browser
http://ip-address/debug/clip.html