The story you described matches “The Long Years” a story featured in Ray Bradbury’s The Martian Chronicles.
Williamson said, “I went to the graveyard.” -“The four crosses were there?” (Wilder) -“ The four crosses were there, sir. The names were still on them. I wrote them down to be sure.” He read from a white paper: “Alice, Marguerite, Susan, and John Hathaway. Died of unknown virus. July 2007.
Hathaway drank down his wine. He did not cry as he fell forward onto the table and slipped to the ground...
“Say good-by to Alice and the children for me.” (Hathaway) -“Just a moment, I’ll call them”. (Wilder) -“No, no, don’t!” gasped Hathaway. “They wouldn’t understand. I wouldn’t want them to understand!”
Some quick research reveals that there is indeed a film adaptation of this story, Episode 3 of “The Martian Chronicles miniseries”: The Martians.
Here's a synopsis from musingsofamiddleagedgeek.blog:
More successful is the adaptation of “The Long Years”, which sees Barry Morse (“Space: 1999”) as a lonely tinkerer named Hathaway who uses lasers from his home observatory on Mars to signal passing spacecraft. Hathaway succeeds in gaining the attention of Wilder (who was in the short story as well), along with Roddy McDowell’s Father Stone (who was not). Hathaway has been living with his wife Alice (Nyree Dawn Porter) and 14 year old daughter Marguerite (Madalyn Aslan), who was named after Ray Bradbury’s own beloved wife. Wilder and Father Stone greet Hathaway, who is tremendously excited to see another human being…not quite the reaction one would expect from a man who already has a family for companionship. Hathaway’s excitement turns lethal, as he suffers a heart attack before collapsing dead to the floor of his home. Alice and Marguerite stare blankly at his corpse, unable to cry, since they are androids, built by Hathaway after the real Alice and Marguerite passed away, some years earlier. The truth of Hathaway’s existence deeply saddens Wilder. He and Father Stone decide to leave the two androids ‘on’ in their preprogrammed blissful state, after burying Hathaway near his real family. A coda to the story sees a still-wandering Ben Driscoll walking up to the Hathaway home, introducing himself to the two smiling androids…