Relay with pulse function over http

Hi,

I have a velleman vm201 8 channel relay controller. it can recieve commands over http. but i want to let it behave as a pulse function because all the lighting is controlled by pulse switches ( teleruptor ) in my house.

so it has to send a http command. to trigger the relay . a delay . and send the exact same http command to deactivate the relay . otherwise my push buttons in the house won’t work anymore. but the status in openhab must say switch on or off

switch on = http command ,delay, http command
switch off = http command, delay, http command

You have an item that can send the command and need a rule for the delay, or you need to create both the item and the rule?

hi,

if you could i need both :slight_smile:

I do not have a velleman device, I can help only with pointing toward the documentation. https://www.openhab.org/v2.3/addons/bindings/k80551/#prerequisites The device model is different but it’s all I found regarding Velleman.

That part is not going to work unless openHAB has some way to find out if the light is actually on or off. You can construct rules to toggle an Item on and off for each “press” of a button, but that will not stay in step with reality in case of a power cut or someone using a real wallswitch.

This thread might help

thanks ,

but this one is for u usb controlled velleman relay card. the vm201 does not have that.

rossko57.

I am trying to learn the openhab platform. I know if i don’t connect my push buttons to the openhab platform he will not know the state of the lights. for learning purposes i already want to try if i can toggle the http command for the velleman vm201. regardless the push buttons. if i manage to let this work . i will invest more in learning en spending on hardware to also connect the push buttons in the house.

Example

Items

// An Item to represent your light and go on your sitemap
Switch myLight "Light state"
// An Item to drive the pulse relay hardware
Switch myPulse "Pulse output" {binding to Velleman channel}

Rule

rule "trigger pulse output"
when
	Item myLight changed
then
       // we want to toggle the hardware to match the change of virtual switch
       // so we simulate a button push and release
       myPulse.sendCommand(ON)
       Thread::sleep(200)
       myPulse.sendCommand(OFF)
end
1 Like

We are getting closer . Now when i turn it on the lights would go nuts. it repeats the rule over and over :smiley:

items

Switch Mypulse “Pulse output” {http=">[ON:GET:(h)ttp://192.168.2.48/cgi/leds.cgi?led=1:on] >[OFF:POST:http://192.168.2.48/cgi/leds.cgi?led=1:off]"}

rule

rule “trigger pulse output”
when
Item Mypulse changed
then
Mypulse.sendCommand(ON)
Thread::sleep(200)
Mypulse.sendCommand(OFF)
end

Of course it does. Look at the trigger you have chosen for your rule.

Now look again at the TWO Items I suggested and the rule trigger Item that is different to the rule action Item.

1 Like

i don’t get it what i have to change.

Make two Items. One is not bound to anything, but this is the one to put into your sitemap as the controlling switch. It will represent the ON/OFF state of your actual light. It will accept commands to turn the light ON/OFF.

The other Item is to be bound to your Velleman relay, and it is to act as the simulated pushbutton. Push for on, push for off. You don’t need or want that in your sitemap.

The rule is to be triggered from the controlling Item.
When the controlling Item changes, it simulates a push of the button, followed after a little while by releasing the button.

1 Like

it works thank you , i made a mistake also with the http it was (h)ttp.

the whole openhab is harder than i tought . i want to control all my push buttons te switch te relays in the main board . ho boy :open_mouth:

rossko

can i connect the pulse switches in the wall to the gpio pins of the raspberry pi 2 to controll to read the state?

wall pulse switch pulses gpio pin --> command given to item to change UI state --> UI commands the velleman relay card to pulse :slight_smile:

I expect so - IF you can disconnect the wallswitch wiring completely from the mains power.
I’m not sure what the purpose is though? Reading if teh buttons are pressed will not tell you if the lights are on or not.

I don’t think that’s a good idea, because your lights cannot be operated if your openHAB is out of service for whatever reason, or even if you make a mistake in a rule or during an upgrade. There might be safety concerns about being in darkness.

Better to design openHAB as an add-on control system, that still allows ordinary reliable wallswitches as well.