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.

Event script: last group address tag
#3
(13.05.2020, 16:15)admin Wrote: event.dst contains the group address that triggered the event

Hi admin,

thank you for your help. What is wrong with this script below?. Addresses have same tag and I would like that the last one which writes update the other one in the same way. Obviously it generates a loop and I would avoid with the script below. It does not work.
What do you suggest please?

Code:
value = grp.find(event.dst).value
last_thermostat = grp.find(event.dst).address

if last_thermostat == '0/0/1' then
tpid = storage.get('PID:' .. _SCRIPTNAME)
      if tpid ~= nil then
        os.kill(tpid, signal.SIGKILL)
      end
      pid = os.getpid() 
      storage.set('PID:' .. _SCRIPTNAME, pid)
      grp.write('0/0/2', value)
     else
      tpid = storage.get('PID:' .. _SCRIPTNAME)
      if tpid ~= nil then
        os.kill(tpid, signal.SIGKILL)
      end
      pid = os.getpid() 
      storage.set('PID:' .. _SCRIPTNAME, pid)
      grp.write('0/0/1', value)
end
  storage.delete('PID:' .. _SCRIPTNAME)
Reply


Messages In This Thread
RE: Event script: last group address tag - by Domoticatorino - 14.05.2020, 11:23

Forum Jump: