HomeGenie Forum

General Category => General Discussion => Topic started by: ccesario on February 26, 2015, 05:19:16 PM

Title: Monitor GPIO State
Post by: ccesario on February 26, 2015, 05:19:16 PM
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
Title: Re: Monitor GPIO State
Post by: Wibo on February 26, 2015, 06:32:01 PM
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.
Title: Re: Monitor GPIO State
Post by: ccesario on February 26, 2015, 06:42:22 PM
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
Title: Re: Monitor GPIO State
Post by: Wibo on February 26, 2015, 07:59:25 PM
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.
Title: Re: Monitor GPIO State
Post by: bkenobi on February 26, 2015, 08:41:30 PM
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.
Title: Re: Monitor GPIO State
Post by: ccesario on February 26, 2015, 09:11:01 PM
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 (http://i.stack.imgur.com/cTU8P.jpg)

Is it clear for you!?

Thank you

Carlos
Title: Re: Monitor GPIO State
Post by: Wibo on February 26, 2015, 09:42:24 PM
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.
Title: Re: Monitor GPIO State
Post by: ccesario on February 27, 2015, 01:37:49 AM
Yes, it is that I would like to do. :)
Title: Re: Monitor GPIO State
Post by: NickP on March 17, 2015, 03:56:45 AM
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.