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.

BOOSTER CONDIZIONATO
#1
good morning everyone, I ask for help for this script that I have tagged for the control of two variables "setpoint" and "temp", the goal is to activate a booster when the condition occurs ("delta" <= "setpoint" - "temp" ), where the "delta" is chosen by the system manager.
When changing the "setpoint", it is verified that the mathematical condition is active (sometimes for 1 pulse, other times for a few seconds) and then deactivates the two output groups. There is no perfect answer to the mathematical condition that I believe works perfectly by reading the impulse / temporary activation of the outgoing groups from the bus monitor.

value_1 = grp.getvalue ('7/0/0') - summer / winter
value_2 = grp.getvalue ('3/3/2') - set speed
value_3 = grp.getvalue ('6/0/2') - maunal command

temp = grp.getvalue ('2/2/7')
setpoint = grp.getvalue ('2/2/17')
delta = grp.getvalue ('3/1/202')

if (delta <= (setpoint-temp)) and (value_1 == true) and (value_3 == false) then
grp.write ('2/0/92', true)
grp.write ('6/0/92', value_2)

else

  grp.write ('2/0/92', false)
  grp.write ('6/0/92', 0) - byte to 0
   
end
Reply
#2
I don't fully understand your question. What exactly is not working for you? You can set poll interval for an object to send KNX read request periodically if data is not sent by a KNX device automatically.
Reply
#3
First correct your comments as they part of the code now.
Code:
value_1 = grp.getvalue ('7/0/0') -- summer / winter
value_2 = grp.getvalue ('3/3/2') -- set speed
value_3 = grp.getvalue ('6/0/2') -- maunal command

temp = grp.getvalue ('2/2/7')
setpoint = grp.getvalue ('2/2/17')
delta = grp.getvalue ('3/1/202')

if (delta <= (setpoint-temp)) and (value_1 == true) and (value_3 == false) then
grp.write ('2/0/92', true)
grp.write ('6/0/92', value_2)

else

  grp.write ('2/0/92', false)
  grp.write ('6/0/92', 0) -- byte to 0
   
end
------------------------------
Ctrl+F5
Reply
#4
(06.03.2020, 16:26)Daniel. Wrote: First correct your comments as they part of the code now.
Code:
value_1 = grp.getvalue ('7/0/0') -- summer / winter
value_2 = grp.getvalue ('3/3/2') -- set speed
value_3 = grp.getvalue ('6/0/2') -- maunal command

temp = grp.getvalue ('2/2/7')
setpoint = grp.getvalue ('2/2/17')
delta = grp.getvalue ('3/1/202')

if (delta <= (setpoint-temp)) and (value_1 == true) and (value_3 == false) then
grp.write ('2/0/92', true)
grp.write ('6/0/92', value_2)

else

  grp.write ('2/0/92', false)
  grp.write ('6/0/92', 0) -- byte to 0
  
end

daniel, in the translation of the texts the second indent is missing, in fact in the script the text is correctly preceded by the double - -

(06.03.2020, 15:28)admin Wrote: I don't fully understand your question. What exactly is not working for you? You can set poll interval for an object to send KNX read request periodically if data is not sent by a KNX device automatically.
the script does not execute the command stable command on the outgoing objects of the condition, sometimes it works other not!

sorry, having put the TAG on each object, just one of these changes to relaunch the script ?? if I put the TAG only to the three objects "delta" "setpoint" and "temp" the script is activated only when these 3 objects change ??
Reply
#5
Add log for the conditions to see if the condition was meet
------------------------------
Ctrl+F5
Reply
#6
how do I send a video of what's going on?
Reply
#7
upload it somewhere and drop a link
------------------------------
Ctrl+F5
Reply
#8
(09.03.2020, 13:31)Daniel. Wrote: upload it somewhere and drop a link
good evening daniel,

whenever possible I need support to solve this small but incessant problem:

value_1 = grp.getvalue('32/1/41')
value_2 = grp.getvalue('3/3/1')

if (value_1==true) then

grp.write('2/0/91', true)
grp.write('6/0/91', value_2)

else

os.sleep(60)
 
grp.write('2/0/91', false)
grp.write('6/0/91', 0)
 
end


from the bus monitor I keep having the addresses cyclically, to reduce the traffic I also put the "os.sleep (60)" but it doesn't work, every second it sends me on the bu sil value at 0 / off of these two addresses:

