title: How to detect changes in firebase child with python?
body: <p>I have some troubles with this application. What I need is that If I detect a change in the database (FIREBASE) particularly in 'sala' and 'ventilacion' nodes the function do what it have to do. If there isn't any change in the database it would not do nothing. I am using python and pyrebase library. Here is the code. Thank you very much for you help.</p>
  <pre><code>import pyrebase
  import serial
  import time
  config = {
      #firebase configurations
  }
  
  firebase = pyrebase.initialize_app(config)
  
  db = firebase.database()
  def ReconfiguracionFabrica():
      ser.write('AT')
      time.sleep(0.2)
      ser.write('AT+RENEW')
      time.sleep(0.3)
  
  def ConfiguracionMaster():
      time.sleep(0.5)
      ser.write('AT+IMME1')
      time.sleep(0.350)
      ser.write('AT+ROLE1')
      time.sleep(0.2)     
  
  ser = serial.Serial(port=&quot;/dev/ttyAMA0&quot;, baudrate=9600, timeout=1)
  ReconfiguracionFabrica()
  time.sleep(0.1)
  ConfiguracionMaster()
  time.sleep(0.1)
  
  print &quot;**********   INICIO  *************&quot;
  
  ser.flushInput()
  contador = 0
  prender = ''
  ventilacion1 = ''
  checkeo = ''
  
  while True:
      #if db.child(&quot;sala&quot;).: # It is the line where would be the conditional that allows me to detect any change only in the sala's node.
          salidaLed1 = db.child(&quot;sala&quot;).get()
          ser.write('AT')
          time.sleep(0.1)
          ser.write('AT+CON508CB16A7014')
          time.sleep(0.1)
          if salidaLed1.val() == True:
              prender = &quot;;&quot;
          if salidaLed1.val() == False:
              prender = &quot;,&quot;
  
          ser.write('luz: %s \n' %(prender))
          print ('luz: %s \n' %(prender))
          time.sleep(1)
          ser.read(checkeo)
          if checkeo == 'j':
              ReconfiguracionFabrica()
              time.sleep(0.1)
              ConfiguracionMaster()
  </code></pre>