title: +CNMI command: how to receive notification and save to SIM Card incoming SMS
body: <p>I need to get notification success delivery. I read so many and tried. I have GSM modem <strong>ZTE K4510Z</strong>. I don't get any notification or save to sim card. In my tested. I though my sim card is broken. So I try <strong>AT+CMGW</strong> to write temporary message to simcard. It success and exist. So in the end I think, it's command not the simcard. I try so many think from <strong>AT+CNMI</strong>, <strong>AT+CPMS</strong>. None reply buffer I get after send a message. I check it too with <strong>AT+CPMS?</strong> after send message. If a message it write to simcard without notification. But nothing, no notification, no message written into simcard storage.</p>
  
  <pre><code>import serial
  import time
  
  modem = serial.Serial('COM35', 9600, timeout=0)
  
  modem.write(b'AT\r')
  
  while True:
      buffer = modem.readline()
  
      if buffer == b'OK\r\n':
          print('OK')
          break
  
  # Set SMS MODE
  modem.write(b'AT+CMGF=1\r')
  
  while True:
      buffer = modem.readline()
  
      if buffer == b'OK\r\n':
          print('OK')
          break
  
  # Set Preferred Storage
  modem.write(b'AT+CPMS="SM","SM","SM"\r')
  
  while True:
      buffer = modem.readline()
  
      if buffer == b'OK\r\n':
          print('OK')
          break
  
  # Set how a notification    
  modem.write(b'AT+CNMI=2,2,0,0,0\r')
  
  while True:
      buffer = modem.readline()
  
      if buffer == b'OK\r\n':
          print('OK')
          break
  
  recipient = "Phone_number"
  message = 'Message'
  
  # Set Recipient
  modem.write(b'AT+CMGS="' + recipient.encode('UTF-8') + b'"\r')
  
  while True:
      buffer = modem.read(1)
  
      if buffer == b'&gt;':
          break
  
  # Set Message
  modem.write(message.encode('UTF-8') + b'\r')
  
  # Input CTRL+Z  
  modem.write(bytes([26]))
  
  # Waiting any buffer
  while True:
      buffer = modem.readline()
  
      print(buffer)
  
      time.sleep(1)
  
  modem.close()
  </code></pre>