grp.write ('2/0/91', false)
grp.write ('6/0/91', 0)
Reply
#9
Send backup to PM
------------------------------
Ctrl+F5
Reply
#10
(16.04.2020, 07:22)Daniel. Wrote: Send backup to PM
good morning Daniel, let me know if you received it in the attachment, thanks.

Attached Files
.gz   Project-LM_PIOVESAN-2020.04.17-09.38.tar.gz (Size: 1.6 MB / Downloads: 5)
Reply
#11
Where is this script?
------------------------------
Ctrl+F5
Reply
#12
(17.04.2020, 08:23)Daniel. Wrote: Where is this script?
value_1 = event.getvalue()
value_2 = grp.getvalue('3/3/1')
value_3 = grp.getvalue('7/0/0') --estate / inverno

if (value_1==true) and (value_3==true) then

grp.write('2/0/91', true)
grp.write('6/0/91', value_2)

else

grp.write('2/0/91', false)
grp.write('6/0/91', 0)
 
end





[color=rgba(0, 0, 0, 0.87)]you can find it in the event scripts (3/0/206)[/color]
Reply
#13
(06.03.2020, 15:28)admin Wrote: I don't fully understand your question. What exactly is not working for you? You can set poll interval for an object to send KNX read request periodically if data is not sent by a KNX device automatically.

good morning Edgard,
I ask for help for this script as it happens that the value 0 of the two group addresses 2/0/91 and 6/0/91 are sent to me on the bus

value_1 = event.getvalue ()
value_2 = grp.getvalue ('3/3/1')
value_3 = grp.getvalue ('7/0/0') - summer / winter

if (value_1 == true) and (value_3 == true) then

grp.write ('2/0/91', true)
grp.write ('6/0/91', value_2)

otherwise

grp.write ('2/0/91', false)
grp. write ('6/0/91', 0)
 
end

(20.04.2020, 05:49)Hosutech Wrote:
(06.03.2020, 15:28)admin Wrote: I don't fully understand your question. What exactly is not working for you? You can set poll interval for an object to send KNX read request periodically if data is not sent by a KNX device automatically.

good morning Edgard,
I ask for help for this script as it happens that the value 0 of the two group addresses 2/0/91 and 6/0/91 are sent to me on the bus

value_1 = event.getvalue ()
value_2 = grp.getvalue ('3/3/1')
value_3 = grp.getvalue ('7/0/0') - summer / winter

if (value_1 == true) and (value_3 == true) then

grp.write ('2/0/91', true)
grp.write ('6/0/91', value_2)

otherwise

grp.write ('2/0/91', false)
grp. write ('6/0/91', 0)
 
end


good morning Edgard,
I discovered the problem that I created!
I need the way to activate a script only if there is a specific condition, I give an example:
in the summer run the script "x"
in winter run the script "y"

please help me?

(17.04.2020, 19:18)Hosutech Wrote:
(17.04.2020, 08:23)Daniel. Wrote: Where is this script?
value_1 = event.getvalue()
value_2 = grp.getvalue('3/3/1')
value_3 = grp.getvalue('7/0/0') --estate / inverno

if (value_1==true) and (value_3==true) then

grp.write('2/0/91', true)
grp.write('6/0/91', value_2)

else

grp.write('2/0/91', false)
grp.write('6/0/91', 0)
 
end



good morning Daniel,

I discovered the problem that I created!
I need the way to activate a script only if there is a specific condition, I give an example:
in the summer run the script "x"
in winter run the script "y"

please help me?
Reply
#14
You already have this in your script:

Code:
value_3 = grp.getvalue('7/0/0')

if values_3 then
  -- do something when value_3 is TRUE
else
  -- do something when value_3 is FALSE
end
Reply
#15
thanks Edgard,
the scripts are 2 that answer on the same address, both are started by the comparison and generate two obviously contrary results, one rightly inhibits the other, if it were possible to activate the Winter in Winter script and the Summer in Summer script would be perfect.

ESTATE

value_1 = grp.getvalue('7/0/0')
value_3 = grp.getvalue('6/0/1')

temp = grp.getvalue('2/2/1')
setpoint = grp.getvalue('2/2/11')
delta = grp.getvalue('3/1/201')

if (delta<=(temp-setpoint)) and (value_1==false) and (value_3==false) then

grp.write('3/0/206', true)

else

grp.write('3/0/206', false)

end

INVERNO

value_1 = grp.getvalue('7/0/0')
value_3 = grp.getvalue('6/0/1')

