Help Widget Editor

Hello guys,
I’m new to the forum and I’m trying homegenie.
If possible I would need your help for editing a widget.

I’m trying to command a 2-way relay Finder using Rpi and another cheap relay.
I need modify a widget that when the button is pressed sends an impulse to the relay Finder via the cheap relay connected to the raspberry (Eg GPIO 22).
So far I have temporarily solved with TurnOffDelay 0.5 or with macro, but since the same relay finder, could also be operated by a normal button positioned on the wall, the status indicated in the widget should not be that of the same GPIO 22 (which would always be off) but that of the 3.3v signal coming from the second way of the relay Finder i’ve connected to the GPIO 18.

The questions:
Is possible in a single widget send command to a specific GPIO and receive the status from another GPIO ?

Perhaps it would be more appropriate if at the push of the button the widget would execute a program and contextually display the status of the signal (ES.GPIO 18)?

I hope someone wants to help me.

Hi, @roberto1979.

Looks like nobody has experience with programming GPIO in HG.
Personally, I use it only to control Z-Wave devices.

Hi Bounz,
nice to meet you,
maybe here the problem is widget editor more than GPIO programming,

I agree - I use the gpio’s myself without isses :slight_smile:

Interestingly what you want to do is similar to the code I am writing using esp32’s

I have a switch that triggers a local relay… it then sends the status of that relay to homegenie.
The widget in homegenie can also toggle that relay… toggling the relay locally updates homegenie…

So however you update it, homegenie should be able to track the status (uses MQTT)

1 Like

Dear David,
thank you for your reply.
At the moment i’m able to toggle relay using macro or button widget and read the status on another switch widget (3.3v signal circuit using a second gpio connent on 2way relay).
How i try to do is “toggle and read” realy status on the same widget.
How did you solve this problem?

You cant read the relay status, unless you take the voltage of the relay coil - or the contact state into a gpio.

I wrote logic into the software I am using to control the relay…

A diagram of what you are trying to do would help :slight_smile:

I will send you a diagram soon (i’m not in front PC now), anyway i think the 3.3v signal has to be considered like a sensor. If it is right, see the fact the standard widget for macro has 3 different circle light icon (red, gray and green) to identify the status of the macro (run, don’t run…etc…)… There is a way to modify the standard macro widget so that the circle light will show the status of a sensor connect on a gpio (instead show the macro status)?
Maybe Is there some documentation to help me modify the macro widget? (i’m not a programmer and i can’t find solution reading HG widget editor tutorial)…

Hi David,
this is the diagram with my situation.
Actually, i can Read the status of the 2 Way Relay (on sensor widget) from GPIO22 , and trigger from GPIO26 (macro).
I’m tryng to do an unique widget when i can trigger Relay (from gpio26) and read the status from Gpio22.

I know this is an old thread, but can anyone post their RPi version, OS, and version of HG that is working with the GPIO here? I’m trying to sort an issue on my end and need to know a working setup. Not trying to flood the forum, but not sure who’s still active thus the large quantity.