let s = "0.0.0_";
let v = 0;

if (Attr.dataType == 33)
{
    v = (Attr.val & 0x00ff);
}
else if (Attr.dataType == 35)
{
    v = (Attr.val & 0x000000ff);
}

for (i = 0; i < (v.toString().length % 4); i++)
{
    s += "0";
}

Item.val = s + v;
@@ -153,88 +153,49 @@
 %0A%7D%0A%0A
-for (i = 0; i %3C (v.toString().length %25 4); i++)%0A%7B%0A    s += %220%22;%0A%7D%0A%0AItem.val = s + v
+Item.val = s + v.toString().padStart(4, %220%22)
 ;

Simplify Xiaomi FW script based on #6186