Files
OpenMQTTGateway/dev/use/actuators.html
DigiH 8889d3720e deploy: 296248f64b
deploy: 2440c143c0

deploy: 2440c143c0

deploy: 296248f64b

deploy: 296248f64b

deploy: a0919bbba4

deploy: 6a4b38a0cb

deploy: 4c633da151

deploy: 5a07020144

deploy: 25af43bdeb

deploy: 771b792484

deploy: 771b792484

deploy: 7db2e93c28

deploy: 5421f0e995

deploy: 5421f0e995

deploy: 5421f0e995

deploy: 5421f0e995

deploy: 5421f0e995

deploy: fb42293631

deploy: fb42293631

deploy: fb42293631

deploy: fb42293631

deploy: fb42293631

deploy: 87b26c867f

deploy: 2fcfc0f6d2

deploy: 2fcfc0f6d2

deploy: 2fcfc0f6d2

deploy: 2fcfc0f6d2

deploy: 54b0eaeebf

deploy: 28b97183be

deploy: cf21aed90c

deploy: 5a36034a2f

deploy: 811bc1f608

deploy: 811bc1f608

deploy: 673a895d44

deploy: 673a895d44

deploy: ca9ef664ab

deploy: ca9ef664ab

deploy: 10d7f7465ddd65a1ddcb1bc32504889d85602c4b

deploy: 495e1ce6b42f0293e4cf35c41a6bdb0bd229fa07

deploy: ca9ef664ab

deploy: ca9ef664ab

deploy: ca9ef664ab

deploy: 5e01f40829

deploy: 5e01f40829

deploy: 5e01f40829

deploy: 5e01f40829

deploy: 5e01f40829

deploy: 7a8e8483fd

deploy: 3984656712

deploy: 3984656712

deploy: 3984656712

deploy: 3984656712

deploy: 3984656712

deploy: 3984656712

deploy: 3984656712

deploy: 3984656712

deploy: 3984656712

deploy: 3984656712

deploy: dfa94588d6

deploy: dfa94588d6

deploy: dfa94588d6

deploy: dfa94588d6

deploy: e27e055bf8

deploy: cbec4292de
2024-02-19 12:44:47 -06:00

107 lines
29 KiB
HTML

