I’m trying to manage OpenHAB 2.5 operate discrete outputs of Wago 750-841 PLC for home lighting. I made a CodeSys program and configured OpenHAB, and it’s working. However there is small thing which not working correctly:
OpenHAB can switch light on, and reads status correctly if light was ON with a button, but for switching OFF I have to push switch quick twice. If I push “off” once it goes off, but then after 1 second it goes back to On. Can you please help me with that?
Here is my PLC program:
PROGRAM PLC_PRG
VAR
LIGHT1, LIGHT2 : Fb_LatchingRelay;
END_VAR
VAR_GLOBAL
EXT_LIGHT1 AT %MX0.0:BOOL; (*Modbus 12288*)
EXT_LIGHT1MEM AT %MX0.1:BOOL; (*Modbus 12289*)
EXT_LIGHT2 AT %MX0.2:BOOL; (*Modbus 12290*)
EXT_LIGHT2MEM AT %MX0.3:BOOL; (*Modbus 12291*)
END_VAR
LIGHT1(xSwitch:=BT1 OR EXT_LIGHT1); OU1:=LIGHT1.xActuator; EXT_LIGHT1MEM:=OU1; EXT_LIGHT1:=FALSE;
LIGHT2(xSwitch:=BT2 OR EXT_LIGHT2); OU2:=LIGHT2.xActuator; EXT_LIGHT2MEM:=OU2; EXT_LIGHT2:=FALSE;
With autoupdate=“false” switches acts same but little different. Switch goes to OFF, but light remain ON. But second click to switch turns OFF light. The problem is that states only changes when trigger goes from OFF to ON, but when it goes from ON to OFF nothing happens.
Here is what happens in log when I’m pushing switch once
11:40:42.309 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘LIGHT2’ received command OFF
11:40:42.310 [INFO ] [smarthome.event.ItemStateChangedEvent] - LIGHT2 changed from ON to OFF
11:40:42.991 [INFO ] [smarthome.event.ItemStateChangedEvent] - LIGHT2 changed from OFF to ON
i am using Wago PLC 750-8207 …and i want to turn on my physical output from plc , i used the Modbus address 512 for but i am unable to write and read it.
please help me out and please tell me what will be modbus adress for %QX0.0, and %IX0.0
My mistake was using button and variable in same place. Button is impulse signal 1 then 0, variable is constant. So only thing to do was intermediate variable. So I made a trigger. I’m using 1 modbus address per 1 light.
I’ve changed variables names since first time, here is a code:
TRG1A:=(EXTOUT_1A_R1 AND NOT OUT_1A_R1) OR (OUT_1A_R1 AND NOT EXTOUT_1A_R1);
LIGHT1A(xSwitch:=INP1A OR TRG1A, xCentOFF:=masterOFF, xCentOn:=masterON); OUT_1A_R1:=LIGHT1A.xActuator; EXTOUT_1A_R1:=OUT_1A_R1;
VAR
LIGHT1A: Fb_LatchingRelay;
TRG1A: BOOL;
Global variables:
EXTOUT_1A_R1 AT %MX0.0:BOOL; (*Modbusadresse 12288*)