Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a semblance of scene support #48

Merged
merged 1 commit into from
Dec 3, 2016
Merged

Conversation

opticron
Copy link
Contributor

@opticron opticron commented Dec 3, 2016

This adds all the plubming required to support scenes, but does not
actually store the information necessary to apply them. This allows
apps that require the scene api to interact with the emulated bridge
without blowing up or taking up the additional memory required for
proper support.

This adds all the plubming required to support scenes, but does not
actually store the information necessary to apply them. This allows
apps that require the scene api to interact with the emulated bridge
without blowing up or taking up the additional memory required for
proper support.
@probonopd probonopd merged commit 1fd56b6 into probonopd:master Dec 3, 2016
@probonopd
Copy link
Owner

Thanks @opticron will test it in a minute.

What do you think about #46 and can you make it apply cleanly?

@probonopd
Copy link
Owner

I am getting with the Hue iOS app with the "colorful" icon

Starting SSDP...
SSDP Started
=== 83998
Method: GET
requestedUri: api/nouser/config
URI: config
83999
{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xxx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}}
84027
=== 94055
Method: GET
requestedUri: api/nouser/config
URI: config
94056
{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xxx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}}
94083
=== 94096
Method: GET
requestedUri: api/nouser/config
URI: config
94098
{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xxx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}}
94125
=== 94174
Method: POST
requestedUri: api/
URI: 
CLIENT: 
api
94175
[{"success":{"username":"api"}}]
94176
=== 94234
Method: PUT
requestedUri: api/api/config
URI: config
94236
{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xxx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}}
94263
=== 94294
Method: GET
requestedUri: api/api
URI: 
94300
{"groups":{},"scenes":{},"config":{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xxx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}},"lights":{"1":{"type":"Extended color light","name":"Hue LightStrips 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","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","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","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","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","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":{}}
94445
=== 95259
Method: GET
requestedUri: api/api
URI: 
95265
{"groups":{},"scenes":{},"config":{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xxx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}},"lights":{"1":{"type":"Extended color light","name":"Hue LightStrips 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","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","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","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","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","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":{}}
95410
=== 95823
Method: GET
requestedUri: api/api/config
URI: config
95824
{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xxx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}}
95851
=== 98001
Method: GET
requestedUri: api/api/config
URI: config
98002
{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xxx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}}
98029
=== 100007
Method: GET
requestedUri: api/api/config
URI: config
100009
{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xxx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}}
100036
=== 100504
Method: GET
requestedUri: api/api
URI: 
100509
{"groups":{},"scenes":{},"config":{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xxx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}},"lights":{"1":{"type":"Extended color light","name":"Hue LightStrips 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","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","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","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","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","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":{}}
100654
=== 101117
Method: GET
requestedUri: api/api/config
URI: config
101118
{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xxx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}}
101145
=== 125284
Method: POST
requestedUri: api/api/groups
URI: groups
JSON Body:{"name":"Esp","lights":["1"],"type":"Room","class":"Living room"}
125287
[{"success":{"id":"1"}}]
125290
=== 125589
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Entspannen","lights":["1"]}
125591
[{"success":{"id":""}}]
125592
=== 125620
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Lesen","lights":["1"]}
125622
[{"success":{"id":""}}]
125623
=== 125649
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Konzentration","lights":["1"]}
125651
[{"success":{"id":""}}]
125653
=== 125676
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Aktivieren","lights":["1"]}
125677
[{"success":{"id":""}}]
125679
=== 125706
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Hell","lights":["1"]}
125708
[{"success":{"id":""}}]
125709
=== 125739
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Gedimmt","lights":["1"]}
125740
[{"success":{"id":""}}]
125742
=== 125767
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Nachtlicht","lights":["1"]}
125768
[{"success":{"id":""}}]
125770
=== 125800
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Sonnenuntergang Savanne","lights":["1"]}
125802
[{"success":{"id":""}}]
125805
=== 125830
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Tropend��mmerung","lights":["1"]}
125832
[{"success":{"id":""}}]
125834
=== 125860
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Nordlichter","lights":["1"]}
125861
[{"success":{"id":""}}]
125863
=== 125893
Method: POST
requestedUri: api/api/scenes
URI: scenes
JSON Body:{"name":"Frühlingsblüten","lights":["1"]}
125895
[{"success":{"id":""}}]
125897
=== 125927
Method: PUT
requestedUri: api/api/scenes/lights/1/state
URI: scenes/lights/1/state
125928
=== 128153
Method: GET
requestedUri: api/api/config
URI: config
128154
{"name":"hue emulator","swversion":"81012917","bridgeid":"xxxxxxxxxxxxxxxx","portalservices":false,"linkbutton":true,"mac":"xx:xx:xx:xx:xx:xxx","dhcp":true,"ipaddress":"192.168.0.16","netmask":"255.255.255.0","gateway":"192.168.0.1","apiversion":"1.3.0","whitelist":{"":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}}
128181

## seems to be stalled here

The app says "saving can take some time..." but actually it takes forever and I have to kill the app...

@probonopd
Copy link
Owner

probonopd commented Dec 3, 2016

The iOS app with the non-colorful icon actually does find the emulated bridge and connect to it!

@opticron
Copy link
Contributor Author

opticron commented Dec 3, 2016

I see the issue. I'll submit a new PR with the POST scene creation sans scene ID fix.

@probonopd
Copy link
Owner

probonopd commented Dec 3, 2016

The iOS app with the non-colorful icon actually does find the emulated bridge and connect to it nowadays seems to use scenes for almost everything; so if I select a color and wait for a couple of seconds, then the color in the app gets reset to the original one...

EDIT: If I create a new scene with only one lamp in it, then i seem to be able to control it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants