Is there a way to add the Modbus add the addresses to my Modbus device using the sys.device.addDevice? I successfully added a Modbus device using the module, but now I want to add the device addresses to the device. I don’t see a way to do that.
Did you figure how to add the addresses to your modbus device ?
I’m also interested in creating and defining new devices by scripts.
You don’t actually need to do that to access the data in the device. Just use the addTag scripting function with the appropriate address. If you look at the Address Mapping section here, you can see that adding the mappings for OPC browsing is a convenience, not a requirement.
Please, give us an example.
I need to access the Modbus devices datas (bits 0, 1, 2, 3, 4, 5, 6, 7, 8). I can’t.
You’ll have to be more specific. See the addressing guide here. Note that the modbus protocol doesn’t have any functions for accessing individual bits of 16-bit registers. You’ll have to read the entire register and extract the bits you want with boolean operations or the getBit() expression function, and merge booleans into integers to write back. See binEnc() for that.