![]() |
grp.checkwrite / grp.checkupdate - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: grp.checkwrite / grp.checkupdate (/showthread.php?tid=4472) |
grp.checkwrite / grp.checkupdate - Dré - 30.12.2022 I had the idea grp.checkwrite / grp.checkupdate don't work always. Are there limitation about when I can use it and when not? Maybe not all datatype? It looks like it doesn't always update the new value or do I look wrong? I understand grp.checkwrite is when it has to write to the KNX bus and grp.checkupdate if it is just local for the LM. RE: grp.checkwrite / grp.checkupdate - Daniel - 30.12.2022 grp.checkwrite is sending to TP and IP but on change of value. grp.checkupdate is sending only to IP but also on change of value. RE: grp.checkwrite / grp.checkupdate - Dré - 30.12.2022 Oké thanks. I think my problem was also not the right data type. RE: grp.checkwrite / grp.checkupdate - sx3 - 02.01.2023 and grp.write always send the value on TP and IP, even if the value inside LM is up to date? RE: grp.checkwrite / grp.checkupdate - admin - 02.01.2023 (02.01.2023, 11:39)sx3 Wrote: and grp.write always send the value on TP and IP, even if the value inside LM is up to date? Yes RE: grp.checkwrite / grp.checkupdate - Dré - 02.01.2023 No I remember what was going on, on my site; This is my line in my log this is what the current logs said about the value Code: P1 HomeWizzard [new and updated] 02.01.2023 12:57:03 this is a part of the script I use Code: --Reading electricity delivered by client (Tariff 2) in 0,001 kWh 14.4 byte My question is, is there a reason why he doesn't update the value? It looks like they are not the same, behind the dot. RE: grp.checkwrite / grp.checkupdate - admin - 02.01.2023 For floating point values default delta is 0.1. The difference between values is lower in your case. RE: grp.checkwrite / grp.checkupdate - Dré - 02.01.2023 Oké thanks, does it means I need to take another data type for solving this problem? RE: grp.checkwrite / grp.checkupdate - admin - 02.01.2023 The value will update when the difference is large enough. You can also specify delta manually as the third argument. Try 0.01 or 0.001 RE: grp.checkwrite / grp.checkupdate - Dré - 02.01.2023 Sounds interesting, do you have an example of this? RE: grp.checkwrite / grp.checkupdate - admin - 02.01.2023 Code: grp.checkupdate('51/0/10', returned_tarrif2, 0.01) RE: grp.checkwrite / grp.checkupdate - Dré - 02.01.2023 Great tanks, that was what I was looking for ? RE: grp.checkwrite / grp.checkupdate - 2MAX - 29.07.2024 Hi, where is error i my checkwrite, because if status objekt ChlazeniSGN (bool) is diference from 11/1/13, there is no write to bus Code: Antizamrz=grp.getvalue("11/1/120") RE: grp.checkwrite / grp.checkupdate - admin - 29.07.2024 Status object must be passed as the 4th argument. You need to pass status group address not value: Code: value = not Antizamrz and INtemp > 21.5 and VZT and Outtemp > 20 Some notes on your script: 1. Passing datatype to grp.getvalue() is not needed in most cases. 2. INtemp is converted to integer via math.ceil but then compared with a floating point value (21.5). You can either remove math.ceil or compare with an integer value (INtemp >= 22) 3. Instead of comparing with true/false you can simply use if Porucha1 and Porucha2 then 4. Generally it is recommended to use all lowercase variable names as mixed case can lead to errors due to typos because variables in Lua are case-sensitive. RE: grp.checkwrite / grp.checkupdate - Ranjeet - 27.11.2024 Hii sir , I have created resident script in which when a light ON in particular area it sends command to another object which tells me that a light is ON in this area the problem is that when i Active this script then logic machine become a slow or hang.and script sleep interval time is 0 second. Can you suggest me solution for this query. here is script -- -- Define the function that will run every 5 seconds function checkValues() -- Get the values from the grp (assuming grp.getvalue() returns the values for these keys) value = grp.getvalue('0/6/2') value2 = grp.getvalue('0/6/10') value3 = grp.getvalue('0/5/6') value4 = grp.getvalue('0/6/8') value5 = grp.getvalue('2/5/22') -- value5 is checked for >= 1 value18 = grp.getvalue('2/5/27') -- value18 is checked for >= 1 value19 = grp.getvalue('0/6/44') -- value19 is checked for >= 1 value20 = grp.getvalue('0/6/25') -- value20 is checked for >= 1 value21 = grp.getvalue('0/6/58') -- value21 is checked for >= 1 value22 = grp.getvalue('0/6/30') -- value22 is checked for >= 1 -- Adjust the conditions for clarity (use parentheses to ensure proper evaluation order) if (value or value2 or value3 or value4 or value5 >= 1 or value18 >= 1 or value19 >= 1 or value20 >= 1 or value21 >= 1 or value22 >= 1) then grp.write('0/6/65', true) -- Write true if any condition is met else grp.write('0/6/65', false) -- Write false otherwise end end -- Set the script to run every 5 seconds while true do checkValues() -- Call the function to check values os.execute("sleep 5") -- Sleep for 5 seconds before checking again end RE: grp.checkwrite / grp.checkupdate - Daniel - 27.11.2024 Use this instead https://kb.logicmachine.net/scripting/logic-functions-central-statuses/ |