Announcement

Collapse
No announcement yet.

race condition with global variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • race condition with global variables

    I'm hoping for some guidance on how to use device groups and scripts.

    My homeseer receives data from mqtt sources and updates a virtual device values. I have a device group consisting of ~20 of these virtual devices. I have an event that triggers based on "Any device in group mqttX has its value changed", and the action is to run a script. First thing in my script I read the et global variables to find out which device changed.

    It appears that when I have lots of incoming mqtt messages, the global variable is changed sometime between the start of the event and the part in my script where I grab the values. In some cases, the variables are changing at the same time as I read them in the script, resulting in some variables set from the first mqtt msg and some variables set from the next one.

    My scripts are set to "wait for script to finish" and "only allow one instance", but I don't think that's stopping EasyTrigger from changing the variables before blocking on script execution.

    Am I just using this wrong?

    thanks!

  • #2
    I believe you are correct that race conditions can occur and that the "wait for script to finish" and "only allow one instance" are not intended to address that issue.

    Comment

    Working...
    X