I roughly follow a book Convict Conditioning - exercising at home using my body weight (and a pull-up bar). To put it simply, there are four types of exercises (push-ups, pull-ups, squats, leg raise), and for each of them there is a very fluent progression of exercises from very simple to very difficult. So you can start at level 1 for each type of exercise, and when you manage to do a certain amount of repetitions, you level up. (Different types of muscles level up independently, for example I have strong legs and weak arms.) That means, the exercise is never too easy or too hard, and leveling up is a great psychological reward.
For me the key is consistency and social pressure. I try to exercise every day (because that is more instinctive than any other schedule) at the same time (when my kids go to sleep). That means, when the time to exercise comes, it feels natural to do it. I keep a log which days I exercised and which days I did not, and I report the data to my friends. By the way, I don't exercise all muscles every day; I alternate two types of exercise on one day, the remaining two types on the other day.
Another thing that works for me, psychologically, is outcome independence. I treat my exercise as a virtuos thing, whether it brings the desired results or not. If I exercised, I did my duty; if I didn't exercised, I failed to do my duty. Whether the muscles actually increase and the fat actually decreases, that depends on the gods; I am just making sure that I did my part. This is useful, because the progress is real but happens on long time scale, and I need encouragement on short time scale. Of course, after you succeed to exercise regularly for a few months, you will see the progress, and that will motivate you to continue; but the problem is that you need greatest motivation at the very beginning, while you still have zero results. (It is easiest to give up during the first month. After half year, the change will be so obvious that you will want to stay that way.)
Don't overdo it. Muscles also need some time to recover; for me it is rougly two days (which is why I alternate the exercises). Take sufficient breaks between the sets; this is easier to do at home, because it doesn't feel like you are wasting your time; between the sets you can browse web, watch TV, or do dishes. Sometimes I just watch a movie, pause it at a random moment, do a set, unpause and watch again... and at the end, it doesn't even feel like I exercised; I was just watching a movie and taking an occassional short break. Generally, if you can somehow make it fun, that helps a lot. (After a few months, you will not need external sources of fun; the exercise itself will become pleasurable. But first you need to get there.) Never punish yourself for failing to exercise; reflect on the fact, then forgive yourself and start again.
In addition to strength training you should also do some cardio or take a walk regularly. Once I had a job that was 20 minutes by foot from my home; that was optimal. I try to minimize car use, and during covid also started minimizing mass transit use; now I always check the map first, and if my destination is within 30 minutes walking distance, I go there by foot. I think about it as saving time, because I am going to where I need, and I am exercising at the same time.
Now, strength training itself can add you muscle, but will only remove a little fat. People usually overestimate how much energy is burned when exercising. Most energy is spent by simply keeping your body alive (body temperature, breathing, heartbeat, etc.), which is more or less a constant amount each day. An exercise will probably just add 5% or 10% to it. The inevitable conclusion is that to lose fat, you need to eat less. Even worse, you need to eat less every day, otherwise the calories you lost in a week can be regained in a day. On the other hand, starving can hurt you; your body needs enough proteins and vitamins. That means that you need to change the proportion of proteins and vitamins to fats and carbohydrates; on other words, not (just) eat less but eat differently. Raw vegetables with every meal. Proteins from meat, fish, eggs, diary, beans. (That means lots of beans, if you are a vegetarian. Like, literally every day.) Avoid sugar, coke, white bread. You don't need to get religious about this, just remove the greatest sources of sugar/carbs, learn three new recipes containing beans, and always take a raw vegetable as a side dish. (If you ignore this advice, you will get muscles hidden under fat, which is where I am now; but even that is an improvement over all fat and no muscles.)
etc. What others already said. Enough sleep (that means 8 hours minimum).
By the way, being healthy can take a lot of time. Eight hours of sleep + eight hours at work + commute, that already leaves you like 4-7 free hours on a workday. If you want healthy meals, you probably need to cook them yourself. Then you exercise... and there is little time left. Plus, you probably have other duties, maybe also kids, etc. You need to be smart about this. (It is one of the reasons I exercise at home instead of going to the gym; a few minutes saved every day.) I don't have a perfect solution for this, but two important components are: short commute (even if it means somewhat lower salary) and a big freezer (so I can prepare meals for several days at once).