Skip to content

Commit a18312f

Browse files
committed
Updated README
1 parent 710af9a commit a18312f

File tree

3 files changed

+31
-33
lines changed

3 files changed

+31
-33
lines changed

bridge.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ func (b *Bridge) Login(u string) *Bridge {
4646
4747
*/
4848

49-
5049
// GetConfig returns the bridge configuration
5150
func (b *Bridge) GetConfig() (*Config, error) {
5251

bridge_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ func TestUpdateBridgeConfig(t *testing.T) {
3939
if err != nil {
4040
t.Fatal(err)
4141
}
42-
}
42+
}

huego_test.go

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ func init() {
2525
method string
2626
path string
2727
data string
28-
url string
28+
url string
2929
}{
3030
// DISCOVERY
3131
{
3232
method: "GET",
33-
url: "https://discovery.meethue.com",
34-
data: `[{"id":"001788fffe73ff19","internalipaddress":"192.168.13.112"}]`,
33+
url: "https://discovery.meethue.com",
34+
data: `[{"id":"001788fffe73ff19","internalipaddress":"192.168.13.112"}]`,
3535
},
3636

3737
// CONFIG
@@ -171,137 +171,136 @@ func init() {
171171
{
172172
method: "GET",
173173
path: "/rules",
174-
data: `{ "1": { "name": "Wall Switch Rule", "lasttriggered": "2013-10-17T01:23:20", "creationtime": "2013-10-10T21:11:45", "timestriggered": 27, "owner": "78H56B12BA", "status": "enabled", "conditions": [ { "address": "/sensors/2/state/buttonevent", "operator": "eq", "value": "16" }, { "address": "/sensors/2/state/lastupdated", "operator": "dx" } ], "actions": [ { "address": "/groups/0/action", "method": "PUT", "body": { "scene": "S3" } } ] }} `,
174+
data: `{ "1": { "name": "Wall Switch Rule", "lasttriggered": "2013-10-17T01:23:20", "creationtime": "2013-10-10T21:11:45", "timestriggered": 27, "owner": "78H56B12BA", "status": "enabled", "conditions": [ { "address": "/sensors/2/state/buttonevent", "operator": "eq", "value": "16" }, { "address": "/sensors/2/state/lastupdated", "operator": "dx" } ], "actions": [ { "address": "/groups/0/action", "method": "PUT", "body": { "scene": "S3" } } ] }} `,
175175
},
176176
{
177177
method: "GET",
178178
path: "/rules/1",
179-
data: `{ "name": "Wall Switch Rule", "owner": "ruleOwner", "created": "2014-07-23T15:02:56", "lasttriggered": "none", "timestriggered": 0, "status": "enabled", "conditions": [ { "address": "/sensors/2/state/buttonevent", "operator": "eq", "value": "16" }, { "address": "/sensors/2/state/lastupdated", "operator": "dx" } ], "actions": [ { "address": "/groups/0/action", "method": "PUT", "body": { "scene": "S3" } } ] }`,
179+
data: `{ "name": "Wall Switch Rule", "owner": "ruleOwner", "created": "2014-07-23T15:02:56", "lasttriggered": "none", "timestriggered": 0, "status": "enabled", "conditions": [ { "address": "/sensors/2/state/buttonevent", "operator": "eq", "value": "16" }, { "address": "/sensors/2/state/lastupdated", "operator": "dx" } ], "actions": [ { "address": "/groups/0/action", "method": "PUT", "body": { "scene": "S3" } } ] }`,
180180
},
181181
{
182182
method: "POST",
183183
path: "/rules",
184-
data: `[{"success":{"id": "3"}}]`,
184+
data: `[{"success":{"id": "3"}}]`,
185185
},
186186
{
187187
method: "PUT",
188188
path: "/rules/1",
189-
data: `[ { "success": { "/rules/1/actions": [ { "address": "/groups/0/action", "method": "PUT", "body": { "scene": "S3" } } ] } } ]`,
189+
data: `[ { "success": { "/rules/1/actions": [ { "address": "/groups/0/action", "method": "PUT", "body": { "scene": "S3" } } ] } } ]`,
190190
},
191191
{
192192
method: "DELETE",
193193
path: "/rules/1",
194-
data: `[{"success": "/rules/1 deleted."}]`,
194+
data: `[{"success": "/rules/1 deleted."}]`,
195195
},
196196

197197
// SCHEDULE
198198
{
199199
method: "GET",
200200
path: "/schedules",
201-
data: `{ "1": { "name": "Timer", "description": "", "command": { "address": "/api/s95jtYH8HUVWNkCO/groups/0/action", "body": { "scene": "02b12e930-off-0" }, "method": "PUT" }, "time": "PT00:01:00", "created": "2014-06-23T13:39:16", "status": "disabled", "autodelete": false, "starttime": "2014-06-23T13:39:16" }, "2": { "name": "Alarm", "description": "", "command": { "address": "/api/s95jtYH8HUVWNkCO/groups/0/action", "body": { "scene": "02b12e930-off-0" }, "method": "PUT" }, "localtime": "2014-06-23T19:52:00", "time": "2014-06-23T13:52:00", "created": "2014-06-23T13:38:57", "status": "disabled", "autodelete": false } }`,
201+
data: `{ "1": { "name": "Timer", "description": "", "command": { "address": "/api/s95jtYH8HUVWNkCO/groups/0/action", "body": { "scene": "02b12e930-off-0" }, "method": "PUT" }, "time": "PT00:01:00", "created": "2014-06-23T13:39:16", "status": "disabled", "autodelete": false, "starttime": "2014-06-23T13:39:16" }, "2": { "name": "Alarm", "description": "", "command": { "address": "/api/s95jtYH8HUVWNkCO/groups/0/action", "body": { "scene": "02b12e930-off-0" }, "method": "PUT" }, "localtime": "2014-06-23T19:52:00", "time": "2014-06-23T13:52:00", "created": "2014-06-23T13:38:57", "status": "disabled", "autodelete": false } }`,
202202
},
203203
{
204204
method: "GET",
205205
path: "/schedules/1",
206-
data: `{ "name": "Wake up", "description": "My wake up alarm", "command": { "address": "/api/<username>/groups/1/action", "method": "PUT", "body": { "on": true } }, "time": "W124/T06:00:00" }`,
206+
data: `{ "name": "Wake up", "description": "My wake up alarm", "command": { "address": "/api/<username>/groups/1/action", "method": "PUT", "body": { "on": true } }, "time": "W124/T06:00:00" }`,
207207
},
208208
{
209209
method: "POST",
210210
path: "/schedules",
211-
data: `[{"success":{"id": "2"}}]`,
211+
data: `[{"success":{"id": "2"}}]`,
212212
},
213213
{
214214
method: "PUT",
215215
path: "/schedules/1",
216-
data: `[{ "success": {"/schedules/1/name": "Wake up"}}]`,
216+
data: `[{ "success": {"/schedules/1/name": "Wake up"}}]`,
217217
},
218218
{
219219
method: "DELETE",
220220
path: "/schedules/1",
221-
data: `[{"success": "/schedules/1 deleted."}]`,
221+
data: `[{"success": "/schedules/1 deleted."}]`,
222222
},
223223

224224
// SENSOR
225225
{
226226
method: "GET",
227227
path: "/sensors",
228-
data: `{ "1": { "state": { "daylight": false, "lastupdated": "2014-06-27T07:38:51" }, "config": { "on": true, "long": "none", "lat": "none", "sunriseoffset": 50, "sunsetoffset": 50 }, "name": "Daylight", "type": "Daylight", "modelid": "PHDL00", "manufacturername": "Philips", "swversion": "1.0" }, "2": { "state": { "buttonevent": 0, "lastupdated": "none" }, "config": { "on": true }, "name": "Tap Switch 2", "type": "ZGPSwitch", "modelid": "ZGPSWITCH", "manufacturername": "Philips", "uniqueid": "00:00:00:00:00:40:03:50-f2" } }`,
228+
data: `{ "1": { "state": { "daylight": false, "lastupdated": "2014-06-27T07:38:51" }, "config": { "on": true, "long": "none", "lat": "none", "sunriseoffset": 50, "sunsetoffset": 50 }, "name": "Daylight", "type": "Daylight", "modelid": "PHDL00", "manufacturername": "Philips", "swversion": "1.0" }, "2": { "state": { "buttonevent": 0, "lastupdated": "none" }, "config": { "on": true }, "name": "Tap Switch 2", "type": "ZGPSwitch", "modelid": "ZGPSWITCH", "manufacturername": "Philips", "uniqueid": "00:00:00:00:00:40:03:50-f2" } }`,
229229
},
230230
{
231231
method: "GET",
232232
path: "/sensors/1",
233-
data: `{ "state":{ "buttonevent": 34, "lastupdated":"2013-03-25T13:32:34" }, "name": "Wall tap 1", "modelid":"ZGPSWITCH", "uniqueid":"01:23:45:67:89:AB-12", "manufacturername": "Philips", "swversion":"1.0", "type": "ZGPSwitch" }`,
233+
data: `{ "state":{ "buttonevent": 34, "lastupdated":"2013-03-25T13:32:34" }, "name": "Wall tap 1", "modelid":"ZGPSWITCH", "uniqueid":"01:23:45:67:89:AB-12", "manufacturername": "Philips", "swversion":"1.0", "type": "ZGPSwitch" }`,
234234
},
235235
{
236236
method: "POST",
237237
path: "/sensors",
238-
data: `[ { "success": { "/sensors": "Searching for new devices"}}]`,
238+
data: `[ { "success": { "/sensors": "Searching for new devices"}}]`,
239239
},
240240
{
241241
method: "POST",
242242
path: "/sensors",
243-
data: `[{"success":{"id": "4"}}]`,
243+
data: `[{"success":{"id": "4"}}]`,
244244
},
245245
{
246246
method: "GET",
247247
path: "/sensors/new",
248-
data: `{ "7": {"name": "Hue Tap 1"}, "8": {"name": " Button 3"}, "lastscan":"2013-05-22T10:24:00" }`,
248+
data: `{ "7": {"name": "Hue Tap 1"}, "8": {"name": " Button 3"}, "lastscan":"2013-05-22T10:24:00" }`,
249249
},
250250
{
251251
method: "PUT",
252252
path: "/sensors/1",
253-
data: `[{"success":{"/sensors/2/name":"Bedroom Tap"}}]`,
253+
data: `[{"success":{"/sensors/2/name":"Bedroom Tap"}}]`,
254254
},
255255
{
256256
method: "DELETE",
257257
path: "/sensors/1",
258-
data: `[{"success": "/sensors/1 deleted."}]`,
258+
data: `[{"success": "/sensors/1 deleted."}]`,
259259
},
260260
{
261261
method: "PUT",
262262
path: "/sensors/1/config",
263-
data: `[{"success":{"/sensors/2/config/on":true}}]`,
263+
data: `[{"success":{"/sensors/2/config/on":true}}]`,
264264
},
265265
{
266266
method: "PUT",
267267
path: "/sensors/1/state",
268-
data: `[{"success":{"/sensors/1/state/presence": false}}]`,
268+
data: `[{"success":{"/sensors/1/state/presence": false}}]`,
269269
},
270-
270+
271271
// CAPABILITIES
272272
{
273273
method: "GET",
274274
path: "/capabilities",
275-
data: `{ "lights":{ "available": 10 }, "sensors":{ "availble": 60, "clip": { "available": 60 }, "zll": { "available": 60 }, "zgp": { "available": 60 } }, "groups": {}, "scenes": { "available": 100, "lightstates": { "available": 1500 } }, "rules": {}, "schedules": {}, "resourcelinks": {}, "whitelists": {}, "timezones": { "values":[ "Africa/Abidjan", "Africa/Accra", "Pacific/Wallis", "US/Pacific-New" ] } }`,
275+
data: `{ "lights":{ "available": 10 }, "sensors":{ "availble": 60, "clip": { "available": 60 }, "zll": { "available": 60 }, "zgp": { "available": 60 } }, "groups": {}, "scenes": { "available": 100, "lightstates": { "available": 1500 } }, "rules": {}, "schedules": {}, "resourcelinks": {}, "whitelists": {}, "timezones": { "values":[ "Africa/Abidjan", "Africa/Accra", "Pacific/Wallis", "US/Pacific-New" ] } }`,
276276
},
277277

278278
// RESOURCELINK
279279
{
280280
method: "GET",
281281
path: "/resourcelinks",
282-
data: `{ "1": { "name": "Sunrise", "description": "Carla's wakeup experience", "class": 1, "owner": "78H56B12BAABCDEF", "links": ["/schedules/2", "/schedules/3", "/scenes/ABCD", "/scenes/EFGH", "/groups/8"] } }`,
282+
data: `{ "1": { "name": "Sunrise", "description": "Carla's wakeup experience", "class": 1, "owner": "78H56B12BAABCDEF", "links": ["/schedules/2", "/schedules/3", "/scenes/ABCD", "/scenes/EFGH", "/groups/8"] } }`,
283283
},
284284
{
285285
method: "GET",
286286
path: "/resourcelinks/1",
287-
data: `{ "name": "Sunrise", "description": "Carla's wakeup experience", "type":"Link", "class": 1, "owner": "78H56B12BAABCDEF", "links": ["/schedules/2", "/schedules/3", "/scenes/ABCD", "/scences/EFGH", "/groups/8"] }`,
287+
data: `{ "name": "Sunrise", "description": "Carla's wakeup experience", "type":"Link", "class": 1, "owner": "78H56B12BAABCDEF", "links": ["/schedules/2", "/schedules/3", "/scenes/ABCD", "/scences/EFGH", "/groups/8"] }`,
288288
},
289289
{
290290
method: "POST",
291291
path: "/resourcelinks",
292-
data: `[{"success":{"id": "3"}}]`,
292+
data: `[{"success":{"id": "3"}}]`,
293293
},
294294
{
295295
method: "PUT",
296296
path: "/resourcelinks/1",
297-
data: `[{ "success": { "/resourcelinks/1/name": "Sunrise" } }, { "success": { "/resourcelinks/1/description": "Carla's wakeup experience" } }]`,
297+
data: `[{ "success": { "/resourcelinks/1/name": "Sunrise" } }, { "success": { "/resourcelinks/1/description": "Carla's wakeup experience" } }]`,
298298
},
299299
{
300300
method: "DELETE",
301301
path: "/resourcelinks/1",
302-
data: `[{"success": "/resourcelinks/1 deleted."}]`,
302+
data: `[{"success": "/resourcelinks/1 deleted."}]`,
303303
},
304-
305304
}
306305

307306
httpmock.Activate()
@@ -336,4 +335,4 @@ func TestDiscoverAllBridges(t *testing.T) {
336335
t.Logf(" User: %s", bridge.User)
337336
t.Logf(" ID: %s", bridge.ID)
338337
}
339-
}
338+
}

0 commit comments

Comments
 (0)