probonopd / ESP8266HueEmulator

Emulate a Philips Hue bridge running on an ESP8266 using the Arduino IDE.
MIT License
411 stars 93 forks source link

Make Android Hue app great again #52

Closed opticron closed 7 years ago

opticron commented 7 years ago

This fixes all the problems I had with the Android gen2 hue app. Things generally work pretty well now and I managed to get past the one hurdle that was keeping the Android app from getting past room setup.

probonopd commented 7 years ago

Next, let's make iOS app great again...

=== 122087
Method: GET
requestedUri: api/e7x4kuCaC8h885jo
URI: 
122093
{"groups":{},"scenes":{},"config":{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"api":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}},"lights":{"1":{"type":"Extended color light","name":"Hue LightStrips 1","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-1","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"2":{"type":"Extended color light","name":"Hue LightStrips 2","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-2","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"3":{"type":"Extended color light","name":"Hue LightStrips 3","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-3","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"4":{"type":"Extended color light","name":"Hue LightStrips 4","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-4","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"5":{"type":"Extended color light","name":"Hue LightStrips 5","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-5","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"6":{"type":"Extended color light","name":"Hue LightStrips 6","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-6","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}}},"schedules":{},"sensors":{},"rules":{}}
122261
=== 123433
Method: PUT
requestedUri: api/e7x4kuCaC8h885jo/config
URI: config
123434
{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"api":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}}
123463
=== 131929
Method: GET
requestedUri: api/nouser/config
URI: config
131931
{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"api":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}}
131959
=== 132045
Method: GET
requestedUri: api/api
URI: 
132051
{"groups":{},"scenes":{},"config":{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"api":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}},"lights":{"1":{"type":"Extended color light","name":"Hue LightStrips 1","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-1","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"2":{"type":"Extended color light","name":"Hue LightStrips 2","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-2","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"3":{"type":"Extended color light","name":"Hue LightStrips 3","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-3","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"4":{"type":"Extended color light","name":"Hue LightStrips 4","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-4","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"5":{"type":"Extended color light","name":"Hue LightStrips 5","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-5","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"6":{"type":"Extended color light","name":"Hue LightStrips 6","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-6","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}}},"schedules":{},"sensors":{},"rules":{}}
132218
=== 132758
Method: GET
requestedUri: api/api
URI: 
132765
{"groups":{},"scenes":{},"config":{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"api":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}},"lights":{"1":{"type":"Extended color light","name":"Hue LightStrips 1","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-1","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"2":{"type":"Extended color light","name":"Hue LightStrips 2","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-2","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"3":{"type":"Extended color light","name":"Hue LightStrips 3","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-3","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"4":{"type":"Extended color light","name":"Hue LightStrips 4","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-4","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"5":{"type":"Extended color light","name":"Hue LightStrips 5","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-5","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"6":{"type":"Extended color light","name":"Hue LightStrips 6","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-6","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}}},"schedules":{},"sensors":{},"rules":{}}
132932
=== 133326
Method: GET
requestedUri: api/api/config
URI: config
133327
{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"api":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}}
133355
=== 133393
Method: GET
requestedUri: api/api
URI: 
133399
{"groups":{},"scenes":{},"config":{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"api":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}},"lights":{"1":{"type":"Extended color light","name":"Hue LightStrips 1","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-1","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"2":{"type":"Extended color light","name":"Hue LightStrips 2","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-2","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"3":{"type":"Extended color light","name":"Hue LightStrips 3","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-3","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"4":{"type":"Extended color light","name":"Hue LightStrips 4","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-4","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"5":{"type":"Extended color light","name":"Hue LightStrips 5","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-5","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}},"6":{"type":"Extended color light","name":"Hue LightStrips 6","uniqueid":"AA:BB:CC:DD:EE:FF:00:11-6","modelid":"LST001","state":{"on":false,"hue":0,"bri":0,"sat":0,"xy":[0.00000,0.00000],"ct":500,"alert":"none","effect":"none","colormode":"hs","reachable":true}}},"schedules":{},"sensors":{},"rules":{}}
133567
=== 147190
Method: POST
requestedUri: api/api/groups
URI: groups
JSON Body:{"name":"Wohnzimmer","lights":["1"],"type":"Room","class":"Living room"}
147193
[{"success":{"id":"1"}}]
147196
=== 148009
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Entspannen","lights":["1"]}
148010
[{"success":{"id":"0"}}]
148012
=== 148344
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Lesen","lights":["1"]}
148345
[{"success":{"id":"1"}}]
148347
=== 148385
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Konzentration","lights":["1"]}
148387
[{"success":{"id":"2"}}]
148389
=== 148420
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Aktivieren","lights":["1"]}
148421
[{"success":{"id":"3"}}]
148423
=== 148452
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Hell","lights":["1"]}
148454
[{"success":{"id":"4"}}]
148455
=== 148483
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Gedimmt","lights":["1"]}
148485
[{"success":{"id":"5"}}]
148486
=== 148511
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Nachtlicht","lights":["1"]}
148513
[{"success":{"id":"6"}}]
148515
=== 148549
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Sonnenuntergang Savanne","lights":["1"]}
148551
[{"success":{"id":"7"}}]
148553
=== 148583
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Tropend��mmerung","lights":["1"]}
148584
[{"success":{"id":"8"}}]
148587
=== 148618
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Nordlichter","lights":["1"]}
148619
[{"success":{"id":"9"}}]
148621
=== 148652
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Frühlingsblüten","lights":["1"]}
148654
[{"success":{"id":"10"}}]
148656
=== 148687
Method: PUT
requestedUri: api/api/scenes/0/lights/1/state
URI: scenes/0/lights/1/state
148689
=== 148776
Method: PUT
requestedUri: api/api/scenes/1/lights/1/state
URI: scenes/1/lights/1/state
148778
=== 148813
Method: PUT
requestedUri: api/api/scenes/2/lights/1/state
URI: scenes/2/lights/1/state
148814
=== 148849
Method: PUT
requestedUri: api/api/scenes/3/lights/1/state
URI: scenes/3/lights/1/state
148851
=== 148882
Method: PUT
requestedUri: api/api/scenes/4/lights/1/state
URI: scenes/4/lights/1/state
148884
=== 148914
Method: PUT
requestedUri: api/api/scenes/5/lights/1/state
URI: scenes/5/lights/1/state
148916
=== 148947
Method: PUT
requestedUri: api/api/scenes/6/lights/1/state
URI: scenes/6/lights/1/state
148949
=== 148982
Method: PUT
requestedUri: api/api/scenes/7/lights/1/state
URI: scenes/7/lights/1/state
148984
=== 149016
Method: PUT
requestedUri: api/api/scenes/8/lights/1/state
URI: scenes/8/lights/1/state
149018
=== 149050
Method: PUT
requestedUri: api/api/scenes/9/lights/1/state
URI: scenes/9/lights/1/state
149052
=== 149084
Method: PUT
requestedUri: api/api/scenes/10/lights/1/state
URI: scenes/10/lights/1/state
149085
=== 149114
Method: GET
requestedUri: api/api/scenes/0
URI: scenes/0
149115
{"name":"Entspannen","owner":"api","picture":"","lastupdated":"","recycle":false,"locked":false,"version":2,"lights":["1"]}
149122
=== 149152
Method: DELETE
requestedUri: api/api/groups/1
URI: groups/1
149153
[{"success":"/groups/1 deleted"}]
149154
=== 149190
Method: DELETE
requestedUri: api/api/scenes/7
URI: scenes/7
149191
[{"success":"/scenes/7 deleted"}]
149192
=== 149218
Method: DELETE
requestedUri: api/api/scenes/3
URI: scenes/3
149219
[{"success":"/scenes/3 deleted"}]
149220
=== 149251
Method: DELETE
requestedUri: api/api/scenes/8
URI: scenes/8
149252
[{"success":"/scenes/8 deleted"}]
149254
=== 149279
Method: DELETE
requestedUri: api/api/scenes/4
URI: scenes/4
149280
[{"success":"/scenes/4 deleted"}]
149281
=== 149314
Method: DELETE
requestedUri: api/api/scenes/0
URI: scenes/0
149315
[{"success":"/scenes/0 deleted"}]
149317
=== 149343
Method: DELETE
requestedUri: api/api/scenes/9
URI: scenes/9
149344
[{"success":"/scenes/9 deleted"}]
149345
=== 149378
Method: DELETE
requestedUri: api/api/scenes/5
URI: scenes/5
149379
[{"success":"/scenes/5 deleted"}]
149380
=== 149409
Method: DELETE
requestedUri: api/api/scenes/1
URI: scenes/1
149410
[{"success":"/scenes/1 deleted"}]
149412
=== 149441
Method: DELETE
requestedUri: api/api/scenes/6
URI: scenes/6
149442
[{"success":"/scenes/6 deleted"}]
149444
=== 149473
Method: DELETE
requestedUri: api/api/scenes/2
URI: scenes/2
149474
[{"success":"/scenes/2 deleted"}]
149476
=== 149502
Method: DELETE
requestedUri: api/api/scenes/10
URI: scenes/10
149503
[{"success":"/scenes/10 deleted"}]
149505

Looks like the app isn't requesting anything else anymore, but is stalled saying "saving can take some time"...

probonopd commented 7 years ago

Need a collaborator in this project with a real Hue bridge. The old bridge can be had on eBay for under $10 nowadays...

opticron commented 7 years ago

I have a friend that has one. I'll see what he can do. I can borrow my wife's iPad for additional testing.

opticron commented 7 years ago

I've been working on this with the iPad and the emulated bridge. Nothing yet, but I have a lead. Things seem to go down hill when the scene retrieval comes back and I suspect that it's the empty lightstates causing the blowup (I've already gone down other avenues). I've also been working on some significant refactoring of the HTTP callback handling to avoid the current mess of code that all keys off of what is basically intended to be the 404 handler.