TP Link TL-WPA4220 problem and fix

I purchased a TL-WPA4220 was unreliable. The connection did not stay up more than a day or so.

The device came with
Firmware version: 4.0.3 Build 20190326 Rel.43406
Hardware version: TL-WPA4220 v4.0

After a bit of browsing I found this Adding the following script on the Ubuntu Linux machine at the other end of the powerline adaptor solved the problem and it has been up for a week now.

while true
	ping -c 1
	sleep 60