Yes, you were completely right! I see the source of all my trouble and grief. Here it is for someone else's benefit.
I unraveled this and it is obvious now. Before I installed OpenPLC the first time, I installed a remote desktop TigerVNC. This installed into a virtual folder. Then when OpenPLC was installed this caused conflicts because of the virtual account TigerVPN had me create and that I was using and it all went down hill from there.
I did a complete re-install of Bookworm onto an NVMe and then did a new install of OpenPLC runtime onto the pi 5. It worked exactly as you said. I can read the modbus variables and they are updating.
There is one error that is being reported. It seems to be coming from the python code so I will list it here for you, but the variables in Monitoriing are updating.
OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
PSM: Starting PSM...
Traceback (most recent call last):
File "/home/admin/OpenPLC_v3/webserver/./core/psm/main.py", line 53, in <module>
update_inputs()
File "/home/admin/OpenPLC_v3/webserver/./core/psm/main.py", line 42, in update_inputs
TUF_BT_temp_1 = psm.get_var("IW100")
^^^^^^^^^^^^^^^^^^^^
File "/home/admin/OpenPLC_v3/webserver/core/psm/psm.py", line 90, in get_var
return a_inputs.getValues(address)[0]
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
My code is:
Issued start_modbus() command to start on port: 502
Server: Listening on port 502
Server: waiting for new client...
Issued stop_dnp3() command
PSM: Connected to PSM
Device TUF_BT_temp_1 is disconnected. Attempting to reconnect...
Persistent Storage is empty
Connected to MB device TUF_BT_temp_1
Issued start_modbus() command to start on port: 502
Modbus server already active. Restarting on port: 502
Server: Error accepting client!
~~~~~~~~~~~~~~~~~~~~~~~
#import all your libraries here
import psm
import time
#global variables
counter = 0
var_state = False
def hardware_init():
#Insert your hardware initialization code in here
psm.start()
def update_inputs():
#place here your code to update inputs
global counter
global var_state
TUF_BT_temp_1 = psm.get_var("IW100")
counter += 1
if (counter == 10):
counter = 0
var_state = not var_state
if __name__ == "__main__":
hardware_init()
while (not psm.should_quit()):
update_inputs()
# update_outputs()
time.sleep(0.1) #You can adjust the psm cycle time here
psm.stop()
~~~~~~~~~~~~~