add migration script for devices remote state
Merge remote-tracking branch 'origin/4974-sync-behind-nat'