I'm building a little velomobile and I'm thinking of creating a handbrake (park brake) feature where I'd engage the brakes when I leave it somewhere so it can not move (slope, get stolen or whatever). I'm concerned if having my brakes engaged for a long time can introduce some damage to the system like bending the rotor as well as I'm not really sure how the retraction works. I'm using a pair of shimano hydraulic disc brakes purchased them assembled and filled with oil. If the pistons are being retracted by springs and were not designed to remain engaged for hours on end I suppose that the springs could loosen and not do their job so good after some time, while if the retraction is achieved via the vacuum from the retracting fluid inside then I suppose I would not have to worry, which I'm keen is the case but I guess I'm looking for a word of comfort since I could not find this information online, it's all about mechanic vs hydraulic everywhere.
Hydraulic brake pistons are actually retracted by the rubber seals. The seals are deformed slightly as the piston advances, then they re-form to provide the retraction force. This works because the retraction distance is actually very small. The seals design also allows piston advancement to take up pad wear. As the pads wear the piston moves slightly beyond the deformation limit of the seal and slips through it a small distance.
There is a good Park Tool video that shows how this works.
I would definitely be concerned that holding the brake on for a long time would affect the rubber seal. What might happen is the seal will slip back on the piston while it is pressed up against the rotor then not retract it properly.