[arm-allstar] Set RC-210 clock from Allstar nodes
larry
larry at n7fm.com
Fri Nov 19 16:11:04 EST 2021
Script function = set_rc-210_clock_from_Hamvoip_node.php
Before installing the below script on your Hamvoip Node, edit the following.
1. Unlock code of 1,5,2,8,1 needs to match the unlock digits used on Port 1 of your RC-210 controller.
--> Edit only the digits after "cop 48" the D needs to remain. <--
2. Edit the TimeZone for your location. Refer to menu item 4. to view your Nodes current setting.
3. Node numbers of "1100" need to be changed to the Node number this script will run from.
4. Save and copy the edited script to your Hamvoip Node.
5. Configure how and when the script should run.
-----------------------------------------------
<?php
//Get ID out of the way by kerchunking and waiting for ID to finish:
exec("/usr/sbin/asterisk -rx 'susb key'");
exec("/usr/sbin/asterisk -rx 'susb unkey'");
Sleep(10);
print "Sending Unlock\r\n";
exec("/usr/sbin/asterisk -rx 'rpt cmd 1100 cop 48 1,5,2,8,1,D'");
sleep(5.0);
// Set the TimeZone below to your location. Refer to Node menu item 4. to view your Nodes current setting.
$tz = 'America/Los_Angeles';
$timestamp = time();
$dt = new DateTime("now", new DateTimeZone($tz));
$dt->setTimestamp($timestamp);
$senddata = "*5100" . $dt->format("His");
$senddata= str_split($senddata);
$senddata = implode(",",$senddata);
$senddata = $senddata . ",D";
print "Setting Clock\r\n";
print $senddata . "\n"; //Displayed only to verify the time digits sent were correct for your timezone.
exec("/usr/sbin/asterisk -rx 'rpt cmd 1100 cop 48 $senddata'");
$date = new DateTime("now", new DateTimeZone($tz) );
//echo $date->format('mdy') . "\n";
$senddata ="*5101" . date("mdy");
$senddata = str_split($senddata);
$senddata = implode(",",$senddata);
$senddata = $senddata . ",D";
sleep(5.0);
print "Setting Calendar\r\n";
print $senddata . "\n"; //Displayed only to verify the date digits sent were correct for your timezone.
exec("/usr/sbin/asterisk -rx 'rpt cmd 1100 cop 48 $senddata'");
sleep(5.0);
print "Sending Lock\r\n";
exec("/usr/sbin/asterisk -rx 'rpt cmd 1100 cop 48 #,D'");
?>
More information about the ARM-allstar
mailing list