title: asyncio.sleep() - how to use it?
body: <p>Can anyone help me out, I'm trying to get the program to pause if the condition is met. But as of now, its not sleeping at all. And I can't wrap my head around why. Im completely new to asyncio</p>
  <p>time.sleep() doesnt really work either, so I would prefer to use asyncio. Thanks alot!</p>
  <pre><code>from python_graphql_client import GraphqlClient
  import asyncio
  import os
  import requests
  
  loop = asyncio.get_event_loop()
  
  def print_handle(data):
      print(data[&quot;data&quot;][&quot;liveMeasurement&quot;][&quot;timestamp&quot;]+&quot; &quot;+str(data[&quot;data&quot;][&quot;liveMeasurement&quot;][&quot;power&quot;]))
      tall = (data[&quot;data&quot;][&quot;liveMeasurement&quot;][&quot;power&quot;])
      if tall &gt;= 1000:
          print(&quot;OK&quot;)
          # schedule async task from sync code
          asyncio.create_task(send_push_notification(data))
          print(&quot;msg sent&quot;)
          asyncio.create_task(sleep())
          
          
  
  client = GraphqlClient(endpoint=&quot;wss://api.tibber.com/v1-beta/gql/subscriptions&quot;)
  
  query = &quot;&quot;&quot;
  subscription{
    liveMeasurement(homeId:&quot;fd73a8a6ca&quot;){
      timestamp
      power
      
    }
  }
  &quot;&quot;&quot;
  
  query2 = &quot;&quot;&quot;
  mutation{
    sendPushNotification(input: {
      title: &quot;Advarsel! Høyt forbruk&quot;,
      message: &quot;Du bruker 8kw eller mer&quot;,
      screenToOpen: CONSUMPTION
    }){
      successful
      pushedToNumberOfDevices
    }
  }
  &quot;&quot;&quot;
  async def sleep():
      await asyncio.sleep(10)
  
  async def send_push_notification(data):
      #maybe update your query with the received data here
      await client.execute_async(query=query2,headers={'Authorization': &quot;2bTCaFx74&quot;}) 
      
  
  async def main():
      await client.subscribe(query=query, headers={'Authorization': &quot;2bTCaFxDiYdHlxBSt074&quot;}, handle=print_handle)
      
  asyncio.run(main())
  </code></pre>