on commit {
set clip = binary-to-ascii(10, 8, ".", leased-address);
set clhw = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
log(concat("Commit: IP: ", clip, " Mac: ", clhw));
execute("/home/pi/scripts/dash/dash_action", clip, clhw);
}
}
Jedoch sorgt die Funktion binary-to-ascii dafür, dass mögliche führenden Nullen abgeschnitten werden. Das sorgt dann z.B. für eine solche Ausgabe:
e0:76:d0:60:3:fcAbhilfe schafft folgendes:
set clhw = concat (
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,1,1))),2), ":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,2,1))),2), ":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,3,1))),2), ":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,4,1))),2), ":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,5,1))),2), ":",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,6,1))),2)
);
Keine Kommentare:
Kommentar veröffentlichen