Moderator: RevPiModIO

Ibrahim Stracey
Topic Author
Posts: 12
Joined: 24 Jul 2019, 13:16

Modbus RTU Master "device_path"

12 Dec 2019, 13:48

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!
User avatar
Posts: 249
Joined: 20 Jan 2017, 08:44

Re: Modbus RTU Master "device_path"

02 Jan 2020, 16:46

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?

python3-RevPiModIO - || Der RevPi ist das Beste, was passieren konnte!
Posts: 58
Joined: 03 Dec 2019, 10:29

Re: Modbus RTU Master "device_path"

11 May 2020, 14:46

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

Who is online

Users browsing this forum: No registered users and 2 guests