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.

grp.checkwrite / grp.checkupdate
#1
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.
Reply
#2
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.
------------------------------
Ctrl+F5
Reply
#3
Oké thanks.

I think my problem was also not the right data type.
Reply
#4
and grp.write always send the value on TP and IP, even if the value inside LM is up to date?
Reply
#5
(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
Reply
#6
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
* string: returned_total: gr: 51/0/11 = 9434.957

this is a part of the script I use
Code:
        --Reading electricity delivered by client (Tariff 2) in 0,001 kWh            14.4 byte    
        --Teruggeleverd Elektriciteit Tarief 1
  returned_tarrif2 = data:match'1-0:2.8.2%((%d+.%d+)'   
  returned_tarrif2 = tonumber(returned_tarrif2)
   --log("returned_tarrif2: " ..returned_tarrif2)
  grp.checkupdate('51/0/10', returned_tarrif2)        --
--------------------
     returned_total =   returned_tarrif1 + returned_tarrif2
     grp.checkupdate('51/0/11', returned_total)        --   
log("returned_total: gr: 51/0/11 = " ..returned_total)   

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.
Reply
#7
For floating point values default delta is 0.1. The difference between values is lower in your case.
Reply
#8
Oké thanks, does it means I need to take another data type for solving this problem?
Reply
#9
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
Reply
#10
Sounds interesting, do you have an example of this?
Reply
#11
Code:
grp.checkupdate('51/0/10', returned_tarrif2, 0.01)
Reply
#12
Great tanks, that was what I was looking for ?
Reply
#13
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")
Outtemp=grp.getvalue("11/5/0",dt.float16)
INtemp=math.ceil(grp.getvalue("11/1/117",dt.float16))
Porucha1=grp.getvalue("11/1/118")
Porucha2=grp.getvalue("11/1/119")
ChlazeniSGN=grp.getvalue("11/1/113", dt.bool)

if Porucha1==true or Porucha2==true
  then grp.write("11/1/0", false) 
end

VZT=grp.getvalue("11/1/100")

if (Antizamrz==false and INtemp > 21.5 and VZT==true and Outtemp > 20)
    then grp.checkwrite('11/1/13', true, ChlazeniSGN)
  else
    grp.checkwrite('11/1/13', false, ChlazeniSGN)
end
Reply
#14
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
grp.checkwrite('11/1/13', value, nil, '11/1/113')

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


Forum Jump: