more G-Labs products

Author Topic: Monitor GPIO State  (Read 1984 times)

February 26, 2015, 05:19:16 PM
Read 1984 times

ccesario

  • *
  • Information
  • Newbie
  • Posts: 9
Hello, how can I update status of my GPIO Switches in case of it was changed by another application?

Because if I  change my GPIO status by command line, my Switch obcject in Homegenie does not updated.

eg.

Homegenie Switch status ON (GPIO 25)

by command line
gpio write 25 0

In homegenie web page the switch remain ONLINE.


Does someone have any idea!?

Thanks

Carlos

February 26, 2015, 06:32:01 PM
Reply #1

Wibo

  • ***
  • Information
  • Full Member
  • Posts: 95
Hi ccesario,

the raspberry-sharp-IO library only supports updating input pins on polling bases.
You're changing an output pin, so it doesn't know about the change.
Therefore HomeGenie doesn't know about the change.

My advise would be to let HomeGenie do the change for you, since it's in charge of the GPIO.

Regards,
Wibo.

February 26, 2015, 06:42:22 PM
Reply #2

ccesario

  • *
  • Information
  • Newbie
  • Posts: 9
Hello Wibo, thanks fby answer.

So, It is not possible to check GPIO status each 2 sec by example ?

How is the better way to check GPIO  status ? (If exists) ... And based in this status change other Object (switch by example).


Thanks

Carlos

February 26, 2015, 07:59:25 PM
Reply #3

Wibo

  • ***
  • Information
  • Full Member
  • Posts: 95
Hi Carlos,

I've never had the need to check the status of an output pin.
So I just don't know if the software supports that.

Maybe you could tell something about the reason you want to bypass HG to set the output.
When I know why you're doing that, maybe I or someone else has an alternative.

Regards,
Wibo.

February 26, 2015, 08:41:30 PM
Reply #4

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Couldn't you tell HG to switch the GPIO by accessing the appropriate URL?  This may be too slow for your needs though.  If that worked, then HG would know because it was applying the GPIO status change.

February 26, 2015, 09:11:01 PM
Reply #5

ccesario

  • *
  • Information
  • Newbie
  • Posts: 9
Well, I would like to check GPIO status, because I have a Voltage Sensor to identify a Lamp status, using 3-way connection between wall Switch and Raspberry Gpio (HomeGenie Switch).. Then I image that I need to know the GPIO/Voltage Sensor Status to update the Homegenie switch Status.

http://i.stack.imgur.com/cTU8P.jpg

Is it clear for you!?

Thank you

Carlos

February 26, 2015, 09:42:24 PM
Reply #6

Wibo

  • ***
  • Information
  • Full Member
  • Posts: 95
Hi Carlos,

I'm missing the voltage sensor in your schematic, but I'm going to assume it's connected to a GPIO input pin.
I understand what your problem is.

I think the easiest approach would be to write a small automation program.
The program should monitor the voltage sensor (that's possible because it's an input).
If you also remember the state of the output that drives the relay you could toggle the output.
That's what you want with a 3-way connection.

In theory it's possible, but I'm not skilled enough with the HG event system to know if it can do that.

Maybe someone can jump in here...

Regards,
Wibo.

February 27, 2015, 01:37:49 AM
Reply #7

ccesario

  • *
  • Information
  • Newbie
  • Posts: 9
Yes, it is that I would like to do. :)

March 17, 2015, 03:56:45 AM
Reply #8

NickP

  • *
  • Information
  • Newbie
  • Posts: 24
Take a look at the "GPIO modules" module it allows you to set RPi GPIO pins as inputs / outputs

Choose a pin for the relay and set it to OUT in the options dialogue, choose another pin for the sensor and set it to IN.