-
-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error after restarts: The GPIO channel has not been set up as an OUTPUT #1238
Comments
There's nothing I can see in the code that would cause this behavior. I've also never experienced it and have used this output type extensively (it was the very first Output created in Mycodo). Perhaps the power outages have caused fileysetem corruption. An uninterruptable power supply is recommended to allow proper shutdown and filesystem dismounting. If you can provide a way to replicate the issue without cutting the power to the Pi, I'll investigate the issue. I would suggest installing the OS/Mycodo on a new SD card and see if the issue persists, which will indicate if it's a filesystem/disk issue. |
The only reason I can think why this would happen is if you have something else set up to set your GPIO pins as something other than outputs (i.e. as input). You may be incorrectly using the GPIO State Condition rather than the Output State Condition in your Conditional Controller. |
I just updated the descriptions of the Conditions to make this distinction more clear in 503a708. |
Hi Kyle
Thanks for the response.
I do not see a way to replicate it without having the power go off.
I do now have a UPS on the system as well as backup power so avoiding the
problem in this manner.
Kind regards
…On Sun, 06 Nov 2022, 22:34 Kyle Gabriel, ***@***.***> wrote:
I just updated the descriptions of the Conditions to make this distinction
more clear in 503a708
<503a708>
.
—
Reply to this email directly, view it on GitHub
<#1238 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVSF45DUNENBW2WS7NOUNK3WHAB45ANCNFSM6AAAAAARQAK6VU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Is this the cause of the issue: #1238 (comment) ? |
I went to check the conditional controller, nothing seems out of place there to me, they are working with the output state condition and not GPIO state condition. This is my code is the conditional controller: # Example code for learning how to use a Conditional. See the manual for more information.
self.logger.info("Starting humidity measurement")
self.run_loop_count += 1 # Counts how many times the run code has been executed
measurement = self.condition("41d0035d") # Replace ID with correct Conditional ID
self.logger.info(f"Measurement value is {measurement}")
if measurement is not None: # If a measurement exists
self.message += "This message appears in email alerts and notes.\n"
if measurement < 88: # If the measurement is less than 80
self.message += f"Humidity is too Low! Measurement is {measurement}\n"
self.run_action("0d2f939e", message=self.message) # Run actions sequentially
elif measurement > 90: # Else If the measurement is greater than 27
self.message += f"Humidity is too High! Measurement is {measurement}\n"
self.run_action("59a1103a", message=self.message) # Run a single specific Action I went to have a look at the rest and wondering if this may be causing the problem: |
You are not describing your setup correctly. You are using a Measurement Condition, not the Output State Condition. This is why you are having an issue. There is also no reason to have a GPIO State Input in use. This is the reason for the output not working. You cannot use both a GPIO Output and a GPIO Input, i.e. a GPIO cannot simultaneously be set as an input and output. Delete the GPIO Input. Delete the Measurement Condition. Add an Output State Condition to the Conditional Function. |
Describe the problem/bug
I have 2 outputs that are controlled by conditional controllers. I have a few other outputs that I turn on and off manually.
We experience frequent power outages where I assume the PI shuts down and will restart again.
After this the 2 outputs that are automated no longer automatically switch on or off, and when manually trying to switch them they give the following error:
2022-10-27 12:23:22,099 - ERROR - mycodo.outputs.on_off_gpio_b1fcf97d - State change error: The GPIO channel has not been set up as an OUTPUT
Traceback (most recent call last):
File "/home/pi/Mycodo/mycodo/outputs/on_off_gpio.py", line 175, in output_switch
not self.options_channels['on_state'][output_channel])
RuntimeError: The GPIO channel has not been set up as an OUTPUT
If I go into the output and save it, it functions normally again until after another power outage.
A few more details that may be important:
The other outputs that are not under controllers switch on/off fine after the shutdown without having to be saved again.
I have moved the GPIO pin of the controlled output around on the PI to see if this makes a difference, no success.
I have even moved it to the GPIO pin of a previously working output that I used to switch on manually and modified the controller to control this output. The issue then carried over to that output as well...
Any advice on how to possibly add something in that automatically saves the outputs at certain intervals.
Or of course a solution that would prevent the issue altogether, any help would be appreciated.
Versions:
The text was updated successfully, but these errors were encountered: