20.04.2020, 15:48
(20.04.2020, 11:17)admin Wrote: Like this:Thanks Edgard,
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
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