<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Actuators | OpenMQTTGateway DEVELOPMENT SHA:2440c1 TEST ONLY</title>
<meta name="generator" content="VuePress 1.9.8">
<link rel="icon" type="image/png" sizes="32x32" href="/dev/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/dev/favicon-16x16.png">
<link rel="icon" href="/dev/img/Openmqttgateway_logo_mini.png">
<link rel="manifest" href="/dev/manifest.json">
<link rel="apple-touch-icon" sizes="180x180" href="/dev/apple-touch-icon.png">
<link rel="mask-icon" href="/dev/icons/safari-pinned-tab.svg" color="#3eaf7c">
<script type="module" src="https://unpkg.com/esp-web-tools@3.4.2/dist/web/install-button.js?module"></script>
<meta name="description" content="One gateway, many technologies: MQTT gateway for ESP8266, ESP32, Sonoff RF Bridge or Arduino with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, beacons detection, mi flora / mi jia / LYWSD02/ Mi Scale compatibility, SMS &amp; LORA.">
<meta name="theme-color" content="#3eaf7c">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="msapplication-TileImage" content="/favicon-144x144.png">
<meta name="msapplication-TileColor" content="#000000">
<link rel="preload" href="/dev/assets/css/0.styles.a0b2d6bb.css" as="style"><link rel="preload" href="/dev/assets/js/app.37616211.js" as="script"><link rel="preload" href="/dev/assets/js/2.fdf4d158.js" as="script"><link rel="preload" href="/dev/assets/js/47.7be7d795.js" as="script"><link rel="prefetch" href="/dev/assets/js/10.dd089e98.js"><link rel="prefetch" href="/dev/assets/js/11.d490c4a0.js"><link rel="prefetch" href="/dev/assets/js/12.3d9627b5.js"><link rel="prefetch" href="/dev/assets/js/13.8fdadc95.js"><link rel="prefetch" href="/dev/assets/js/14.53be8b0a.js"><link rel="prefetch" href="/dev/assets/js/15.9e7f640d.js"><link rel="prefetch" href="/dev/assets/js/16.167136e7.js"><link rel="prefetch" href="/dev/assets/js/17.1b24f802.js"><link rel="prefetch" href="/dev/assets/js/18.6002f660.js"><link rel="prefetch" href="/dev/assets/js/19.367029ed.js"><link rel="prefetch" href="/dev/assets/js/20.ea752e98.js"><link rel="prefetch" href="/dev/assets/js/21.18d93d02.js"><link rel="prefetch" href="/dev/assets/js/22.fe03e80f.js"><link rel="prefetch" href="/dev/assets/js/23.b3fe4fb1.js"><link rel="prefetch" href="/dev/assets/js/24.7aba9723.js"><link rel="prefetch" href="/dev/assets/js/25.3066b3ef.js"><link rel="prefetch" href="/dev/assets/js/26.69e1040e.js"><link rel="prefetch" href="/dev/assets/js/27.470891bf.js"><link rel="prefetch" href="/dev/assets/js/28.7bb3bf3e.js"><link rel="prefetch" href="/dev/assets/js/29.2c556663.js"><link rel="prefetch" href="/dev/assets/js/3.34967994.js"><link rel="prefetch" href="/dev/assets/js/30.ce1f59b8.js"><link rel="prefetch" href="/dev/assets/js/31.5f0a3678.js"><link rel="prefetch" href="/dev/assets/js/32.245763a7.js"><link rel="prefetch" href="/dev/assets/js/33.1eca4c74.js"><link rel="prefetch" href="/dev/assets/js/34.e9ee0ad9.js"><link rel="prefetch" href="/dev/assets/js/35.27d21c4b.js"><link rel="prefetch" href="/dev/assets/js/36.f55fd62f.js"><link rel="prefetch" href="/dev/assets/js/37.07a9d001.js"><link rel="prefetch" href="/dev/assets/js/38.4e8718a0.js"><link rel="prefetch" href="/dev/assets/js/39.e533c21d.js"><link rel="prefetch" href="/dev/assets/js/4.0b272843.js"><link rel="prefetch" href="/dev/assets/js/40.7e581684.js"><link rel="prefetch" href="/dev/assets/js/41.81202049.js"><link rel="prefetch" href="/dev/assets/js/42.ef29de3b.js"><link rel="prefetch" href="/dev/assets/js/43.9da33982.js"><link rel="prefetch" href="/dev/assets/js/44.24c08f06.js"><link rel="prefetch" href="/dev/assets/js/45.26e87af9.js"><link rel="prefetch" href="/dev/assets/js/46.39554abd.js"><link rel="prefetch" href="/dev/assets/js/48.4984bc04.js"><link rel="prefetch" href="/dev/assets/js/49.c8f0c8da.js"><link rel="prefetch" href="/dev/assets/js/5.805ba45a.js"><link rel="prefetch" href="/dev/assets/js/50.88b3398c.js"><link rel="prefetch" href="/dev/assets/js/51.7fb4b9e4.js"><link rel="prefetch" href="/dev/assets/js/52.547bcf23.js"><link rel="prefetch" href="/dev/assets/js/6.a203e05b.js"><link rel="prefetch" href="/dev/assets/js/7.bfb27966.js"><link rel="prefetch" href="/dev/assets/js/8.237c9201.js"><link rel="prefetch" href="/dev/assets/js/9.9ace8522.js">
<link rel="stylesheet" href="/dev/assets/css/0.styles.a0b2d6bb.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/dev/" class="home-link router-link-active"><!----> <span class="site-name">OpenMQTTGateway DEVELOPMENT SHA:2440c1 TEST ONLY</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="https://shop.theengs.io/" target="_blank" rel="noopener noreferrer" class="nav-link external">
Shop🆕
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="https://1technophile.blogspot.com" target="_blank" rel="noopener noreferrer" class="nav-link external">
Blog
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="/dev/" class="nav-link">
Docs
</a></div><div class="nav-item"><a href="https://community.openmqttgateway.com" target="_self" class="nav-link external">
Community
<!----></a></div><div class="nav-item"><a href="https://compatible.openmqttgateway.com/index.php/devices" target="_self" class="nav-link external">
Devices
<!----></a></div><div class="nav-item"><a href="/dev/upload/web-install.html" class="nav-link">
Upload
</a></div><div class="nav-item"><a href="https://app.theengs.io/" target="_blank" rel="noopener noreferrer" class="nav-link external">
Theengs
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <a href="https://github.com/1technophile/OpenMQTTGateway" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="https://shop.theengs.io/" target="_blank" rel="noopener noreferrer" class="nav-link external">
Shop🆕
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="https://1technophile.blogspot.com" target="_blank" rel="noopener noreferrer" class="nav-link external">
Blog
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="/dev/" class="nav-link">
Docs
</a></div><div class="nav-item"><a href="https://community.openmqttgateway.com" target="_self" class="nav-link external">
Community
<!----></a></div><div class="nav-item"><a href="https://compatible.openmqttgateway.com/index.php/devices" target="_self" class="nav-link external">
Devices
<!----></a></div><div class="nav-item"><a href="/dev/upload/web-install.html" class="nav-link">
Upload
</a></div><div class="nav-item"><a href="https://app.theengs.io/" target="_blank" rel="noopener noreferrer" class="nav-link external">
Theengs
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <a href="https://github.com/1technophile/OpenMQTTGateway" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav> <ul class="sidebar-links"><li><a href="/dev/" aria-current="page" class="sidebar-link">0 - What is it for 🏠</a></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>1 - Prerequisites🧭</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>2 - Set it up 🔨</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>3 - Upload ➡️</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>4 - Use ✈️</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/dev/use/rf.html" class="sidebar-link">RF gateways (RTL_433/RCSwitch/RF/RF2)</a></li><li><a href="/dev/use/ble.html" class="sidebar-link">BLE ESP32 gateway</a></li><li><a href="/dev/use/ir.html" class="sidebar-link">Infrared gateway</a></li><li><a href="/dev/use/lora.html" class="sidebar-link">LoRa gateway</a></li><li><a href="/dev/use/gsm.html" class="sidebar-link">GSM 2G gateway</a></li><li><a href="/dev/use/rs232.html" class="sidebar-link">RS232 gateway</a></li><li><a href="/dev/use/rfm69.html" class="sidebar-link">RFM69 gateway</a></li><li><a href="/dev/use/sensors.html" class="sidebar-link">Sensors</a></li><li><a href="/dev/use/actuators.html" aria-current="page" class="active sidebar-link">Actuators</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/dev/use/actuators.html#on-off-functionality" class="sidebar-link">ON/OFF Functionality</a></li><li class="sidebar-sub-header"><a href="/dev/use/actuators.html#fastled" class="sidebar-link">FASTLED</a></li><li class="sidebar-sub-header"><a href="/dev/use/actuators.html#pwm" class="sidebar-link">PWM</a></li><li class="sidebar-sub-header"><a href="/dev/use/actuators.html#somfy-rts" class="sidebar-link">Somfy RTS</a></li></ul></li><li><a href="/dev/use/boards.html" class="sidebar-link">Boards</a></li><li><a href="/dev/use/displays.html" class="sidebar-link">Displays</a></li><li><a href="/dev/use/gateway.html" class="sidebar-link">System commands (ESP only)</a></li><li><a href="/dev/use/webui.html" class="sidebar-link">WebUI</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>5 - Integrate 🎉</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>6 - Participate 💻</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="actuators"><a href="#actuators" class="header-anchor">#</a> Actuators</h1> <h2 id="on-off-functionality"><a href="#on-off-functionality" class="header-anchor">#</a> ON/OFF Functionality</h2> <p>The ON/OFF module of the OpenMQTTGateway provides you with the capability to control actuators, such as relays or LEDs, by assigning a HIGH or LOW value to a specific PIN through MQTT topics. For instance, you might connect a transistor to power a relay or an LED to the PIN.</p> <p>To operate the default GPIO, identified as ACTUATOR_ONOFF_GPIO, you'll need to issue certain commands which comply with the JSON receiving format.</p> <h3 id="standard-on-off-control"><a href="#standard-on-off-control" class="header-anchor">#</a> Standard ON/OFF control</h3> <p>The OFF command can be executed as follows:
<code>mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoONOFF -m '{&quot;cmd&quot;:0}'</code></p> <p>For the ON command, use:
<code>mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoONOFF -m '{&quot;cmd&quot;:1}'</code></p> <p>You can also specify the GPIO number that you wish to control:
<code>mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoONOFF -m '{&quot;gpio&quot;:15,&quot;cmd&quot;:1}'</code></p> <p>The status of the actuator will be published to the topic below every 2 minutes or upon state change.
<code>home/OpenMQTTGateway/ONOFFtoMQTT '{&quot;cmd&quot;:0}'</code></p> <p>In the case of the simple receiving format, the commands can be executed as follows:
OFF command: <code>mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoONOFF/setOFF -m 15</code>
ON command: <code>mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoONOFF/setON -m 15</code></p> <h3 id="pulse-control-for-short-activations"><a href="#pulse-control-for-short-activations" class="header-anchor">#</a> Pulse control for short activations</h3> <p>Additionally, the module also supports short activations, during which the PIN changes state for just half a second. This can be particularly useful when operating a relay board to trigger a step relay, thus allowing your home automation system to function as an auxiliary switch, without interfering with the existing switches in your house.</p> <p>This functionality is available only through the JSON receiving format.</p> <p>To switch ON for half a second before reverting to OFF:
<code>mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoONOFF -m '{&quot;gpio&quot;:15,&quot;cmd&quot;:&quot;high_pulse&quot;}'</code></p> <p>To switch OFF for half a second before reverting to ON:
<code>mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoONOFF -m '{&quot;gpio&quot;:15,&quot;cmd&quot;:&quot;low_pulse}'</code></p> <p>If you need to specify an activation duration other than half a second, include the pulse_length parameter along with the duration in milliseconds (ms).</p> <p>To switch ON for 25 ms before reverting to OFF:
<code>mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoONOFF -m '{&quot;gpio&quot;:15,&quot;cmd&quot;:&quot;high_pulse&quot;,&quot;pulse_length&quot;:25}'</code></p> <p>To switch OFF for 25 ms before reverting to ON:
<code>mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoONOFF -m '{&quot;gpio&quot;:15,&quot;cmd&quot;:&quot;low_pulse&quot;,&quot;pulse_length&quot;:25}'</code></p> <p>Recovery Functionality (ESP32 only)
In the event of power loss, by default, the module will record the last known state of the actuator and attempt to revert to this state upon restarting. For example, if a relay was ON at the time of a power outage, the firmware will attempt to switch the relay ON again once power is restored.</p> <p>If you prefer to disable this functionality, you can set the macro USE_LAST_STATE_ON_RESTART to false during the build time. Alternatively, you can issue the following command at runtime:
<code>mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoONOFF/config -m '{&quot;uselaststate&quot;:false,&quot;save&quot;:true}'</code></p> <h2 id="fastled"><a href="#fastled" class="header-anchor">#</a> FASTLED</h2> <h3 id="the-fastled-module-support-2-different-operation-modes"><a href="#the-fastled-module-support-2-different-operation-modes" class="header-anchor">#</a> The FASTLED module support 2 different operation modes</h3> <ol><li>control one specific RGB LED</li></ol> <ul><li>Set color</li> <li>Set blink</li></ul> <ol start="2"><li>Start fire animation (Fire2012)</li></ol> <h3 id="hardware-wiring"><a href="#hardware-wiring" class="header-anchor">#</a> Hardware wiring</h3> <p>Theoretically it should be possible to use every free IO pin. But after some tests only pin D2 works at WEMOS D1. Other platforms can work.
The default setting use NEOPIXEL (WS2812B). The simplest wiring is direct connect D2 to data pin of LED stripe and connect VCC/GND to power source. You should also add a capacitor.</p> <h2 id="pwm"><a href="#pwm" class="header-anchor">#</a> PWM</h2> <p>This module allows control over PWM outputs.
It's primary use is for controlling LEDs, but it should be equally at home controlling anything that's controlled using PWM.
E.g. LEDs, servos, PC fans.
You would typically connect a PWM output to a transistor or MOSFET to allow control over higher power devices.</p> <ul><li>JSON message format allows you to set any or all channels in a single message.</li> <li>Each channel can be set to smoothly transition from its current setting to the new setting over a specified number of seconds.</li> <li>Each channel can be calibrated with min and max settings, as well as a gamma curve.</li></ul> <h3 id="configuration"><a href="#configuration" class="header-anchor">#</a> Configuration</h3> <p>In order to use the PWM actuator, you need to configure which pins the PWM output channels will be connected to.
There are a couple of <code>#defines that achieve this. They can be defined in the</code>build_flags<code>section of the env, or by directly editing</code>config_PWM.h`.</p> <div class="language-c line-numbers-mode"><pre class="language-c"><code><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">define</span> <span class="token macro-name">PWM_CHANNEL_NAMES</span> <span class="token expression"><span class="token punctuation">{</span></span><span class="token string">&quot;r&quot;</span><span class="token expression"><span class="token punctuation">,</span> </span><span class="token string">&quot;g&quot;</span><span class="token expression"><span class="token punctuation">,</span> </span><span class="token string">&quot;b&quot;</span><span class="token expression"><span class="token punctuation">,</span> </span><span class="token string">&quot;w0&quot;</span><span class="token expression"><span class="token punctuation">,</span> </span><span class="token string">&quot;w1&quot;</span><span class="token expression"><span class="token punctuation">}</span></span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">define</span> <span class="token macro-name">PWM_CHANNEL_PINS</span> <span class="token expression"><span class="token punctuation">{</span> <span class="token number">25</span><span class="token punctuation">,</span> <span class="token number">33</span><span class="token punctuation">,</span> <span class="token number">32</span><span class="token punctuation">,</span> <span class="token number">23</span><span class="token punctuation">,</span> <span class="token number">22</span><span class="token punctuation">}</span></span></span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><code>PWM_CHANNEL_NAMES</code> lists the names that you would like to assign to each channel, and determines the number of channels.
<code>PWM_CHANNEL_PINS</code> lists the corresponding output pins that the channels will be connected to.
The number of entries in <code>PWM_CHANNEL_PINS</code> must exactly match the number of entries in <code>PWM_CHANNEL_NAMES</code>.</p> <h3 id="usage"><a href="#usage" class="header-anchor">#</a> Usage</h3> <h4 id="set"><a href="#set" class="header-anchor">#</a> Set</h4> <p><code>mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoPWM/set -m '{&quot;r&quot;:0.5,&quot;g&quot;:0.2,&quot;b&quot;:1,&quot;fade&quot;:10.0}'</code></p> <p>This example sets new values for the channels named <code>r</code>, <code>g</code>, and <code>b</code>.
These channels will transition from their current values to the new values over 10s.</p> <h4 id="calibrate"><a href="#calibrate" class="header-anchor">#</a> Calibrate</h4> <p>Calibration allows that min and max levels to be configured for each channel, so that the full 0-1 range of values
that can be specified with the <code>set</code> command actually do things.</p> <p><code>mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoPWM/calibrate -m '{&quot;min-r&quot;:0.01,&quot;max-r&quot;:1.0,&quot;gamma-r&quot;:2.5}'</code></p> <p>This example calibrates the channel named <code>r</code>.
After this calibration, if you set the <code>r</code> channel to 0.0, it will be remapped to 0.01 internally.
Also, the gamma curve for this channel will be set to 2.5.
This means that input values are raised to the power 2.5 internally.
This can be used to improve the linearity of inputs.</p> <h2 id="somfy-rts"><a href="#somfy-rts" class="header-anchor">#</a> Somfy RTS</h2> <p>This actuator allows to control Somfy RTS devices.</p> <h3 id="setup"><a href="#setup" class="header-anchor">#</a> Setup</h3> <p>Before the module can be used, virtual Somfy RTS remotes must be created.
This is done in <code>config_Somfy.h</code>.</p> <p><code>SOMFY_REMOTE_NUM</code> must be set to the number of virtual Somfy RTS remotes you want to have.
Then create for each of the virtual Somfy RTS remotes a unique 3-byte code and add them to <code>somfyRemotes</code>.
After a remote is setup, the order and codes should not be changed, else the setup process for all remotes have to be repeated.
Adding new codes at the end of the list is no problem.
Example of three virtual Somfy RTS remote codes:</p> <div class="language-C line-numbers-mode"><pre class="language-c"><code><span class="token keyword">const</span> <span class="token class-name">uint32_t</span> somfyRemotes<span class="token punctuation">[</span>SOMFY_REMOTE_NUM<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token number">0x5184c8</span><span class="token punctuation">,</span> <span class="token number">0xba24d0</span><span class="token punctuation">,</span> <span class="token number">0xb77753</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>Next the virtual Somfy RTS remotes must be paired with the Somfy RTS devices you want to control.
The next section describes how the PROG command/button of the virtual remote can be used.
Use the manual of the device you want to control for instructions on how to pair the virtual remote with the device.</p> <h3 id="commands"><a href="#commands" class="header-anchor">#</a> Commands</h3> <p>Commands must be send to the <code>commands/MQTTtoSomfy</code> subtopic.
Only json messages are supported.
The json message must contain two properties:</p> <ul><li>remote: the index of the remote which is used to send the command (index start at zero)</li> <li>command: the command which should be send with the remote as string, see <a href="https://github.com/Legion2/Somfy_Remote_Lib#available-commands" target="_blank" rel="noopener noreferrer">table of command names<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</li></ul> <p>Optionally it can contain the following property:</p> <ul><li>repeat: the number how often the command is repeated, default 4. Should be used to simulate long button presses, by increasing the repeat number, e.g. 20.</li></ul> <div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>The middle button on physical Somfy RTS Remote controls is called &quot;My&quot;.</p></div> <p>The frequency key is optional, if not set the gateway will use the default frequency defined by MQTTtoRF command at runtime or <code>RF_FREQUENCY</code> at buildtime.</p> <p>Send PROG command with remote 0:</p> <p><code>mosquitto_pub -t home/OpenMQTTGateway_Somfy/commands/MQTTtoSomfy -m '{&quot;remote&quot;:0,&quot;command&quot;:&quot;Prog&quot;,&quot;frequency&quot;:433.92}'</code></p> <p>Send Up command with remote 1:</p> <p><code>mosquitto_pub -t home/OpenMQTTGateway_Somfy/commands/MQTTtoSomfy -m '{&quot;remote&quot;:1,&quot;command&quot;:&quot;Up&quot;,&quot;frequency&quot;:433.92}'</code></p></div> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/1technophile/OpenMQTTGateway/edit/development/docs/use/actuators.md" target="_blank" rel="noopener noreferrer">Edit this page</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <div class="last-updated"><span class="prefix">Last Updated:</span> <span class="time">12/12/2023, 8:03:11 PM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
<a href="/dev/use/sensors.html" class="prev">
Sensors
</a></span> <span class="next"><a href="/dev/use/boards.html">
Boards
</a>
</span></p></div> </main></div><div class="global-ui"></div></div>
<script src="/dev/assets/js/app.37616211.js" defer></script><script src="/dev/assets/js/2.fdf4d158.js" defer></script><script src="/dev/assets/js/47.7be7d795.js" defer></script>
</body>
</html>