So I have sent my brother network printer from standby to off via a HA controlled smart plug for more than 76% of the time.
Now that sorry sample of engineering (a MFC 7360N) does not pull its time from a NTP server and on top of that does forget it if its disconnected from the grid after some hours. ingenious, brother at its best. Who the heck would make a network printer, that cant get its time from the grid? Obviously brother.
I thought, I might not be the only one admiring the brother design: and the famous google proved me right. Lucky me, I would have no clue how to fix that by myself. A big thanks to Stefan Korn. I also checked, my brother uses the same URL to set its time. See here:
fix brother time issue after disconnect form grid
So how do I get my HA to perform this task, I currently run HA on a virtualbox VM and will soon move to a docker container. It needs to be triggered when ever the plug gets switched on, either manually from a user or by HA, but with a time delay.
This is the PHP script: (courtesy Stefan Korn)
<?php
brothermfc9840CDW_datumsetzen("192.168.1.10");
function brothermfc9840CDW_datumsetzen($ipadresse, $benutzername = "admin", $passwort = "access")
{
$datum_1980 = mktime(0, 0, 0, 1, 1, 1980);
$datum_heute = mktime();
$datum_brother = $datum_heute - $datum_1980;
$chandle = curl_init();
curl_setopt($chandle, CURLOPT_URL, "http://". $ipadresse . "/fax/general_setup.html?kind=item");
curl_setopt($chandle, CURLOPT_POST, TRUE);
curl_setopt($chandle, CURLOPT_POSTFIELDS, "DateTime=".$datum_brother);
curl_setopt($chandle, CURLOPT_HTTPAUTH, "CURLAUTH_BASIC");
curl_setopt($chandle, CURLOPT_USERPWD, "".$benutzername.":".$passwort."");
curl_setopt($chandle, CURLOPT_RETURNTRANSFER, TRUE);
curl_exec($chandle);
curl_close($chandle);
}
?>
Any recommendations how to handle this?
Thanks