The docs say I can do this:
system.alarm.acknowledge(alarmIds, notes, user)
But when I do something like:
uuids = ["ca75c4eb-3f63-4cdc-a3d0-8862bdc405ab"]
system.alarm.acknowledge(uuids, "note", "user")
acknowledge(): expected 2 args; got 3
What am I doing wrong?
Where are you running the three argument script? system.alarm.acknowledge() with three arguments is scoped for the Gateway; with two arguments is scoped for the Client.
This was run from the script sandbox in the designer.
I’m not sure what you mean by scoped for the Gateway - doesn’t all the code live in the client? Or are the app.* project scripts the Gateway-scoped parts?
All code does not live in the client.
Some Python code can be run on the gateway and not in a client or designer.
“Event Scripts (Gateway)” contain Python scripts that are run on the Gateway. This is found under the Configuration folder in the Project Browser in the Designer.
app.* Python modules can be called from Python scripts running on the Gateway or clients/designers. So app.* Python modules are both Client and Gateway scoped.
Excellent, it all makes sense.
Thanks for the help,
Nick gave a good general explanation. Here’s some specifics about this particular function and why it’s different in the Client and Gateway…
When you run system.alarm.acknowledge from anywhere except the Gateway (ie Project > Event Scripts (Gateway) ), it’s using the Client scope. Because there’s a user logged in to the client (or designer, if that’s where you’re trying it out), the system doesn’t need a user argument – it uses the currently logged in user.
Gateway scripts, because they run on the Gateway (even though you write them in a screen on the Designer), need to know what user to associate with the acknowledgement. After all, there could be zero, one, or many users logged in to clients at the time. So the Gateway version needs a user parameter.
Hope that helps.