Skip to content

Commit 9075d1c

Browse files
committed
Update documentation
1 parent 5f71bb6 commit 9075d1c

4 files changed

Lines changed: 176 additions & 83 deletions

File tree

docs/alarm.html

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -257,19 +257,16 @@ <h3>Methods</h3>
257257

258258
return types_list
259259

260-
async def triggerEmergency(self, usercode, type):
260+
async def triggerEmergency(self, type):
261261
&#34;&#34;&#34;Triggers an emergency of the specified type.
262262

263263
Parameters:
264-
`usercode` - PIN/code for disarming the system.
265-
266264
`type` - Type of emergency: &#34;Fire&#34;, &#34;Medical&#34;, &#34;Panic&#34;, or &#34;Police&#34;
267265
&#34;&#34;&#34;
268-
usercode = str(usercode)
269266
await self.director.sendPostRequest(
270267
&#34;/api/v1/items/{}/commands&#34;.format(self.item_id),
271-
&#34;PARTITION_DISARM&#34;,
272-
{&#34;UserCode&#34;: usercode},
268+
&#34;EXECUTE_EMERGENCY&#34;,
269+
{&#34;EmergencyType&#34;: type},
273270
)
274271

275272
async def sendKeyPress(self, key):
@@ -625,31 +622,27 @@ <h2 id="parameters">Parameters</h2>
625622
<p><code>usercode</code> - PIN/code for disarming the system.</p></div>
626623
</dd>
627624
<dt id="pyControl4.alarm.C4SecurityPanel.triggerEmergency"><code class="name flex">
628-
<span>async def <span class="ident">triggerEmergency</span></span>(<span>self, usercode, type)</span>
625+
<span>async def <span class="ident">triggerEmergency</span></span>(<span>self, type)</span>
629626
</code></dt>
630627
<dd>
631628
<details class="source">
632629
<summary>
633630
<span>Expand source code</span>
634631
</summary>
635-
<pre><code class="python">async def triggerEmergency(self, usercode, type):
632+
<pre><code class="python">async def triggerEmergency(self, type):
636633
&#34;&#34;&#34;Triggers an emergency of the specified type.
637634

638635
Parameters:
639-
`usercode` - PIN/code for disarming the system.
640-
641636
`type` - Type of emergency: &#34;Fire&#34;, &#34;Medical&#34;, &#34;Panic&#34;, or &#34;Police&#34;
642637
&#34;&#34;&#34;
643-
usercode = str(usercode)
644638
await self.director.sendPostRequest(
645639
&#34;/api/v1/items/{}/commands&#34;.format(self.item_id),
646-
&#34;PARTITION_DISARM&#34;,
647-
{&#34;UserCode&#34;: usercode},
640+
&#34;EXECUTE_EMERGENCY&#34;,
641+
{&#34;EmergencyType&#34;: type},
648642
)</code></pre>
649643
</details>
650644
<div class="desc"><p>Triggers an emergency of the specified type.</p>
651645
<h2 id="parameters">Parameters</h2>
652-
<p><code>usercode</code> - PIN/code for disarming the system.</p>
653646
<p><code>type</code> - Type of emergency: "Fire", "Medical", "Panic", or "Police"</p></div>
654647
</dd>
655648
</dl>

docs/director.html

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
211211
&#34;/api/v1/items/{}/variables?varnames={}&#34;.format(item_id, var_name)
212212
)
213213
if data == &#34;[]&#34;:
214-
raise ValueError(
215-
&#34;Empty response recieved from Director! The variable {} \
216-
doesn&#39;t seem to exist for item {}.&#34;.format(
217-
var_name, item_id
218-
)
219-
)
214+
raise ValueError(&#34;Empty response recieved from Director! The variable {} \
215+
doesn&#39;t seem to exist for item {}.&#34;.format(var_name, item_id))
220216
jsonDictionary = json.loads(data)
221217
return jsonDictionary[0][&#34;value&#34;]
222218

@@ -234,12 +230,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
234230
&#34;/api/v1/items/variables?varnames={}&#34;.format(var_name)
235231
)
236232
if data == &#34;[]&#34;:
237-
raise ValueError(
238-
&#34;Empty response recieved from Director! The variable {} \
239-
doesn&#39;t seem to exist for any items.&#34;.format(
240-
var_name
241-
)
242-
)
233+
raise ValueError(&#34;Empty response recieved from Director! The variable {} \
234+
doesn&#39;t seem to exist for any items.&#34;.format(var_name))
243235
jsonDictionary = json.loads(data)
244236
return jsonDictionary
245237

@@ -402,12 +394,8 @@ <h3>Methods</h3>
402394
&#34;/api/v1/items/variables?varnames={}&#34;.format(var_name)
403395
)
404396
if data == &#34;[]&#34;:
405-
raise ValueError(
406-
&#34;Empty response recieved from Director! The variable {} \
407-
doesn&#39;t seem to exist for any items.&#34;.format(
408-
var_name
409-
)
410-
)
397+
raise ValueError(&#34;Empty response recieved from Director! The variable {} \
398+
doesn&#39;t seem to exist for any items.&#34;.format(var_name))
411399
jsonDictionary = json.loads(data)
412400
return jsonDictionary</code></pre>
413401
</details>
@@ -574,12 +562,8 @@ <h2 id="parameters">Parameters</h2>
574562
&#34;/api/v1/items/{}/variables?varnames={}&#34;.format(item_id, var_name)
575563
)
576564
if data == &#34;[]&#34;:
577-
raise ValueError(
578-
&#34;Empty response recieved from Director! The variable {} \
579-
doesn&#39;t seem to exist for item {}.&#34;.format(
580-
var_name, item_id
581-
)
582-
)
565+
raise ValueError(&#34;Empty response recieved from Director! The variable {} \
566+
doesn&#39;t seem to exist for item {}.&#34;.format(var_name, item_id))
583567
jsonDictionary = json.loads(data)
584568
return jsonDictionary[0][&#34;value&#34;]</code></pre>
585569
</details>

docs/light.html

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,36 @@ <h2 class="section-title" id="header-classes">Classes</h2>
9595
&#34;/api/v1/items/{}/commands&#34;.format(self.item_id),
9696
&#34;RAMP_TO_LEVEL&#34;,
9797
{&#34;LEVEL&#34;: level, &#34;TIME&#34;: time},
98+
)
99+
100+
async def setColorXY(self, x: float, y: float, *, rate: int | None = None):
101+
&#34;&#34;&#34;Sends SET_COLOR_TARGET with xy&#34;&#34;&#34;
102+
params = {
103+
&#34;LIGHT_COLOR_TARGET_X&#34;: float(x),
104+
&#34;LIGHT_COLOR_TARGET_Y&#34;: float(y),
105+
&#34;LIGHT_COLOR_TARGET_MODE&#34;: 0,
106+
}
107+
if rate is not None:
108+
params[&#34;RATE&#34;] = int(rate)
109+
110+
await self.director.sendPostRequest(
111+
f&#34;/api/v1/items/{self.item_id}/commands&#34;,
112+
&#34;SET_COLOR_TARGET&#34;,
113+
params,
114+
)
115+
116+
async def setColorTemperature(self, kelvin: int, *, rate: int | None = None):
117+
params = {
118+
&#34;LIGHT_COLOR_TARGET_COLOR_CORRELATED_TEMPERATURE&#34;: int(kelvin),
119+
&#34;LIGHT_COLOR_TARGET_MODE&#34;: 1,
120+
}
121+
if rate is not None:
122+
params[&#34;RATE&#34;] = int(rate)
123+
124+
await self.director.sendPostRequest(
125+
f&#34;/api/v1/items/{self.item_id}/commands&#34;,
126+
&#34;SET_COLOR_TARGET&#34;,
127+
params,
98128
)</code></pre>
99129
</details>
100130
<div class="desc"><p>Creates a Control4 object.</p>
@@ -169,6 +199,56 @@ <h2 id="parameters">Parameters</h2>
169199
<p><code>level</code> - (int) 0-100</p>
170200
<p><code>time</code> - (int) Duration in milliseconds</p></div>
171201
</dd>
202+
<dt id="pyControl4.light.C4Light.setColorTemperature"><code class="name flex">
203+
<span>async def <span class="ident">setColorTemperature</span></span>(<span>self, kelvin: int, *, rate: int | None = None)</span>
204+
</code></dt>
205+
<dd>
206+
<details class="source">
207+
<summary>
208+
<span>Expand source code</span>
209+
</summary>
210+
<pre><code class="python">async def setColorTemperature(self, kelvin: int, *, rate: int | None = None):
211+
params = {
212+
&#34;LIGHT_COLOR_TARGET_COLOR_CORRELATED_TEMPERATURE&#34;: int(kelvin),
213+
&#34;LIGHT_COLOR_TARGET_MODE&#34;: 1,
214+
}
215+
if rate is not None:
216+
params[&#34;RATE&#34;] = int(rate)
217+
218+
await self.director.sendPostRequest(
219+
f&#34;/api/v1/items/{self.item_id}/commands&#34;,
220+
&#34;SET_COLOR_TARGET&#34;,
221+
params,
222+
)</code></pre>
223+
</details>
224+
<div class="desc"></div>
225+
</dd>
226+
<dt id="pyControl4.light.C4Light.setColorXY"><code class="name flex">
227+
<span>async def <span class="ident">setColorXY</span></span>(<span>self, x: float, y: float, *, rate: int | None = None)</span>
228+
</code></dt>
229+
<dd>
230+
<details class="source">
231+
<summary>
232+
<span>Expand source code</span>
233+
</summary>
234+
<pre><code class="python">async def setColorXY(self, x: float, y: float, *, rate: int | None = None):
235+
&#34;&#34;&#34;Sends SET_COLOR_TARGET with xy&#34;&#34;&#34;
236+
params = {
237+
&#34;LIGHT_COLOR_TARGET_X&#34;: float(x),
238+
&#34;LIGHT_COLOR_TARGET_Y&#34;: float(y),
239+
&#34;LIGHT_COLOR_TARGET_MODE&#34;: 0,
240+
}
241+
if rate is not None:
242+
params[&#34;RATE&#34;] = int(rate)
243+
244+
await self.director.sendPostRequest(
245+
f&#34;/api/v1/items/{self.item_id}/commands&#34;,
246+
&#34;SET_COLOR_TARGET&#34;,
247+
params,
248+
)</code></pre>
249+
</details>
250+
<div class="desc"><p>Sends SET_COLOR_TARGET with xy</p></div>
251+
</dd>
172252
<dt id="pyControl4.light.C4Light.setLevel"><code class="name flex">
173253
<span>async def <span class="ident">setLevel</span></span>(<span>self, level)</span>
174254
</code></dt>
@@ -214,10 +294,12 @@ <h2 id="parameters">Parameters</h2>
214294
<ul>
215295
<li>
216296
<h4><code><a title="pyControl4.light.C4Light" href="#pyControl4.light.C4Light">C4Light</a></code></h4>
217-
<ul class="">
297+
<ul class="two-column">
218298
<li><code><a title="pyControl4.light.C4Light.getLevel" href="#pyControl4.light.C4Light.getLevel">getLevel</a></code></li>
219299
<li><code><a title="pyControl4.light.C4Light.getState" href="#pyControl4.light.C4Light.getState">getState</a></code></li>
220300
<li><code><a title="pyControl4.light.C4Light.rampToLevel" href="#pyControl4.light.C4Light.rampToLevel">rampToLevel</a></code></li>
301+
<li><code><a title="pyControl4.light.C4Light.setColorTemperature" href="#pyControl4.light.C4Light.setColorTemperature">setColorTemperature</a></code></li>
302+
<li><code><a title="pyControl4.light.C4Light.setColorXY" href="#pyControl4.light.C4Light.setColorXY">setColorXY</a></code></li>
221303
<li><code><a title="pyControl4.light.C4Light.setLevel" href="#pyControl4.light.C4Light.setLevel">setLevel</a></code></li>
222304
</ul>
223305
</li>

0 commit comments

Comments
 (0)