04.09.2019, 11:16
Hello,
I'm trying to automatically link group objects to the reactor using a script that makes the modifications directly inside the database. For example, to link the object 1/1/x to the UIOy of the reactor as a digital output, I'm just doing this:
This is seemingly working, but actually the link is not really made (changing the boolean value of the object doesn't the state of the output in the reactor) until I manually edit one of the reactor entries. As soon I validate a single manual edit, all the entries start to work correctly.
I know that just updating the database doesn't work out of the box for some manipulations that are supposed to be done via the web interface, but there is always a workaround to make it work. I found 2 examples on the forum:
- Updating the schedulers (https://forum.logicmachine.net/showthread.php?tid=265): here the changes are made via a db update and are then validated by calling a special function;
- Updating the Modbus parameters (https://forum.logicmachine.net/showthread.php?tid=2200): here all the changes are made using a specific function that seems to simulate a web request.
As I don't understand exactly the internal mechanisms that are used in both cases, I can't figure out how to make it work for a reactor update but I guess that the solution is similar (and can be reproduced for any kind of update).
(And of course I'll be very happy if someone can explain quickly how it works so that next time I can succeed without asking :-) )
Thanks for your help!
I'm trying to automatically link group objects to the reactor using a script that makes the modifications directly inside the database. For example, to link the object 1/1/x to the UIOy of the reactor as a digital output, I'm just doing this:
Code:
name = 'Digital Output 1'
x = 1
y = 1
db:query('UPDATE reactorra SET name = ?, address = ?, bus_write = 1, param_1 = "out_bin", param_3 = 0, param_4 = 0 WHERE id = ?', name, knxlib.encodega("1/1/" .. x), "io-" .. y)
This is seemingly working, but actually the link is not really made (changing the boolean value of the object doesn't the state of the output in the reactor) until I manually edit one of the reactor entries. As soon I validate a single manual edit, all the entries start to work correctly.
I know that just updating the database doesn't work out of the box for some manipulations that are supposed to be done via the web interface, but there is always a workaround to make it work. I found 2 examples on the forum:
- Updating the schedulers (https://forum.logicmachine.net/showthread.php?tid=265): here the changes are made via a db update and are then validated by calling a special function;
- Updating the Modbus parameters (https://forum.logicmachine.net/showthread.php?tid=2200): here all the changes are made using a specific function that seems to simulate a web request.
As I don't understand exactly the internal mechanisms that are used in both cases, I can't figure out how to make it work for a reactor update but I guess that the solution is similar (and can be reproduced for any kind of update).
(And of course I'll be very happy if someone can explain quickly how it works so that next time I can succeed without asking :-) )
Thanks for your help!