Hibernation Is Universally For a Few Simple Reasons
In nature a very large part of evolution revolves around dealing with cyclical resource shortages and dealing with periodic unfavorable conditions. Two major methods are migration or hibernation. A major evolutionary reason why human's and other large mammals sleep at night is to avoid the night period where resources are harder to gather and the risk of becoming prey is increased. Its a major evolutionary advantage to curl up in a safe space and sleep thus conserving energy and avoiding the worst of the predators. The most plausible cause of your tree-creatures "sleeping" is that the resources they require are not available at night.
You see, being a tree is great. You can photosynthesize your own nutrients, no need for risky survival strategies like hunting, or avoiding predators. Best part is, since you aren't moving all of your nutrients can be directed at either growing, reproducing, or storing for later. All of these advantages quickly disappear if you start adding mobility to the mix. Photosynthesis is an efficient method of deriving nutrients when you are not moving, but once you are you find out that a metabolism that supports even basic slow mobility is an order of magnitude more hungry than simply sitting there passively collecting sunlight and absorbing water. If you granted the ability to move to a plant here on earth it could never photosynthesize even a fraction of what it needed to be capable of true mobility. Granted, your tree-beasts aren't really trees, but they are more or less deriving their nutrients from similar processes.
Now you mentioned that they are using hydrogen and oxygen, along with minerals from the soils. This tells me that they are probably reacting oxygen and hydrogen into water and using the energy from that reaction to run their metabolism. (Normally this is a big hot explosion, but we are going to assume that these reactions are taking place internally and at a much slower pace.) The soil contains the minerals and chemicals they need to both build their own structure and also to create the reaction necessary to combine oxygen and hydrogen into water, thus releasing energy. You can't just mix the two gases together, you need to add energy to start the reaction. So my theory is this, your tree-beasts utilize alkali metals in the soils and combine them with water in the presence of hydrogen and oxygen in trace amounts to spark this reaction.
Sunlight adds heat, which lowers the amount of energy that needs to be added to the hydrogen and oxygen mix in order to create the chemical reaction that is driving the tree's metabolism. So during the day the tree-beasts are actually basking in the sun and sleeping to conserve energy while their bodies perform this chemical reaction. Again we run into the question of why they even evolved to move, so I posit this.
They move at night using the energy stores they built up during the day in order to search for soils high in the reactive chemicals they require to perform the chemical processes necessary for their metabolism. Also, it should be noted, with a bio-chemistry like this they will essentially burn like literal rocket fuel or even explode, so that could be a unique weakness they have.
End Note
I'm just trying to make the fiction sound more realistic because no known biological processes work like this utilizing these chemicals and I don't even know if it's possible, I'm just trying to make it as believable and scientific as possible. For any chemists or biologists on here please don't cringe and scream at the screen too hard.