WebThingsIO / gpio-adapter

GPIO adapter add-on for WebThings Gateway
Mozilla Public License 2.0
5 stars 12 forks source link

Add PushButton support #27

Closed brynjonesmm closed 5 years ago

brynjonesmm commented 5 years ago

How do i add the pushbutton capability to my gateway? i just set it up and only have on/off capability.

thanks

mrstegeman commented 5 years ago

Capabilities are specific to devices. Do you have a specific push button device you're trying to use?

brynjonesmm commented 5 years ago

I want to have a momentary bottom on the dashboard to activate garage door via gpio output. I have a on off button on dashboard but need momentary.

BRYN JONES


From: Michael Stegeman notifications@github.com Sent: Tuesday, December 4, 2018 2:22:35 PM To: mozilla-iot/gateway Cc: Bryn Jones; Author Subject: Re: [mozilla-iot/gateway] pushbutton (#1529)

Capabilities are specific to devices. Do you have a specific push button device you're trying to use?

โ€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/mozilla-iot/gateway/issues/1529#issuecomment-444244299, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AfSS2GT1manYNcz6sfYw2pyr8zCN9w5kks5u1tmLgaJpZM4ZAurV.

mrstegeman commented 5 years ago

@dhylands would be of help here. I believe GPIO devices are only represented as on/off switches right now.

dhylands commented 5 years ago

I think that its a case of adding PushButton support to the gpio-adapter. The gpio-adapter was written long before capabilities existed.

brynjonesmm commented 5 years ago

Hello. How do i go about doing that? Thanks for your help.

brynjonesmm commented 5 years ago

Hello. How do i go about adding PushButton tothe adapter? Thanks for your help.

dhylands commented 5 years ago

I'm planning on adding that real soon now (next week).

Dave Hylands

On Fri, Dec 7, 2018 at 1:27 PM brynjonesmm notifications@github.com wrote:

How do i add the pushbutton capability to my gateway? i just set it up and only have on/off capability.

thanks

โ€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mozilla-iot/gpio-adapter/issues/27, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHyDIdnmbkTAzzwKmRDrTsYzret3u3Oks5u2rMigaJpZM4ZI7mD .

-- Dave Hylands Peachland, BC, Canada http://www.davehylands.com

brynjonesmm commented 5 years ago

Thank you. Please let me know when this goes through. ๐Ÿ‘๐Ÿ‘

brynjonesmm commented 5 years ago

@dhylands What else are you planning to release this week? I'm planning on using this pushbutton to control a relay board that's connected to garage door openers in my shop, so employees can open the doors from their phones when bringing product in for production! :) Its getting cold here so my employees are anxious to get this working... :D Thanks.

brynjonesmm commented 5 years ago

How do i get this functionality on my gateway/update my add-on?

dhylands commented 5 years ago

The gpio-adapter has just been updated to version 0.6.1

You should be able to go into Settings->Addons and you should see an Update button if your GPIO adapter is earlier than 0.6.1.

Once updated, when you configure a GPIO pin you can now select "in - BinarySensor" or "in - PushButton" under the direction.

If the pin was already configured as "in" you'll need to remove the pin and then Disable and re-enable the GPIO adapter, and then click + on the Things screen to add the newly configured push button.

dhylands commented 5 years ago

When I said remove the pin, I meant remove the thing, not remove the configuration. So from the things screen, you'd click on the "detail" (splat) for the input, and then click the 3 veritcal dots in the bottom right and choose "Remove".

dhylands commented 5 years ago

A slightly simpler workflow would be to first remove all of the pins that you want to change from BinarySensor to PushButton, then change the configuration for all of the pins, and the click "Apply". Clicking Apply will disable and re-enable the gpio-adapter. You should then be able to add the new pushbuttons by clicking + on the things screen.

brynjonesmm commented 5 years ago

This is a pushbutton in, I'm looking for a pushbutton out??

mrstegeman commented 5 years ago

PushButton output doesnโ€™t make much sense. A button is inherently an input.

brynjonesmm commented 5 years ago

Ok momentary switch rather than on/off.

dhylands commented 5 years ago

So basically you want a pulse generator?. Something which when triggered generates a pulse of some width. We don't currently have any UI to support this.

You could set up a rule such that when the OnOff signal goes to On the result of the rule sets it to Off. You don't get to control the pulse width in this case.

I guess another type of control could be something where mouse-down (i.e. pushing on the thing on the screen) generates an event and mouse-up generates another event and these could be tied into the rules engine to control a thing.

dhylands commented 5 years ago

I just added a new adapter which can generate pulses, called "Pulse". You can set a duration in seconds. Then use the rules engine to create 2 rules. One which takes the Pulse On and causes it to set your GPIO On, and another which takes your Pulse Off and causes it to set your GPIO Off.

You can then pulse the pulse device on the UI and it will go on for the configured number of seconds. Since you want people to push the Pulse device. For safety you could add another rule which takes the GPIO On as input and sets the Pulse On. This way when you push either device you'll get a pulse output.