I would like to be able to create a script that changes the alarm expression, I managed to get it this far but it only accepts integers or floats if I do an expression it doesnt work:
No errors just wont change the value, if I put in a 20 for instance it’ll show 20 but if I then put this '{[.]temp_1_sp} - 25', it’ll still show the 20 so it wont accept it
Create the tag alarm with the expression you want, or an example at least, and see check the tag json. It's going to have an object value instead of a string
Curious so I asked the AI overlords. Seems to be an issue with configure trying to overwrite read-only values when you write it back in. It suggested to only build alarms and name in config and then use "m" to merge instead of overwrite. There is also an example #3 in the documentation you can reference as an example though that's for creating one rather than modifying one.
This code fails silently because of how system.tag.getConfiguration and system.tag.configure interact.
You are fetching the entire configuration of the tag (including read-only properties like lastModified, quality, tagPath, accessRights, etc.) and feeding it straight back into configure.
When system.tag.configure sees these read-only properties in "Overwrite" ("o") mode, it often rejects the update or behaves unpredictably because it cannot overwrite those system-managed properties.
Collision Policy "m" (Merge):
Using "o" (Overwrite) on a tag when you only provide the alarms property is dangerous. It might convert your tag into a generic Folder or remove its Data Type.
Using "m" (Merge) ensures we only update the alarms list without touching the rest of the tag configuration.
Expressions are only auto-interpreted in the designer. In a configure script, you have to provide the object (dictionary, typically) that represents the binding expression, and it cannot be set with system.tag.write*().