lifx_api 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +117 -1
- data/lib/lifx_api/endpoints.rb +15 -15
- data/lib/lifx_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d724c2ee6d1e686079cbcf9bda0f888547d8db20
|
4
|
+
data.tar.gz: e5a883b787b636d093401004320b6d44cac66510
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 186ec61411ed72701e4e72c98ab795c6c55f16ee026d0e10533579d831cbffd776a3d91027457e03abc743e610d346bb9716011d848df083b546a95696954ac8
|
7
|
+
data.tar.gz: d9febdadb923782c658e73158557ad5c9970ef263868f90addd0435a970ce133c1fc484d91f1076bcad9f0269353a0ee7bf090bcbcdee81ee77cd135ed7f8a5f
|
data/README.md
CHANGED
@@ -40,7 +40,123 @@ client.toggle_power selector: "id:#{light_id}"
|
|
40
40
|
|
41
41
|
## Endpoints and parameters
|
42
42
|
|
43
|
-
|
43
|
+
See [LIFX HTTP API](https://api.developer.lifx.com/) for the official documentation.
|
44
|
+
|
45
|
+
### list_lights
|
46
|
+
|
47
|
+
#### Parameters
|
48
|
+
|
49
|
+
Key | Type | Mandatory | Default | Description
|
50
|
+
--- | --- | --- | --- | ---
|
51
|
+
`:selector` | selector | | all |
|
52
|
+
|
53
|
+
### set_state
|
54
|
+
|
55
|
+
#### Parameters
|
56
|
+
|
57
|
+
Key | Type | Mandatory | Default | Description
|
58
|
+
--- | --- | --- | --- | ---
|
59
|
+
`:selector` | selector | | all |
|
60
|
+
`:power` | string | | | The power state you want to set on the selector. on or off
|
61
|
+
`:color` | string | | | The color to set the light to.
|
62
|
+
`:brightness` | numeric | | | The brightness level from 0.0 to 1.0. Overrides any brightness set in color (if any).
|
63
|
+
`:duration` | numeric | | 1.0 | How long in seconds you want the power action to take. Range: 0.0 - 3155760000.0 (100 years)
|
64
|
+
`:infrared` | numeric | | | The maximum brightness of the infrared channel.
|
65
|
+
|
66
|
+
### set_states
|
67
|
+
|
68
|
+
#### Parameters
|
69
|
+
|
70
|
+
Key | Type | Mandatory | Default | Description
|
71
|
+
--- | --- | --- | --- | ---
|
72
|
+
`:states` | | ✔ | |
|
73
|
+
`:defaults` | hash | | |
|
74
|
+
|
75
|
+
### stage_delta
|
76
|
+
|
77
|
+
#### Parameters
|
78
|
+
|
79
|
+
Key | Type | Mandatory | Default | Description
|
80
|
+
--- | --- | --- | --- | ---
|
81
|
+
`:selector` | selector | | all |
|
82
|
+
`:power` | on_off | | | The power state you want to set on the selector. on or off
|
83
|
+
`:duration` | numeric | | 1.0 | How long in seconds you want the power action to take. Range: 0.0 - 3155760000.0 (100 years)
|
84
|
+
`:infrared` | numeric | | | The maximum brightness of the infrared channel.
|
85
|
+
`:hue` | numeric | | | Rotate the hue by this angle in degrees.
|
86
|
+
`:saturation` | numeric | | | Change the saturation by this additive amount; the resulting saturation is clipped to [0, 1].
|
87
|
+
`:brightness` | numeric | | | Change the brightness by this additive amount; the resulting brightness is clipped to [0, 1].
|
88
|
+
`:kelvin` | numeric | | | Change the kelvin by this additive amount; the resulting kelvin is clipped to [2500, 9000].
|
89
|
+
|
90
|
+
### toggle_power
|
91
|
+
|
92
|
+
#### Parameters
|
93
|
+
|
94
|
+
Key | Type | Mandatory | Default | Description
|
95
|
+
--- | --- | --- | --- | ---
|
96
|
+
`:selector` | selector | | all |
|
97
|
+
`:duration` | numeric | | 1.0 | The time is seconds to spend perfoming the power toggle.
|
98
|
+
|
99
|
+
### breathe_effect
|
100
|
+
|
101
|
+
#### Parameters
|
102
|
+
|
103
|
+
Key | Type | Mandatory | Default | Description
|
104
|
+
--- | --- | --- | --- | ---
|
105
|
+
`:selector` | selector | | all |
|
106
|
+
`:color` | string | ✔ | | The color to use for the breathe effect.
|
107
|
+
`:from_color` | string | | current bulb color | The color to start the effect from. If this parameter is omitted then the color the bulb is currently set to is used instead.
|
108
|
+
`:period` | numeric | | 1.0 | The time in seconds for one cyles of the effect.
|
109
|
+
`:cycles` | numeric | | 1.0 | The number of times to repeat the effect.
|
110
|
+
`:persist` | boolean | | false | If false set the light back to its previous value when effect ends, if true leave the last effect color.
|
111
|
+
`:power_on` | boolean | | true | If true, turn the bulb on if it is not already on.
|
112
|
+
`:peak` | numeric | | 0.5 | Defines where in a period the target color is at its maximum. Minimum 0.0, maximum 1.0.
|
113
|
+
|
114
|
+
### pulse_effect
|
115
|
+
|
116
|
+
#### Parameters
|
117
|
+
|
118
|
+
Key | Type | Mandatory | Default | Description
|
119
|
+
--- | --- | --- | --- | ---
|
120
|
+
`:selector` | selector | | all |
|
121
|
+
`:color` | string | ✔ | | The color to use for the pulse effect.
|
122
|
+
`:from_color` | string | | current bulb color | The color to start the effect from. If this parameter is omitted then the color the bulb is currently set to is used instead.
|
123
|
+
`:period` | numeric | | 1.0 | The time in seconds for one cyles of the effect.
|
124
|
+
`:cycles` | numeric | | 1.0 | The number of times to repeat the effect.
|
125
|
+
`:persist` | boolean | | false | If false set the light back to its previous value when effect ends, if true leave the last effect color.
|
126
|
+
`:power_on` | boolean | | true | If true, turn the bulb on if it is not already on.
|
127
|
+
|
128
|
+
### cycle
|
129
|
+
|
130
|
+
#### Parameters
|
131
|
+
|
132
|
+
Key | Type | Mandatory | Default | Description
|
133
|
+
--- | --- | --- | --- | ---
|
134
|
+
`:states` | array of mixed | ✔ | | Array of state hashes as per Set State. Must have 2 to 5 entries.
|
135
|
+
`:defaults` | object | | | Default values to use when not specified in each states[] object.
|
136
|
+
`:direction` | stringforward | | | Direction in which to cycle through the list. Can be forward or backward
|
137
|
+
|
138
|
+
### list_scenes
|
139
|
+
|
140
|
+
*No parameters*
|
141
|
+
|
142
|
+
### activate_scene
|
143
|
+
|
144
|
+
#### Parameters
|
145
|
+
|
146
|
+
Key | Type | Mandatory | Default | Description
|
147
|
+
--- | --- | --- | --- | ---
|
148
|
+
`:scene_uuid` | uuid | ✔ | | The UUID for the scene you wish to activate
|
149
|
+
`:duration` | numeric | | 1.0 | The time in seconds to spend performing the scene transition.
|
150
|
+
`:ignore` | array of strings | | | Any of "power", "infrared", "duration", "intensity", "hue", "saturation", "brightness" or "kelvin", specifying that these properties should not be changed on devices when applying the scene.
|
151
|
+
`:overrides` | object | | | A state object as per Set State specifying properties to apply to all devices in the scene, overriding those configured in the scene.
|
152
|
+
|
153
|
+
### validate_color
|
154
|
+
|
155
|
+
#### Parameters
|
156
|
+
|
157
|
+
Key | Type | Mandatory | Default | Description
|
158
|
+
--- | --- | --- | --- | ---
|
159
|
+
`:color` | string | ✔ | |
|
44
160
|
|
45
161
|
## Deviation from the API spec
|
46
162
|
|
data/lib/lifx_api/endpoints.rb
CHANGED
@@ -17,7 +17,7 @@ class LifxApi
|
|
17
17
|
power: {type: :string, description: 'The power state you want to set on the selector. on or off'},
|
18
18
|
color: {type: :string, description: 'The color to set the light to.'},
|
19
19
|
brightness: {type: :numeric, description: 'The brightness level from 0.0 to 1.0. Overrides any brightness set in color (if any).'},
|
20
|
-
duration: {type: :numeric,
|
20
|
+
duration: {type: :numeric, default_description: '1.0', description: 'How long in seconds you want the power action to take. Range: 0.0 - 3155760000.0 (100 years)'},
|
21
21
|
infrared: {type: :numeric, description: 'The maximum brightness of the infrared channel.'},
|
22
22
|
},
|
23
23
|
}, {
|
@@ -37,7 +37,7 @@ class LifxApi
|
|
37
37
|
},
|
38
38
|
body_params: {
|
39
39
|
power: {type: :on_off, description: 'The power state you want to set on the selector. on or off'},
|
40
|
-
duration: {type: :numeric,
|
40
|
+
duration: {type: :numeric, default_description: '1.0', description: 'How long in seconds you want the power action to take. Range: 0.0 - 3155760000.0 (100 years)'},
|
41
41
|
infrared: {type: :numeric, description: 'The maximum brightness of the infrared channel.'},
|
42
42
|
hue: {type: :numeric, description: 'Rotate the hue by this angle in degrees.'},
|
43
43
|
saturation: {type: :numeric, description: 'Change the saturation by this additive amount; the resulting saturation is clipped to [0, 1].'},
|
@@ -52,7 +52,7 @@ class LifxApi
|
|
52
52
|
selector: {required: true, type: :selector, default: 'all'},
|
53
53
|
},
|
54
54
|
body_params: {
|
55
|
-
duration: {type: :numeric,
|
55
|
+
duration: {type: :numeric, default_description: '1.0', description: 'The time is seconds to spend perfoming the power toggle.'},
|
56
56
|
},
|
57
57
|
}, {
|
58
58
|
method_name: :breathe_effect,
|
@@ -63,12 +63,12 @@ class LifxApi
|
|
63
63
|
},
|
64
64
|
body_params: {
|
65
65
|
color: {required: :true, type: :string, description: 'The color to use for the breathe effect.'},
|
66
|
-
from_color: {type: :string,
|
67
|
-
period: {type: :numeric,
|
68
|
-
cycles: {type: :numeric,
|
69
|
-
persist: {type: :boolean,
|
70
|
-
power_on: {type: :boolean,
|
71
|
-
peak: {type: :numeric,
|
66
|
+
from_color: {type: :string, default_description: 'current bulb color', description: 'The color to start the effect from. If this parameter is omitted then the color the bulb is currently set to is used instead.'},
|
67
|
+
period: {type: :numeric, default_description: '1.0', description: 'The time in seconds for one cyles of the effect.'},
|
68
|
+
cycles: {type: :numeric, default_description: '1.0', description: 'The number of times to repeat the effect.'},
|
69
|
+
persist: {type: :boolean, default_description: 'false', description: 'If false set the light back to its previous value when effect ends, if true leave the last effect color.'},
|
70
|
+
power_on: {type: :boolean, default_description: 'true', description: 'If true, turn the bulb on if it is not already on.'},
|
71
|
+
peak: {type: :numeric, default_description: '0.5', description: 'Defines where in a period the target color is at its maximum. Minimum 0.0, maximum 1.0.'},
|
72
72
|
}
|
73
73
|
}, {
|
74
74
|
method_name: :pulse_effect,
|
@@ -79,11 +79,11 @@ class LifxApi
|
|
79
79
|
},
|
80
80
|
body_params: {
|
81
81
|
color: {required: true, type: :string, description: 'The color to use for the pulse effect.'},
|
82
|
-
from_color: {type: :string,
|
83
|
-
period: {type: :numeric,
|
84
|
-
cycles: {type: :numeric,
|
85
|
-
persist: {type: :boolean,
|
86
|
-
power_on: {type: :boolean,
|
82
|
+
from_color: {type: :string, default_description: 'current bulb color', description: 'The color to start the effect from. If this parameter is omitted then the color the bulb is currently set to is used instead.'},
|
83
|
+
period: {type: :numeric, default_description: '1.0', description: 'The time in seconds for one cyles of the effect.'},
|
84
|
+
cycles: {type: :numeric, default_description: '1.0', description: 'The number of times to repeat the effect.'},
|
85
|
+
persist: {type: :boolean, default_description: 'false', description: 'If false set the light back to its previous value when effect ends, if true leave the last effect color.'},
|
86
|
+
power_on: {type: :boolean, default_description: 'true', description: 'If true, turn the bulb on if it is not already on.'},
|
87
87
|
}
|
88
88
|
}, {
|
89
89
|
method_name: :cycle,
|
@@ -106,7 +106,7 @@ class LifxApi
|
|
106
106
|
scene_uuid: {required: true, type: :uuid, description: 'The UUID for the scene you wish to activate'},
|
107
107
|
},
|
108
108
|
body_params: {
|
109
|
-
duration: {type: :numeric,
|
109
|
+
duration: {type: :numeric, default_description: '1.0', description: 'The time in seconds to spend performing the scene transition.'},
|
110
110
|
ignore: {type: 'array of strings', description: 'Any of "power", "infrared", "duration", "intensity", "hue", "saturation", "brightness" or "kelvin", specifying that these properties should not be changed on devices when applying the scene.'},
|
111
111
|
overrides: {type: 'object', description: 'A state object as per Set State specifying properties to apply to all devices in the scene, overriding those configured in the scene.'},
|
112
112
|
}
|
data/lib/lifx_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lifx_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cyclotron3k
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|