Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dec 30 2021
Hello, Seasons greetings.
This is a fork of your code that I pulled back in November and used to extend the capability of the plugin, to support more relay board types. Take a look and see if it is worth integrating into the mainline at some point. I used it to add support for the "ProXR" serial protocol, used on the higher end industrial relay modules (of which I had one from relaypros (www-dot-relaypros-dot-com)).
Code still needs some polishing, and could be optimized, via refactoring, to use a few common methods for "state change" operations, triggered by UI events. I started to do this a bit but I was going to end up re-writing everything and so left it as-is.
There is a "null" relay plugin that does not do much except log or print messages when it is used. This can be used as an alternate relay board if you have only the basic GPIO-based one available. Check out the relay plugin registration file: octoprint_octorelay/relay_register.json.
One issue I have seen on Raspberry Pi's is that they can (annoyingly) attach a TTY to a USB/Serial adapter which the ProXR serial protocol does not like that much. I added some info on disabling the TTY using some systemctl settings but am not sure if it 100% fixed the problem. Perhaps using another type of serial adapter (connected to the relay board) would also fix this issue.
There is also another serial protocol used by some of the cheap Chinese relay boards that one sees on Amazon et. al. This protocol could be added in future, I have not yet determined what it is yet though... Certainly it is easily extendable to other relay types so lots of future expandability potential here.
Anyway, have a look and let me know if you want to pull it... will leave that up to you. It's in a different branch so it will not mess up your main development branch.
Cheers,