Modbus RTU Master "device_path"

Moderator: RevPiModIO

Post Reply
Ibrahim Stracey
Posts: 12
Joined: 24 Jul 2019, 13:16
Answers: 0

Modbus RTU Master "device_path"

Post 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!
User avatar
RevPiModIO
KUNBUS
Posts: 322
Joined: 20 Jan 2017, 08:44
Answers: 0
Contact:

Re: Modbus RTU Master "device_path"

Post 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
python3-RevPiModIO - https://revpimodio.org/ || Der RevPi ist das Beste, was passieren konnte!
RMeissnerCC
Posts: 58
Joined: 03 Dec 2019, 10:29
Answers: 0

Re: Modbus RTU Master "device_path"

Post 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
Post Reply