|
| 1 | +<!doctype html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | +<meta charset="utf-8"> |
| 5 | +<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"> |
| 6 | +<meta name="generator" content="pdoc3 0.11.6"> |
| 7 | +<title>pyControl4.fan API documentation</title> |
| 8 | +<meta name="description" content="Controls Control4 Fan devices."> |
| 9 | +<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin> |
| 10 | +<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/typography.min.css" integrity="sha512-Y1DYSb995BAfxobCkKepB1BqJJTPrOp3zPL74AWFugHHmmdcvO+C48WLrUOlhGMc0QG7AE3f7gmvvcrmX2fDoA==" crossorigin> |
| 11 | +<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" crossorigin> |
| 12 | +<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:1.5em;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:2em 0 .50em 0}h3{font-size:1.4em;margin:1.6em 0 .7em 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .2s ease-in-out}a:visited{color:#503}a:hover{color:#b62}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900;font-weight:bold}pre code{font-size:.8em;line-height:1.4em;padding:1em;display:block}code{background:#f3f3f3;font-family:"DejaVu Sans Mono",monospace;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source > summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible;min-width:max-content}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em 1em;margin:1em 0}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style> |
| 13 | +<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul ul{padding-left:1em}.toc > ul > li{margin-top:.5em}}</style> |
| 14 | +<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style> |
| 15 | +<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" integrity="sha512-D9gUyxqja7hBtkWpPWGt9wfbfaMGVt9gnyCvYa+jojwwPHLCzUm5i8rpk7vD7wNee9bA35eYIjobYPaQuKS1MQ==" crossorigin></script> |
| 16 | +<script>window.addEventListener('DOMContentLoaded', () => { |
| 17 | +hljs.configure({languages: ['bash', 'css', 'diff', 'graphql', 'ini', 'javascript', 'json', 'plaintext', 'python', 'python-repl', 'rust', 'shell', 'sql', 'typescript', 'xml', 'yaml']}); |
| 18 | +hljs.highlightAll(); |
| 19 | +/* Collapse source docstrings */ |
| 20 | +setTimeout(() => { |
| 21 | +[...document.querySelectorAll('.hljs.language-python > .hljs-string')] |
| 22 | +.filter(el => el.innerHTML.length > 200 && ['"""', "'''"].includes(el.innerHTML.substring(0, 3))) |
| 23 | +.forEach(el => { |
| 24 | +let d = document.createElement('details'); |
| 25 | +d.classList.add('hljs-string'); |
| 26 | +d.innerHTML = '<summary>"""</summary>' + el.innerHTML.substring(3); |
| 27 | +el.replaceWith(d); |
| 28 | +}); |
| 29 | +}, 100); |
| 30 | +})</script> |
| 31 | +</head> |
| 32 | +<body> |
| 33 | +<main> |
| 34 | +<article id="content"> |
| 35 | +<header> |
| 36 | +<h1 class="title">Module <code>pyControl4.fan</code></h1> |
| 37 | +</header> |
| 38 | +<section id="section-intro"> |
| 39 | +<p>Controls Control4 Fan devices.</p> |
| 40 | +</section> |
| 41 | +<section> |
| 42 | +</section> |
| 43 | +<section> |
| 44 | +</section> |
| 45 | +<section> |
| 46 | +</section> |
| 47 | +<section> |
| 48 | +<h2 class="section-title" id="header-classes">Classes</h2> |
| 49 | +<dl> |
| 50 | +<dt id="pyControl4.fan.C4Fan"><code class="flex name class"> |
| 51 | +<span>class <span class="ident">C4Fan</span></span> |
| 52 | +<span>(</span><span>C4Director, item_id)</span> |
| 53 | +</code></dt> |
| 54 | +<dd> |
| 55 | +<details class="source"> |
| 56 | +<summary> |
| 57 | +<span>Expand source code</span> |
| 58 | +</summary> |
| 59 | +<pre><code class="python">class C4Fan(C4Entity): |
| 60 | + # ------------------------ |
| 61 | + # Fan State Getters |
| 62 | + # ------------------------ |
| 63 | + |
| 64 | + async def getState(self): |
| 65 | + """ |
| 66 | + Returns the current power state of the fan. |
| 67 | + |
| 68 | + Returns: |
| 69 | + bool: True if the fan is on, False otherwise. |
| 70 | + """ |
| 71 | + value = await self.director.getItemVariableValue(self.item_id, "IS_ON") |
| 72 | + return bool(value) |
| 73 | + |
| 74 | + async def getSpeed(self): |
| 75 | + """ |
| 76 | + Returns the current speed of the fan controller. |
| 77 | + |
| 78 | + Valid speed values: |
| 79 | + 0 - Off |
| 80 | + 1 - Low |
| 81 | + 2 - Medium |
| 82 | + 3 - Medium High |
| 83 | + 4 - High |
| 84 | + |
| 85 | + Note: |
| 86 | + Only valid for fan controllers. On non-dimmer switches, |
| 87 | + use `getState()` instead. |
| 88 | + |
| 89 | + Returns: |
| 90 | + int: Current fan speed (0–4). |
| 91 | + """ |
| 92 | + value = await self.director.getItemVariableValue(self.item_id, |
| 93 | + "CURRENT_SPEED") |
| 94 | + return int(value) |
| 95 | + |
| 96 | + # ------------------------ |
| 97 | + # Fan Control Setters |
| 98 | + # ------------------------ |
| 99 | + |
| 100 | + async def setSpeed(self, speed: int): |
| 101 | + """ |
| 102 | + Sets the fan speed or turns it off. |
| 103 | + |
| 104 | + Parameters: |
| 105 | + speed (int): Fan speed level: |
| 106 | + 0 - Off |
| 107 | + 1 - Low |
| 108 | + 2 - Medium |
| 109 | + 3 - Medium High |
| 110 | + 4 - High |
| 111 | + """ |
| 112 | + await self.director.sendPostRequest( |
| 113 | + f"/api/v1/items/{self.item_id}/commands", |
| 114 | + "SET_SPEED", |
| 115 | + {"SPEED": speed}, |
| 116 | + ) |
| 117 | + |
| 118 | + async def setPreset(self, preset: int): |
| 119 | + """ |
| 120 | + Sets the fan's preset speed — the speed used when the fan is |
| 121 | + turned on without specifying speed. |
| 122 | + |
| 123 | + Parameters: |
| 124 | + preset (int): Preset fan speed level: |
| 125 | + 0 - Off |
| 126 | + 1 - Low |
| 127 | + 2 - Medium |
| 128 | + 3 - Medium High |
| 129 | + 4 - High |
| 130 | + """ |
| 131 | + await self.director.sendPostRequest( |
| 132 | + f"/api/v1/items/{self.item_id}/commands", |
| 133 | + "DESIGNATE_PRESET", |
| 134 | + {"PRESET": preset}, |
| 135 | + )</code></pre> |
| 136 | +</details> |
| 137 | +<div class="desc"><p>Creates a Control4 object.</p> |
| 138 | +<h2 id="parameters">Parameters</h2> |
| 139 | +<p><code>C4Director</code> - A <code><a title="pyControl4.director.C4Director" href="director.html#pyControl4.director.C4Director">C4Director</a></code> object that corresponds to the Control4 Director that the device is connected to.</p> |
| 140 | +<p><code>item_id</code> - The Control4 item ID.</p></div> |
| 141 | +<h3>Ancestors</h3> |
| 142 | +<ul class="hlist"> |
| 143 | +<li><a title="pyControl4.C4Entity" href="index.html#pyControl4.C4Entity">C4Entity</a></li> |
| 144 | +</ul> |
| 145 | +<h3>Methods</h3> |
| 146 | +<dl> |
| 147 | +<dt id="pyControl4.fan.C4Fan.getSpeed"><code class="name flex"> |
| 148 | +<span>async def <span class="ident">getSpeed</span></span>(<span>self)</span> |
| 149 | +</code></dt> |
| 150 | +<dd> |
| 151 | +<details class="source"> |
| 152 | +<summary> |
| 153 | +<span>Expand source code</span> |
| 154 | +</summary> |
| 155 | +<pre><code class="python">async def getSpeed(self): |
| 156 | + """ |
| 157 | + Returns the current speed of the fan controller. |
| 158 | + |
| 159 | + Valid speed values: |
| 160 | + 0 - Off |
| 161 | + 1 - Low |
| 162 | + 2 - Medium |
| 163 | + 3 - Medium High |
| 164 | + 4 - High |
| 165 | + |
| 166 | + Note: |
| 167 | + Only valid for fan controllers. On non-dimmer switches, |
| 168 | + use `getState()` instead. |
| 169 | + |
| 170 | + Returns: |
| 171 | + int: Current fan speed (0–4). |
| 172 | + """ |
| 173 | + value = await self.director.getItemVariableValue(self.item_id, |
| 174 | + "CURRENT_SPEED") |
| 175 | + return int(value)</code></pre> |
| 176 | +</details> |
| 177 | +<div class="desc"><p>Returns the current speed of the fan controller.</p> |
| 178 | +<p>Valid speed values: |
| 179 | +0 - Off |
| 180 | +1 - Low |
| 181 | +2 - Medium |
| 182 | +3 - Medium High |
| 183 | +4 - High</p> |
| 184 | +<h2 id="note">Note</h2> |
| 185 | +<p>Only valid for fan controllers. On non-dimmer switches, |
| 186 | +use <code>getState()</code> instead.</p> |
| 187 | +<h2 id="returns">Returns</h2> |
| 188 | +<dl> |
| 189 | +<dt><code>int</code></dt> |
| 190 | +<dd>Current fan speed (0–4).</dd> |
| 191 | +</dl></div> |
| 192 | +</dd> |
| 193 | +<dt id="pyControl4.fan.C4Fan.getState"><code class="name flex"> |
| 194 | +<span>async def <span class="ident">getState</span></span>(<span>self)</span> |
| 195 | +</code></dt> |
| 196 | +<dd> |
| 197 | +<details class="source"> |
| 198 | +<summary> |
| 199 | +<span>Expand source code</span> |
| 200 | +</summary> |
| 201 | +<pre><code class="python">async def getState(self): |
| 202 | + """ |
| 203 | + Returns the current power state of the fan. |
| 204 | + |
| 205 | + Returns: |
| 206 | + bool: True if the fan is on, False otherwise. |
| 207 | + """ |
| 208 | + value = await self.director.getItemVariableValue(self.item_id, "IS_ON") |
| 209 | + return bool(value)</code></pre> |
| 210 | +</details> |
| 211 | +<div class="desc"><p>Returns the current power state of the fan.</p> |
| 212 | +<h2 id="returns">Returns</h2> |
| 213 | +<dl> |
| 214 | +<dt><code>bool</code></dt> |
| 215 | +<dd>True if the fan is on, False otherwise.</dd> |
| 216 | +</dl></div> |
| 217 | +</dd> |
| 218 | +<dt id="pyControl4.fan.C4Fan.setPreset"><code class="name flex"> |
| 219 | +<span>async def <span class="ident">setPreset</span></span>(<span>self, preset: int)</span> |
| 220 | +</code></dt> |
| 221 | +<dd> |
| 222 | +<details class="source"> |
| 223 | +<summary> |
| 224 | +<span>Expand source code</span> |
| 225 | +</summary> |
| 226 | +<pre><code class="python">async def setPreset(self, preset: int): |
| 227 | + """ |
| 228 | + Sets the fan's preset speed — the speed used when the fan is |
| 229 | + turned on without specifying speed. |
| 230 | + |
| 231 | + Parameters: |
| 232 | + preset (int): Preset fan speed level: |
| 233 | + 0 - Off |
| 234 | + 1 - Low |
| 235 | + 2 - Medium |
| 236 | + 3 - Medium High |
| 237 | + 4 - High |
| 238 | + """ |
| 239 | + await self.director.sendPostRequest( |
| 240 | + f"/api/v1/items/{self.item_id}/commands", |
| 241 | + "DESIGNATE_PRESET", |
| 242 | + {"PRESET": preset}, |
| 243 | + )</code></pre> |
| 244 | +</details> |
| 245 | +<div class="desc"><p>Sets the fan's preset speed — the speed used when the fan is |
| 246 | +turned on without specifying speed.</p> |
| 247 | +<h2 id="parameters">Parameters</h2> |
| 248 | +<p>preset (int): Preset fan speed level: |
| 249 | +0 - Off |
| 250 | +1 - Low |
| 251 | +2 - Medium |
| 252 | +3 - Medium High |
| 253 | +4 - High</p></div> |
| 254 | +</dd> |
| 255 | +<dt id="pyControl4.fan.C4Fan.setSpeed"><code class="name flex"> |
| 256 | +<span>async def <span class="ident">setSpeed</span></span>(<span>self, speed: int)</span> |
| 257 | +</code></dt> |
| 258 | +<dd> |
| 259 | +<details class="source"> |
| 260 | +<summary> |
| 261 | +<span>Expand source code</span> |
| 262 | +</summary> |
| 263 | +<pre><code class="python">async def setSpeed(self, speed: int): |
| 264 | + """ |
| 265 | + Sets the fan speed or turns it off. |
| 266 | + |
| 267 | + Parameters: |
| 268 | + speed (int): Fan speed level: |
| 269 | + 0 - Off |
| 270 | + 1 - Low |
| 271 | + 2 - Medium |
| 272 | + 3 - Medium High |
| 273 | + 4 - High |
| 274 | + """ |
| 275 | + await self.director.sendPostRequest( |
| 276 | + f"/api/v1/items/{self.item_id}/commands", |
| 277 | + "SET_SPEED", |
| 278 | + {"SPEED": speed}, |
| 279 | + )</code></pre> |
| 280 | +</details> |
| 281 | +<div class="desc"><p>Sets the fan speed or turns it off.</p> |
| 282 | +<h2 id="parameters">Parameters</h2> |
| 283 | +<p>speed (int): Fan speed level: |
| 284 | +0 - Off |
| 285 | +1 - Low |
| 286 | +2 - Medium |
| 287 | +3 - Medium High |
| 288 | +4 - High</p></div> |
| 289 | +</dd> |
| 290 | +</dl> |
| 291 | +</dd> |
| 292 | +</dl> |
| 293 | +</section> |
| 294 | +</article> |
| 295 | +<nav id="sidebar"> |
| 296 | +<div class="toc"> |
| 297 | +<ul></ul> |
| 298 | +</div> |
| 299 | +<ul id="index"> |
| 300 | +<li><h3>Super-module</h3> |
| 301 | +<ul> |
| 302 | +<li><code><a title="pyControl4" href="index.html">pyControl4</a></code></li> |
| 303 | +</ul> |
| 304 | +</li> |
| 305 | +<li><h3><a href="#header-classes">Classes</a></h3> |
| 306 | +<ul> |
| 307 | +<li> |
| 308 | +<h4><code><a title="pyControl4.fan.C4Fan" href="#pyControl4.fan.C4Fan">C4Fan</a></code></h4> |
| 309 | +<ul class=""> |
| 310 | +<li><code><a title="pyControl4.fan.C4Fan.getSpeed" href="#pyControl4.fan.C4Fan.getSpeed">getSpeed</a></code></li> |
| 311 | +<li><code><a title="pyControl4.fan.C4Fan.getState" href="#pyControl4.fan.C4Fan.getState">getState</a></code></li> |
| 312 | +<li><code><a title="pyControl4.fan.C4Fan.setPreset" href="#pyControl4.fan.C4Fan.setPreset">setPreset</a></code></li> |
| 313 | +<li><code><a title="pyControl4.fan.C4Fan.setSpeed" href="#pyControl4.fan.C4Fan.setSpeed">setSpeed</a></code></li> |
| 314 | +</ul> |
| 315 | +</li> |
| 316 | +</ul> |
| 317 | +</li> |
| 318 | +</ul> |
| 319 | +</nav> |
| 320 | +</main> |
| 321 | +<footer id="footer"> |
| 322 | +<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p> |
| 323 | +</footer> |
| 324 | +</body> |
| 325 | +</html> |
0 commit comments