AppleScript has no access to plugin device states. Plugins are written in Python, not AppleScript.
The script you posted above is a Python script that will call the "Insert Device State into Variable" action to insert what appears to be the "playStatus" state of an iTunes device into a variable (though it's syntactically incorrect - the last line should be indented). It is one technique you could use in a Python script if you wanted to do it in a script rather than use the action UI (you would of course want to use the correct state for the NOAA plugin as shown in the states list for it).
That is not what the actual action code does, however, since the script is calling the the action to do the work. A shortened version of what the plugin does (with no type or error checking, etc):
- Code: Select all
stateValue = indigo.devices[DEVICEID].states[DEVICESTATE] #get the state value from the device
indigo.variable.updateValue(VARID,value=stateValue) # set the variable value to the state value
I recommend calling the action as your script does though since the action makes sure that the variable type is correct and will do a lot of error checking (like make sure that the device id, state, and variable id's are correct and available).