This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Reactor update by script
#1
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:

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


Messages In This Thread
Reactor update by script - by Guilhem - 04.09.2019, 11:16
RE: Reactor update by script - by admin - 04.09.2019, 12:31
RE: Reactor update by script - by Guilhem - 04.09.2019, 15:09

Forum Jump: