The machine you describe seems possible, given the technology of the time, but it seems impractical, for a number of reasons.
Unless the rectal nozzle was something like a Foley catheter, it is pretty unlikely that it'd stay in place overnight
Also, it really makes no sense from a functional point of view unless the machine was designed to give the enema very slowly so the recipient would not wake up until the enema had been in for a long time to soften poo in a very constipated person. Such techniques, called a Murphy Drip, were used but not to make someone poo.
There was an enema machine sold in the 1950s, called the Minute Hygiene, but it was not automatic as the OP described. It was a smallish stainless steel box, about the size of a brick, with a hinged front cover that was mounted on the wall or under the sink near the toilet. It was plumbed into the hot and cold water lines to the sink and had a retractile hose and nozzles.
I first encountered one when staying with a friend of my mom in New York as an early teen. I was constipated, possibly due to the unfamiliar living conditions, and was called into the bathroom. My mom's friend was sitting on the toiled, clothed, with a towel on her lap. I was instructed to take my pants down and lie over her lap. She inserted the nozzle from the machine and gave me an enema, then stood up and left. I had an opportunity to look at the device while the enema worked.
The machines were not a market success AFAIK, and I never saw another, but certainly made sense in an era when enemas and douches were routine. Setup and cleanup took just seconds.