I have a Python function set up to text me if my house gets above 30 degrees Celsius. The script also drives and LCD display that loops through various bits of weather info: house temp, humidity, outdoor conditions, and the times of streetcars.
Because the script is based on a loop, I get a text message every minute or so as long as the temperature is above 30 C. Ideally, I would like to find an elegant way to put the function to sleep while still calling it to check the temperature.
Below is an example of the code I'm using to trigger the IFTTT:
def send_event(api_key, event, value1=None, value2=None, value3=None):
"""Send an event to the IFTTT maker channel"""
url = "https://maker.ifttt.com/trigger/{e}/with/key/{k}/".format(e=event,
k=api_key)
payload = {'value1': value1, 'value2': value2, 'value3': value3}
return requests.post(url, data=payload)
Any and all help appreciated.
Thanks!