title: How to syncronize Azure IoT Hub device twin with device changes?
body: <p>For our IoT solution we are trying to tackle a  synchronizing issue with the device Twin.</p>
  
  <p>In the normal situation the Cloud is in charge. So the cloud will set a desired property in the IoT hub device twin. The device will get a notification, change the property on the device and write the reported property that the device is in sync. </p>
  
  <p>But for our case the user of the device can also change properties locally. So in this case the reported property will change and is out of sync with the desired. 
  How should we handle this? update the desired? leave it as is?</p>
  
  <p>And a other case can be that properties can be deleted from both sides. see the attacted picture.</p>
  
  <p><a href="https://i.stack.imgur.com/4G4Vn.png" rel="nofollow noreferrer">Writen use cases</a></p>
  
  <p>here an example of the json twin:</p>
  
  <pre><code>"desired" : {
   "recipes" : {
    "recipe1" : {
     "uri" : "blob.name.csv",
     "version" : "1"
     },{
    "recipe2" : {
     "uri" : "blob.name.csv",
     "version" : "1"
     },{
    "recipe3" : {
     "uri" : "blob.name.csv",
     "version" : "1"
     }
   }
  },
  "reported" : {
   "recipes" : {
    "recipe1" : {
     "uri" : "blob.name.csv",
     "version" : "1"
     },{
    "recipe2" : {
     "uri" : "blob.name.csv",
     "version" : "3"
     },{
    "recipe3" : {
     "uri" : "blob.name.csv",
     "version" : "2"
    }
  }
  </code></pre>
  
  <p>I hope the question is clear. Thanks in advance.</p>
  
  <p>Kind regards,</p>
  
  <p>Marc</p>