temp = grp.getvalue('2/2/1')
setpoint = grp.getvalue('2/2/11')
delta = grp.getvalue('3/1/201')

if (delta<=(setpoint-temp)) and (value_1==true) and (value_3==false) then

grp.write('3/0/206', true)

else

grp.write('3/0/206', false)

end
Reply
#16
Try this:
Code:
value_1 = grp.getvalue('7/0/0')
value_3 = grp.getvalue('6/0/1')

temp = grp.getvalue('2/2/1')
setpoint = grp.getvalue('2/2/11')
delta = grp.getvalue('3/1/201')

out = false

if not value_3 then
  if value1 then
    out = delta <= (setpoint - temp)
  else
    out = delta <= (temp - setpoint)
  end
end

grp.write('3/0/206', out)
Reply
#17
(20.04.2020, 06:54)admin Wrote: Try this:
Code:
value_1 = grp.getvalue('7/0/0')
value_3 = grp.getvalue('6/0/1')

temp = grp.getvalue('2/2/1')
setpoint = grp.getvalue('2/2/11')
delta = grp.getvalue('3/1/201')

out = false

if not value_3 then
  if value1 then
    out = delta <= (setpoint - temp)
  else
    out = delta <= (temp - setpoint)
  end
end

grp.write('3/0/206', out)
Thanks Edgard,
before inserting your new script for which I am grateful, I would like to better understand what the result will be as, with this formula, I seem to understand that the address 3/0/206 is sent only if the two conditions are verified in turn filtered from summer / winter.

I must point out that the 3/0/206 triggers an additional event script:
WINTER
value_1 = event.getvalue ()
value_2 = grp.getvalue ('3/3/1')
value_3 = grp.getvalue ('7/0/0') - summer / winter

if (value_1 == true) and (value_3 == true) then

grp.write ('2/0/91', true)
grp.write ('6/0/91', value_2)

else
 
grp.write ('2/0/91', false)
grp.write ('6/0/91', 0)
  
end

SUMMER
value_1 = event.getvalue ()
value_2 = grp.getvalue ('3/3/1')
value_3 = grp.getvalue ('7/0/0') - summer / winter

if (value_1 == true) and (value_3 == false) then

grp.write ('2/0/91', true)
grp.write ('6/0/101', value_2)

else
grp.write ('2/0/91', false)
grp.write ('6/0/101', 0)

  
end
Reply
#18
Like this:
Code:
event_value = event.getvalue()
summer = grp.getvalue('7/0/0') -- summer / winter

if event_value then
  out_value = grp.getvalue('3/3/1')
else
  out_value = 0
end

if summer then
  out_addr = '6/0/91'
else
  out_addr = '6/0/101'
end

grp.write('2/0/91', event_value)
grp.write(out_addr, out_value)

Your current script will fail with an error because you have single "-" instead of double dash for a comment.
This line will be evaluated an arithmetic expression "X = A - B / C"
Code:
value_3 = grp.getvalue ('7/0/0') - summer / winter
Reply
#19
(20.04.2020, 11:17)admin Wrote: Like this:
Code:
event_value = event.getvalue()
summer = grp.getvalue('7/0/0') -- summer / winter

if event_value then
  out_value = grp.getvalue('3/3/1')
else
  out_value = 0
end

if summer then
  out_addr = '6/0/91'
else
  out_addr = '6/0/101'
end

grp.write('2/0/91', event_value)
grp.write(out_addr, out_value)

Your current script will fail with an error because you have single "-" instead of double dash for a comment.
This line will be evaluated an arithmetic expression "X = A - B / C"
Code:
value_3 = grp.getvalue ('7/0/0') - summer / winter
Thanks Edgard,
I would never have been able to independently write a script of this type, unfortunately I never studied the programming code, I am self-taught and unfortunately I don't even know English.
I notice that there is no need to write for example:
if event_value = true then
but what you wrote is enough:
in event_value then

this means that when 7/0/0 = 1 (= summer)
else
(= winter) ??



event_value = event.getvalue ()
summer = grp.getvalue ('7/0/0') - summer / winter

if event_value then
out_value = grp.getvalue ('3/3/1')
else
out_value = 0
end

if summer then
out_addr = '6/0/91'
else
out_addr = '6/0/101'
end
Reply
#20
if value == true then and if value then work the same when value variable type is Boolean (true/false). If value for 7/0/0 is true then summer mode part is executed otherwise winter mode.
Reply


Forum Jump: