Issue with Gateway Timer Script

I’m trying to automatically run the following code as a Gateway Timer Script, but it doesn’t work, nevertheless when I run it for example by pressing a button it works perfectly.

The Ignition versión I’m working with is 7.7.8

	source = system.net.httpGet("https://opendata.aemet.es/opendata/api/observacion/convencional/datos/estacion/3195/?api_key=<key>")
	url=system.util.jsonDecode(source)
	
	url= (url["datos"])
	datos=source = system.net.httpGet(url)
	lista=system.util.jsonDecode(datos)
	temp=lista[23]['ta']
	humed=lista[23]['hr']
	t1=float(temp)
	h1=float(humed)
#	print(t1,h1)
	ruta=["Temp_ext_wunderground","Humedad_ext_wunderground"]
	valores=[t1,h1]
	system.tag.writeAll(ruta,valores)

I removed the API key from your code sample - I don't know if it's particularly sensitive, but figured I'd err on the side of caution. That said, the issue with your script is this line:

When you write to tags from the gateway scope, you need to use fully qualified tag paths, because even if there is only one tag provider, the gateway doesn't know which one is the "default" to use. Fully qualified paths have the tag provider name in square brackets as a prefix:
ruta=["[default]Temp_ext_wunderground","[default]Humedad_ext_wunderground"]

Thank you so much Paul. What a lapse :slight_smile:

Hi Paul,

I’ve tried with the full qualified path but it doesn’t work either when running as a Gateway script.

Check the logs in the gateway status page, and try adding “Import system” at the top of your script

Thank you, but adding import system hasn’t solved the issue. Please find ecnlosed the log, where I can’t see any thing related to this Gateway Script which I’ve calledlogs.bin.zip (307.5 KB)
Temp_aemet.

I have found the following in the log:

throwableInfot +Lorg/apache/log4j/spi/ThrowableInformation;xp gSet >com.inductiveautomation.ignition.common.script.TimerScriptTaskpppt Error executing global timer script: OFICINAS_ENGIE_MADRID/Temp_aemet @30,000ms . Repeat errors of this type will be logged as ‘debug’ messages.t binary-log-appendersr )org.apache.log4j.spi.ThrowableInformation¾þàrQ [ rept [Ljava/lang/String;xpur [Ljava.lang.String;­ÒVçé{G xp t "Traceback (most recent call last):t W File “<TimerScript:OFICINAS_ENGIE_MADRID/Temp_aemet @30,000ms >”, line 3, in t ÆIOError: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targett t 3 at org.python.core.Py.fromIOException(Py.java:215)t + at org.python.core.Py.IOError(Py.java:178)t v at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.httpGet(AbstractNetUtilities.java:196)t @ at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)t Y at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)t 4 at java.lang.reflect.Method.invoke(Method.java:483)t N at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:186)t { at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.call(ScriptManager.java:428)t 8 at org.python.core.PyObject.call(PyObject.java:387)t 8 at org.python.core.PyObject.call(PyObject.java:391)t _ at org.python.pycode._pyx170.f$0(<TimerScript:OFICINAS_ENGIE_MADRID/Temp_aemet @30,000ms >:25)t f at org.python.pycode._pyx170.call_function(<TimerScript:OFICINAS_ENGIE_MADRID/Temp_aemet @30,000ms >)t : at org.python.core.PyTableCode.call(PyTableCode.java:165)t / at org.python.core.PyCode.call(PyCode.java:18)t , at org.python.core.Py.runCode(Py.java:1275)t at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:624)t at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:583)t _ at com.inductiveautomation.ignition.common.script.TimerScriptTask.run(TimerScriptTask.java:99)t 2 at java.util.TimerThread.mainLoop(Timer.java:555)t - at java.util.TimerThread.run(Timer.java:505)w œ@px “ 3¼d ¬í sr !org.apache.log4j.spi.LoggingEventóò¹#tµ?