Code: Select all
2013-12-07 11:30:48Code: Select all
11:30, 07.12.Code: Select all
2013-12-07 11:30:48Code: Select all
11:30, 07.12.Code: Select all
newT = "%s:%s, %s.%s." % (t[11:13], t[14:16], t[8:10], t[5:7])Code: Select all
13:42:49 Traceback (most recent call last):
13:42:49 Python script "44", line 15, in <module>
13:42:49 Ute_time_formatert = "%s:%s, %s.%s." % (Ute_time[11:13], Ute_time[14:16], Ute_time[8:10], Ute_time[5:7])
13:42:49 NameError: name 'Ute_time' is not definedCode: Select all
import time
eg.event.payload_copy = eg.event.payload
my_data = eg.event.payload_copy.split(' ')
td = my_data[2] #temperature
tf = my_data[6] #humidity
timeStamp = str(
time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
)
[b]eg.globals.Ute_time = timeStamp[/b]
eg.globals.Ute_temp = td
eg.globals.Stua_fukt = tf
Ute_time_formated = "%s:%s, %s.%s." % (Ute_time[11:13], Ute_time[14:16], Ute_time[8:10], Ute_time[5:7])You need to use the full name of the variable "eg.globals.Ute_time" or it won't work.Mastiff wrote:I thought I had definded the Ute_time in line 11 of the the script, here in bold. This is the little script that's run:
Code: Select all
import time
eg.event.payload_copy = eg.event.payload
my_data = eg.event.payload_copy.split(' ')
td = my_data[2] #temperature
tf = my_data[6] #humidity
timeStamp = str(
time.strftime("%H:%M, %d.%m.", time.localtime())
)
eg.globals.Ute_temp = td
eg.globals.Stua_fukt = tf