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
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.
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.
// 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
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.
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.