When i run the following i get the output i require from print. Then i am trying ti insert the results into my create file. I can input a property.text value in there and it works fine or just 'string' but when i try to call the results in there it just dosen't do anything.
alarms = system.alarm.queryStatus(state=["ActiveUnacked", "ClearAcked"])
for alarm in alarms:
print alarm.getName(), alarm.getState()
result
Dryer 7 Temp low Cleared, Acknowledged
Dryer 10 Temp High Cleared, Acknowledged
Dryer 5 Burner Fault Cleared, Acknowledged
when i run this
alarms = system.alarm.queryStatus(state=["ActiveUnacked", "ClearAcked"])
for alarm in alarms:
alarm1 = alarm.getName(), alarm.getState()
my_file = open('D:\send_file3.txt','w')
my_file.write('from call import Client\n')
my_file.write('account_sid = "test"\n')
my_file.write('auth_token = "test"\n')
my_file.write('client = Client(account_sid, auth_token)\n')
my_file.write('message = client.api.account.messages.create(to="+6140000000", from_="+614000000000", body=" ')
my_file.write(alarm1)
my_file.write(' ")')
my_file.close()
text file output
it writes all lines to
body="
then blank. If i change alarm1 to 'hello'
i get body="hello ").
What i want to achieve is
body="Dryer 7 Temp low Cleared, Acknowledged Dryer 10 Temp High Cleared, Acknowledged Dryer 5 Burner Fault Cleared, Acknowledged"
Any help would be appreciated.