Page 1 of 1

Modbus RTU Master "device_path"

Posted: 12 Dec 2019, 13:48
by Ibrahim Stracey
Hi Sven,

Is the "variable" in the Virtual ModbusRTU Master called "device path" (where the tty* address of the connected device is written as a string) accessible through .io.[variable name].value? I'm attempting to write a script which updates these values in PiCtory based on which device path the RevPi assigns to some arduinos that I connect to it. I unfortunately have Arduino Micros which don't have unique serial addresses so I can't use udev rules.

Also, is there a way to reset the driver in a python script using RevPiModIO? I'm trying to also have the arduinos constantly checked to make sure they are still connected etc, but hot-swapping the USBs connecting the arduinos to the RevPI requires a driver reset in order to resume the modbus polling. Thanks in advance!

Re: Modbus RTU Master "device_path"

Posted: 02 Jan 2020, 16:46
by RevPiModIO
Oh man! Sorry for the late response!!!

I'm working on the memory handling in my library. Maybe you have some interesting ideas for handle them. The memories are now "int" values, which is totally bad for the device_path". So die .value will return 0, the .defaultvalue will return a very long int BUT you could use ._defaultvalue and get the raw bytes of the defaultvalue, which is defined in piCtory - So that will be your device_path with some \x00 Bytes... .strip() them.

I have no possibilities to edit the piCtory configuration from RevPiModIO. That was never an idea of that library. You could do that by parsing the JSON file and rewrite that (but be carefully). RevPiModIO will not be informed of a changed piCtory config. So this is a task for RevPiPyLoad.

RevPiPyLoad will check the piCtory configuration and will restart the services, after changes was detected. It will also start and monitor your Python program and could restart it. How do you start your Python program?

Sven

Re: Modbus RTU Master "device_path"

Posted: 11 May 2020, 14:46
by RMeissnerCC
Dear all,
did you find a solution Ibrahim?

I want to do something very similar, i.e., change "device_path" from a script/python and then reset the driver.
Best, Robert