Skip to content
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

Digital outputs multiple pin, same topic #136

Open
terminet85 opened this issue Oct 7, 2020 · 2 comments
Open

Digital outputs multiple pin, same topic #136

terminet85 opened this issue Oct 7, 2020 · 2 comments

Comments

@terminet85
Copy link

There is any change to turn on/off multiple pin with the same mqtt topic?

RPi.GPIO module should be able to manage it
chan_list = [11,12] # add as many channels as you want! # you can tuples instead i.e.: # chan_list = (11,12) GPIO.setup(chan_list, GPIO.OUT)

@terminet85
Copy link
Author

terminet85 commented Oct 8, 2020

I've made a PR in order to fix schema check.
RPi.GPIO are already capable to manage lists, so the problem was only in the config check.

digital_outputs:
  - name: fireplace
    module: raspberrypi
    pin:
       - 17
       - 27
       - 22
       - 5

@flyte
Copy link
Owner

flyte commented Oct 17, 2020

Hi, thanks for your work on this.

It's a good idea, but as far as I'm aware, your PR would break compatibility with all of the other output modules, such as pcf8574 which has a set_pin() implementation of:

    def set_pin(self, pin, value):
        self.io.port[pin] = value

As you can see, the pin value cannot be a list in this example.

In order to implement this, we'd need to establish which modules' underlying libraries are able to take lists of pins and set them all at once, then enable this functionality on just these modules.

As it stands, this is a relatively low priority for me compared to some of the other things on my list, so I wouldn't work on it any time soon, but pull requests to the effect are welcome.

I'll close the existing PR as it stands, but keep this issue open to track any progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants