Why are you beating yourself up over this?
Life happens, and we human beings aren't perfectly equipped to handle it.
Maybe you didn't handle the things that life has thrown at you recently as well as you might have, but you still handled them, and now you can use the experience to figure out how you might handle difficult situations better in the future. What's shameful about that?
You don't have to be motivated all the time - few (no?) people are. But, even if we're not motivated to do something, we can often still do it. And if sometimes we can't (for mental or physical reasons)? Well, that's just being human, and we can use our shortcomings as a chance to learn how to improve.
While you're looking for motivation, could it help to aim for acting in ways that promote your health goals to the best of your abilities at the time? If all you can do is somthing minor, do that. Even if it doesn't move the scale, you're still accomplishing something and making it easier to re-introduce your old healthy habits as you can.
You've made it through whatever else is going on in your life.
You've kept a very large percentage of your excess weight off.
You recognize that your weight is moving in a direction you don't want it to go in, and are working on getting it going back in the right direction (that's why you're here, right?).
That's great! That's better than many people have done, and it's a clear sign that you're not actually defeated.
And if you continue to work away at getting healthy - even if you only do one tiny little thing a day - eating a serving of fruit, drinking water, walking for a half hour, whatever - you're doing something healthy, and still working on improving your life. If all you can mentally handle is one thing a day, do that. Write down of all the positive choices you make during the day. If you make a mistake or a bad decision, write down how you can avoid that mistake or help yourself make a better choice in the future.
Are you still feeling depressed? If so, are you receiving any therapy to help deal with it?
You can reach the goals you set for yourself.
Hang in there.