├── .editorconfig ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── MANIFEST.in ├── README.md ├── babel.cfg ├── octoprint_LEDStripControl ├── __init__.py └── templates │ └── LEDStripControl_settings.jinja2 ├── requirements.txt └── setup.py /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | charset = utf-8 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [**.py] 13 | indent_style = tab 14 | 15 | [**.js] 16 | indent_style = space 17 | indent_size = 4 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | 56 | # Flask stuff: 57 | instance/ 58 | .webassets-cache 59 | 60 | # Scrapy stuff: 61 | .scrapy 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | 66 | # PyBuilder 67 | target/ 68 | 69 | # IPython Notebook 70 | .ipynb_checkpoints 71 | 72 | # pyenv 73 | .python-version 74 | 75 | # celery beat schedule file 76 | celerybeat-schedule 77 | 78 | # dotenv 79 | .env 80 | 81 | # virtualenv 82 | venv/ 83 | ENV/ 84 | 85 | # Spyder project settings 86 | .spyderproject 87 | 88 | # Rope project settings 89 | .ropeproject 90 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Want to contribute? Great! First, read this page (including the small print at 2 | the end). 3 | 4 | ### Before you contribute 5 | 6 | Before we can use your code, you must sign the [Google Individual Contributor 7 | License 8 | Agreement](https://developers.google.com/open-source/cla/individual?csw=1) 9 | (CLA), which you can do online. The CLA is necessary mainly because you own the 10 | copyright to your changes, even after your contribution becomes part of our 11 | codebase, so we need your permission to use and distribute your code. We also 12 | need to be sure of various other things—for instance that you'll tell us if you 13 | know that your code infringes on other people's patents. You don't have to sign 14 | the CLA until after you've submitted your code for review and a member has 15 | approved it, but you must do it before we can put your code into our codebase. 16 | Before you start working on a larger contribution, you should get in touch with 17 | us first through the issue tracker with your idea so that we can help out and 18 | possibly guide you. Coordinating up front makes it much easier to avoid 19 | frustration later on. 20 | 21 | ### Code reviews 22 | All submissions, including submissions by project members, require review. We 23 | use Github pull requests for this purpose. 24 | 25 | ### The small print 26 | Contributions made by corporations are covered by a different agreement than 27 | the one above, the Software Grant and Corporate Contributor License Agreement. 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md 2 | recursive-include octoprint_LEDStripControl * 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OctoPrint-LEDStripControl 2 | 3 | OctoPrint Plugin that intercepts M150 GCode commands and controls local GPIOs accordingly. 4 | 5 | Implements the M150 command syntax from the latest Marlin. 6 | 7 | M150: Set Status LED Color - Use R-U-B for R-G-B Optional (W) 8 | M150 R255 ; Turn LED red 9 | M150 R255 U127 ; Turn LED orange (PWM only) 10 | M150 ; Turn LED off 11 | M150 R U B ; Turn LED white 12 | M150 W ; Turn LED white if using RGBW strips (optional) 13 | 14 | ## Setup 15 | 16 | 1. Make sure that the OctoPrint user is in the gpio group via the following command. 17 | 18 | usermod -a -G gpio pi 19 | 20 | 1. Install via the bundled [Plugin Manager](https://github.com/foosel/OctoPrint/wiki/Plugin:-Plugin-Manager) 21 | or manually using this URL: 22 | 23 | https://github.com/google/OctoPrint-LEDStripControl/archive/master.zip 24 | 25 | 1. Restart OctoPrint 26 | 27 | ## Configuration 28 | 29 | **NOTE: GPIO pins should be specified as physical number and not BCM number.** 30 | 31 | Configure the GPIO pins via the OctoPrint settings UI. 32 | 33 | ## Disclaimer 34 | 35 | This is **not** an official Google product. 36 | -------------------------------------------------------------------------------- /babel.cfg: -------------------------------------------------------------------------------- 1 | [python: */**.py] 2 | [jinja2: */**.jinja2] 3 | extensions=jinja2.ext.autoescape, jinja2.ext.with_ 4 | 5 | [javascript: */**.js] 6 | extract_messages = gettext, ngettext 7 | -------------------------------------------------------------------------------- /octoprint_LEDStripControl/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Google Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # coding=utf-8 17 | 18 | from __future__ import absolute_import 19 | import re 20 | 21 | import octoprint.plugin 22 | import pigpio 23 | try: 24 | import RPi.GPIO as GPIO 25 | except (ImportError, RuntimeError): 26 | # RuntimeError gets thrown when you import RPi.GPIO on a non Raspberry Pi 27 | GPIO = None 28 | 29 | phy_to_bcm = { 0:None, 1:None, 2:None, 3:2, 4:None, 5:3, 6:None, 7:4, 8:14, 30 | 9:None, 10:15, 11:17, 12:18, 13:27, 14:None, 15:22, 16:23, 31 | 17:None, 18:24, 19:10, 20:None, 21:9, 22:25, 23:11, 24:8, 25:None, 32 | 26:7, 27:0, 28:1, 29:5, 30:None, 31:6, 32:12, 33:13, 34:None, 33 | 35:19, 36:16, 37:26, 38:20, 39:None, 40:21 } 34 | 35 | class PiGPIOpin(object): 36 | def __init__(self, pigpiod, pin, logger): 37 | self._pigpiod = pigpiod 38 | self._logger = logger 39 | 40 | # attempt to convert the physical pin to a bcm pin 41 | # how is this not in a library already? 42 | if phy_to_bcm.get(pin) is not None: 43 | self._pin = phy_to_bcm[pin] 44 | else: 45 | self._pin = pin 46 | self._logger.debug(u"PiGPIOpin: coverted pin: %r to %r" % (pin, self._pin)) 47 | 48 | self._dutycycle = 0 49 | 50 | def start(self, dutycycle): 51 | self._dutycycle = dutycycle 52 | self._logger.debug(u"PiGPIOpin: start() pin: %s" % self._pin) 53 | if self._pigpiod.connected: 54 | self._pigpiod.set_PWM_range(self._pin, 100) # emulate RPi.GPIO 55 | self._pigpiod.set_PWM_dutycycle(self._pin, dutycycle) 56 | 57 | def stop(self): 58 | self._logger.debug(u"PiGPIOpin: stop() pin: %s" % self._pin) 59 | if self._pigpiod.connected: 60 | self._pigpiod.set_PWM_range(self._pin, 100) # emulate RPi.GPIO 61 | self._pigpiod.set_PWM_dutycycle(self._pin, 0) 62 | 63 | def ChangeDutyCycle(self, dutycycle): 64 | self._logger.debug(u"PiGPIOpin: ChangeDutyCycle() pin: %s" % self._pin) 65 | self.start(dutycycle) 66 | 67 | class LEDStripControlPlugin(octoprint.plugin.AssetPlugin, 68 | octoprint.plugin.SettingsPlugin, 69 | octoprint.plugin.ShutdownPlugin, 70 | octoprint.plugin.StartupPlugin, 71 | octoprint.plugin.TemplatePlugin): 72 | 73 | def __init__(self): 74 | self._leds = dict(r=None, g=None, b=None, w=None) 75 | self._pigpiod = None 76 | 77 | def _setup_pin(self, pin): 78 | self._logger.debug(u"_setup_pin(%s)" % (pin,)) 79 | if pin: 80 | p = None 81 | startup = 100.0 if self._settings.get_boolean(['on_startup']) else 0.0 82 | 83 | if self._pigpiod is None: 84 | self._pigpiod = pigpio.pi() 85 | 86 | if self._settings.get_boolean(['pigpiod']): 87 | if not self._pigpiod.connected: 88 | self._logger.error(u"Unable to communicate with PiGPIOd") 89 | else: 90 | p = PiGPIOpin(self._pigpiod, pin, self._logger) 91 | else: 92 | GPIO.setwarnings(False) 93 | GPIO.setmode(GPIO.BOARD) 94 | GPIO.setup(pin, GPIO.OUT) 95 | GPIO.output(pin, GPIO.HIGH) 96 | p = GPIO.PWM(pin, 100) 97 | p.start(startup) 98 | return p 99 | 100 | def _unregister_leds(self): 101 | self._logger.debug(u"_unregister_leds()") 102 | for i in ('r', 'g', 'b', 'w'): 103 | if self._leds[i]: 104 | self._leds[i].ChangeDutyCycle(0) 105 | self._leds[i].stop() 106 | 107 | if not self._settings.get_boolean(['pigpiod']) and GPIO: 108 | GPIO.cleanup() 109 | self._leds = dict(r=None, g=None, b=None) 110 | 111 | def _register_leds(self): 112 | self._logger.debug(u"_register_leds()") 113 | for i in ('r', 'g', 'b', 'w'): 114 | pin = self._settings.get_int([i]) 115 | self._logger.debug(u"got pin(%s)" % (pin,)) 116 | self._leds[i] = self._setup_pin(pin) 117 | 118 | def on_after_startup(self): 119 | self._logger.debug(u"LEDStripControl Startup") 120 | if GPIO: 121 | self._logger.debug(u"RPi.GPIO version %s" % (GPIO.VERSION,)) 122 | 123 | def on_shutdown(self): 124 | self._logger.debug(u"LEDStripControl Shutdown") 125 | self._unregister_leds() 126 | self._pigpiod.stop() 127 | 128 | def HandleM150(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwargs): 129 | if gcode and cmd.startswith("M150"): 130 | self._logger.debug(u"M150 Detected: %s" % (cmd,)) 131 | # Emulating Marlin 1.1.0's syntax 132 | # https://github.com/MarlinFirmware/Marlin/blob/RC/Marlin/Marlin_main.cpp#L6133 133 | dutycycles = {'r':0.0, 'g':0.0, 'b':0.0, 'w':0.0} 134 | for match in re.finditer(r'([RGUBWrgubw]) *(\d*)', cmd): 135 | k = match.group(1).lower() 136 | # Marlin uses RUB instead of RGB 137 | if k == 'u': k = 'g' 138 | try: 139 | v = float(match.group(2)) 140 | except ValueError: 141 | # more than likely match.group(2) was unspecified 142 | v = 255.0 143 | v = v/255.0 * 100.0 # convert RGB to RPi dutycycle 144 | v = max(min(v, 100.0), 0.0) # clamp the value 145 | dutycycles[k] = v 146 | self._logger.debug(u"match 1: %s 2: %s" % (k, v)) 147 | 148 | for l in dutycycles.keys(): 149 | if self._leds[l]: 150 | self._leds[l].ChangeDutyCycle(dutycycles[l]) 151 | 152 | return None, 153 | 154 | ##~~ SettingsPlugin mixin 155 | 156 | def get_settings_version(self): 157 | return 2 158 | 159 | def get_template_configs(self): 160 | return [ 161 | dict(type="settings", name="LED Strip Control", custom_bindings=False) 162 | ] 163 | 164 | def get_settings_defaults(self): 165 | return dict(r=0, g=0, b=0, w=0, pigpiod=False, on_startup=True) 166 | 167 | def on_settings_initialized(self): 168 | self._logger.debug(u"LEDStripControl on_settings_load()") 169 | 170 | self._register_leds() 171 | 172 | def on_settings_save(self, data): 173 | self._logger.debug(u"LEDStripControl on_settings_save()") 174 | self._unregister_leds() 175 | # cast to proper types before saving 176 | for k in ('r', 'g', 'b', 'w'): 177 | if data.get(k): data[k] = max(0, int(data[k])) 178 | octoprint.plugin.SettingsPlugin.on_settings_save(self, data) 179 | self._register_leds() 180 | 181 | def on_settings_migrate(self, target, current=None): 182 | self._logger.debug(u"LEDStripControl on_settings_migrate()") 183 | if current == 1: 184 | # add the 2 new values included 185 | self._settings.set(['w'], self.get_settings_defaults()["w"]) 186 | self._settings.set(['on_startup'], self.get_settings_defaults()["on_startup"]) 187 | 188 | ##~~ Softwareupdate hook 189 | 190 | def get_update_information(self): 191 | return dict( 192 | ledstripcontrol=dict( 193 | displayName="LED Strip Control Plugin", 194 | displayVersion=self._plugin_version, 195 | 196 | # version check: github repository 197 | type="github_release", 198 | user="google", 199 | repo="OctoPrint-LEDStripControl", 200 | current=self._plugin_version, 201 | 202 | # update method: pip 203 | pip="https://github.com/google/OctoPrint-LEDStripControl/archive/{target_version}.zip" 204 | ) 205 | ) 206 | 207 | __plugin_name__ = "LED Strip Control" 208 | __plugin_pythoncompat__ = ">=2.7,<4" 209 | 210 | def __plugin_load__(): 211 | global __plugin_implementation__ 212 | __plugin_implementation__ = LEDStripControlPlugin() 213 | 214 | global __plugin_hooks__ 215 | __plugin_hooks__ = { 216 | "octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information, 217 | "octoprint.comm.protocol.gcode.queuing": __plugin_implementation__.HandleM150 218 | } 219 | 220 | -------------------------------------------------------------------------------- /octoprint_LEDStripControl/templates/LEDStripControl_settings.jinja2: -------------------------------------------------------------------------------- 1 |
GPIO pins should be specified as physical pin numbers, not GPIO/BCM numbers.
3 | 4 | 45 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | OctoPrint 2 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Google Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # coding=utf-8 17 | 18 | plugin_identifier = "LEDStripControl" 19 | plugin_package = "octoprint_LEDStripControl" 20 | plugin_name = "OctoPrint-LEDStripControl" 21 | plugin_version = "0.3.7" 22 | plugin_description = """OctoPrint plugin for controling RGB LED Strips via local GPIO pins""" 23 | plugin_author = "Uriah Welcome" 24 | plugin_author_email = "uriah@google.com" 25 | plugin_url = "https://github.com/google/OctoPrint-LEDStripControl" 26 | plugin_license = "Apache" 27 | plugin_requires = ["RPi.GPIO", "pigpio==1.35"] 28 | 29 | plugin_additional_data = [] 30 | plugin_additional_packages = [] 31 | plugin_ignored_packages = [] 32 | additional_setup_parameters = {} 33 | 34 | from setuptools import setup 35 | 36 | try: 37 | import octoprint_setuptools 38 | except: 39 | print("Could not import OctoPrint's setuptools, are you sure you are running that under " 40 | "the same python installation that OctoPrint is installed under?") 41 | import sys 42 | sys.exit(-1) 43 | 44 | setup_parameters = octoprint_setuptools.create_plugin_setup_parameters( 45 | identifier=plugin_identifier, 46 | package=plugin_package, 47 | name=plugin_name, 48 | version=plugin_version, 49 | description=plugin_description, 50 | author=plugin_author, 51 | mail=plugin_author_email, 52 | url=plugin_url, 53 | license=plugin_license, 54 | requires=plugin_requires, 55 | additional_packages=plugin_additional_packages, 56 | ignored_packages=plugin_ignored_packages, 57 | additional_data=plugin_additional_data 58 | ) 59 | 60 | if len(additional_setup_parameters): 61 | from octoprint.util import dict_merge 62 | setup_parameters = dict_merge(setup_parameters, additional_setup_parameters) 63 | 64 | setup(**setup_parameters) 65 | --------------------------------------------------------------------------------