300BlkPlinker wrote:How do I read that file so I can stick it into a variable?
True
True
False
True
...
file_name = "/tmp/pingresults"
with open(file_name, 'r', encoding='utf-8') as infile:
output = infile.read()
indigo.variable.updateValue(12345678, output) # Save the value as text to your variable
result = True if output == "True" else False # Output is a string, so if you want the boolean value True/False, you need to convert it.
file_name = "/tmp/pingresults"
with open(file_name, 'r', encoding='utf-8') as infile:
output = infile.read()
return True if output == "True" else False # if you don't return anything, the result is presumed to be False.
# Do this:
indigo.server.log("My text.")
# Not this:
print("My text.")
Users browsing this forum: No registered users and 2 guests