This expression will do the trick:
stringFormat('%02X:%02X',
({KasaTMMC/Final4/F4-TL/P1_S001A} >> 8),
({KasaTMMC/Final4/F4-TL/P1_S001A} & 255)
)
An explanation of how this works.
-
The
stringFormat
expression accepts format strings which utilizes the Java String Format Syntax, found here. Esentially, this string is saying it will take 2 arguments and format them both as a Hexadecimal Integer with zero padding to a width of 2 characters. -
This:
{tag} >> 8
performs a right bit shift to the value of tag 8 bits to the right. It helps to think of the numbers in binary. In this instance the binary value would be0b0000 0111 0000 0111
, following the bit shift the resultant value is0b0000 0000 0000 0111
. -
This:
{tag} & 255
performs a bitwise AND operation between the value of tag and 255. Again it helps to think of the numbers in binary. In this instance:
0b0000 0111 0000 0111 & 0b0000 0000 1111 1111 = 0b0000 0000 0000 0111
The resultant string will be 07:07