Hello,
I’m currently experimenting with a few control parameters for my battery and would like to use a script to change certain values via Modbus for testing.
In general, it should work like this (as a script):
- Change the ModBus sampling rate to 500ms during the test.
- Read the registers to be written (backup).
- Write the values using scripts.
- Perform the measurement (for time X).
- Rewrite the registers with the original values (restore the backup).
- Save the measured values as CSV (insert limit values as constants if necessary).
My questions:
Regarding 1: I configure my Modbus registers via the text file, not the GUI. For this, I create a things file for each device and a thing with multiple polls within it, because I poll certain values less frequently than others. How can I change the polling rate in a script, and what do I need to keep in mind?
Regarding 2, 3, and 5, I think it’s about reading a value, saving it in the script, and then writing it back.
Regarding 4 and 6: What’s the best way to do this using variables in the script / writing the values directly to the CSV / or working with the server database?
I can’t find any example where someone has done something like this before, and I’d like to trigger the script via a rule, which is why manually editing the things file is out of the question.
I’m curious to see if anyone has dealt with this before and can give me an idea of how to approach it.
Regards, Heiko