catgiggle / octoprint-gpiocontrol Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU Affero General Public License v3.0
License: GNU Affero General Public License v3.0
A single button , not toggle, that can output a a timed pulse, for latched relays or other one shot triggers.
I had another GPIO plugin installed (OctoLight) and wanted to try this one out. It failed to load completely with the following stack trace:
2021-02-16 19:40:20,546 - octoprint.plugin.core - ERROR - There was an error loading plugin gpiocontrol
Traceback (most recent call last):
File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/plugin/core.py", line 1526, in load_plugin
plugin.load()
File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_gpiocontrol/__init__.py", line 150, in __plugin_load__
__plugin_implementation__ = GpioControlPlugin()
File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_gpiocontrol/__init__.py", line 19, in __init__
GPIO.setmode(GPIO.BCM)
ValueError: A different mode has already been set!
Disabling the other plugin allowed this to load, but maybe an error on the plugin settings page or something would be better.
Any chance of adding the GPIO Controls to the navbar? I know there are some already out there for navbar, but they only control one gpio or type of thing, like psu or lights and requires installing 2 different plugins. I have been waiting for someone to make a simple add X many gpio plugin.
Also it would be neet if you could make the icons change color or look when on or off. Like when you turn the power or light off, it would turn to a dark icon. And when on it would turn to a light or colored icons.
I am running Octopi 0.18.0 and GPIO Control 1.0.7.
When I add pin assignments on the configuration they are shown on the main Octoprint screen with ON and OFF buttons greyed out.
When I go into the configuration screen again and delete the original pin assignment (and save) the original assignment is still on the main Octoprint screen.
I have tried restarting Octoprint and rebooting the system. The problem remains.
Am I dong something wrong?
All the best,
Simon.
I have a lot of stuff on my sidebar and I need to scroll down frequently. The "GPIO Control" header doubles the amount of vertical space for my one switch. And I can't think of how it is useful. It would be nice if an option was added to hide the header.
Hi,
I'm the developer of OctoPod app and I got a request to add support for this plugin. I was looking at the source code of the plugin and it seems like there are APIs for turning on/off GPIO pins and to gather status. I was wondering if it would be possible to add the following:
Request 1 will let me fetch all info I need from OctoPod and I will use existing APIs to control pins. Request 2 will let OctoPod know when to refresh the UI whenever a change was made from OctoPrint web UI.
Thanks,
Gaston
<div id="sidebar_plugin_gpiocontrol" class="accordion-body collapse in ">
<div class="accordion-inner" data-test-id="sidebar-sidebar_plugin_gpiocontrol-content">
<div data-bind="foreach: gpioButtons">
<div class="gpiocontrol-button-row fluid-row">
<div class="gpiocontrol-button-label span7">
<i data-bind="class: icon" class="fas fa-power-off"></i>
<span data-bind="text: name">Printer</span>
</div>
<div class="gpiocontrol-button-controls input-prepend input-append span5">
<button class="btn" data-toggle="dropdown" data-bind="click: $parent.turnGpioOn, attr : {'disabled' : current_state != 'off'}">ON</button>
<button class="btn" data-toggle="dropdown" data-bind="click: $parent.turnGpioOff, attr : {'disabled' : current_state != 'on'}" disabled="true">OFF</button>
</div>
</div>
</div>
</div>
</div>
Is this configurable on my end?
In mobile mode, settings form is not displayed correctly. It should be scaled to display.
I noticed in version 1.0.4 (probably was similar before but I never used an earlier version) that only an admin is allowed to toggle a GPIO. After updating to 1.0.7 this has not changed. Is there a particular setting that will enable the buttons for operators or is this by design?
FYI OctoLight can be operated by operator level.
It is possible to select pin that doesn't exists. eg. GPIO0. Which causes error.
I'm running OctoPrint 1.5.3 on Python 3.9.1.
plugins.octoprint.org says it should run below python 4.
Is this plugin not compatible or is something in my setup broken?
GPIO Control is a really neat and useful plugin, however using it with multiple users and varying access levels seems to be cumbersome. Case in point, in the current version the plugin effectively requires that all users to be in the "Operator" group in order to control GPIO.
This is because:
For this reason, all users in the "Operator" group have the "USER" permission necessary to use GPIO Control. However, in my application users (and groups) are populated from LDAP and their permissions are inherited -- unfortunately this has no effect, and neither such user is allowed to perform GPIO Control API calls on the grounds of insufficient permissions.
Feature request: I would like to propose that this plugin adopts the new way of declaring and controlling granular permissions. This would solve the problem by allowing arbitrary groups, possibly different from "Operator", to be allowed API access to GPIO Control.
Is it possible to add inputs for things like physical buttons for this? The enclosure plug-in already does this but I find itβs interface to be very clunky, and this plugin is a lot more polished to me.
Hello Folks,
im tried your plugin on different gpio Pins.
When i do set an Pin, it will become High.
But when a Pin is configured, it stays high and cannot be toggled.
How can i fix this?
Im using a raspberry pi 2 (if this is nessessary to know)
When the GPIO state is changed by an external source, this change is not reflected by the plugin. Check the state of the GPIOs from time to time.
Hi after setup one Pin to trigger Lights I have this i log and plugin doesn't work at all...
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_gpiocontrol/init.py", line 200, in get_pin_number
if self.mode == GPIO.BCM:
AttributeError: 'module' object has no attribute 'BCM'
I set up the Pi4 to control a 2 relay module. Worked fine during testing. Shut down the system to put the case back together and rebooted. Now the side menu shows the 2 switches but they are greyed out, no control. Only way I have found to bring tyhem back is to clean up data for plugin and then create the switches again. Once rebooted, backed to greyed out and no control. Any suggestions?
Hi,
this mornig Octoprint notified me of an update to v1.0.5. It confirm the update and after the installation process the notification reappears and the previous installation (1.0.4) is valid.
Hi, I was not aware of your plugin when I wrote the OctoRelay plugin. Most of the functions are very similar, and I thought we could team up and merge the two plugins. What do you think?
https://github.com/borisbu/OctoRelay
As user I want to can update the switch through gcode commands
I am trying to get what i so far had solved with octoprints config.yaml with this GpioControl plugin.
So far, this has worked for me:
actions:
- action: printerOn
command: gpio mode 7 out; gpio write 7 0
name: Printer On
- action: printerOff
command: gpio mode 7 out; gpio write 7 1
name: Printer Off
- action: fanOn
command: gpio mode 0 out; gpio write 0 1
name: Fan On
- action: fanOff
command: gpio mode 0 out; gpio write 0 0
name: Fan Off
Trying to implement it with this plugin:
But the button is gray
what could be the problem?
I use Octoprint with an Orange Pi Win plus (instead of a raspberry Pi). So instead of RPi.GPIO library I Changed to OPi.GPIO. Pinout should be the same as raspberry pi.
Plugin installs and you can configure it. However buttons are disabled and don't work. Internal error 500 is shown on the webbrowser console.
Should I change anything else? what could cause this?
According the log:
2022-02-06 13:38:47,995 - octoprint.plugin - ERROR - Error while calling plugin gpiocontrol
OSError: [Errno 16] Device or resource busy
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/OctoPrint/venv/lib/python3.8/site-packages/OPi/GPIO.py", line 472, in setup
sysfs.export(pin)
File "/home/user/OctoPrint/venv/lib/python3.8/site-packages/OPi/sysfs.py", line 38, in export
fp.write(str(pin))
OSError: [Errno 16] Device or resource busy
During handling of the above exception, another exception occurred:
OSError: [Errno 22] Invalid argument
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/OctoPrint/venv/lib/python3.8/site-packages/octoprint/plugin/init.py", line 271, in call_plugin
result = getattr(plugin, method)(*args, **kwargs)
File "/home/user/OctoPrint/venv/lib/python3.8/site-packages/octoprint/util/init.py", line 1737, in wrapper
return f(*args, **kwargs)
File "/home/user/OctoPrint/venv/lib/python3.8/site-packages/octoprint_gpiocontrol/init.py", line 109, in on_after_startup
GPIO.setup(pin, GPIO.OUT)
File "/home/user/OctoPrint/venv/lib/python3.8/site-packages/OPi/GPIO.py", line 477, in setup
sysfs.unexport(pin)
File "/home/user/OctoPrint/venv/lib/python3.8/site-packages/OPi/sysfs.py", line 45, in unexport
fp.write(str(pin))
OSError: [Errno 22] Invalid argument
hi, nice plugin but is has some issues with the smart filament sensor plugin, it turns it off...
so sadly enough i can't use this plugin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.