I have decoded some missing parts of the protocol using a USB monitoring sofware on a Windows machine.
Here are some information that i found;
Sending 35 instead of 19 as data[1] will result F symbol to be lit instead of C but you need to convert celcius to fahrenheit on hand before sending it to the device.
Sending anything rather than 0 as data[6] will result Temp icon and Temperature value (if shown) to be blinking. This is how alarm feature works from the official app.
Sending 180 as data[3] or data[4] will result displaying - (minus) symbol to be shown. This is useful for displaying sub zero temperatures. There are some other characters can be drawn by sending a value larger than 10 but most of them are not meaningful and I could not find correlation between letters can be displayed and number values representing them. Also 10 can be used for displaying a blank segment which is not possible for last segment otherwise.
Since top green bar value can be controlled independendent from number value, it can be used for displaying the utilization while number value is displaying the temperature. User can see both utilization and temperature at the same time using this method and every bar led value will be representing 10% of the CPU utilization.
This is the sample code that contains all of the information mentioned above. I hope this helps.
import time
import hid
import psutil
import math
PRODUCT_ID = 0x0001 # AK400
SENSOR = "coretemp"
FAHRENHEIT = True
ALARM_TEMP = 75 # set to 0 to disable
INTERVAL = 0.5
try:
data = [16, 170] + [0 for i in range(62)]
h = hid.device()
h.open(0x3633, PRODUCT_ID)
h.set_nonblocking(1)
h.write(data)
data[1] = 35 if FAHRENHEIT else 19
while True:
temperature = psutil.sensors_temperatures()[SENSOR][0].current
if FAHRENHEIT:
temperature = (temperature * 1.8) + 32
temperature = round(max(min(temperature, 999), -99))
data[2] = math.ceil(psutil.cpu_percent() / 10.0)
data[6] = ALARM_TEMP > 0 and temperature >= ALARM_TEMP
value = str(temperature)
if temperature < -9:
data[3] = 180
data[4] = int(value[1])
data[5] = int(value[2])
elif temperature < 0:
data[3] = 0
data[4] = 180
data[5] = int(value[1])
elif temperature < 10:
data[3] = 0
data[4] = 0
data[5] = int(value[0])
elif temperature < 100:
data[3] = 0
data[4] = int(value[0])
data[5] = int(value[1])
else:
data[3] = int(value[0])
data[4] = int(value[1])
data[5] = int(value[2])
h.set_nonblocking(1)
h.write(data)
time.sleep(INTERVAL)
except IOError as error:
print(error)
except KeyboardInterrupt:
pass
finally:
if "h" in locals():
h.close()
I have decoded some missing parts of the protocol using a USB monitoring sofware on a Windows machine.
Here are some information that i found;
35
instead of19
asdata[1]
will resultF
symbol to be lit instead ofC
but you need to convert celcius to fahrenheit on hand before sending it to the device.0
asdata[6]
will resultTemp
icon and Temperature value (if shown) to be blinking. This is how alarm feature works from the official app.180
asdata[3]
ordata[4]
will result displaying-
(minus) symbol to be shown. This is useful for displaying sub zero temperatures. There are some other characters can be drawn by sending a value larger than10
but most of them are not meaningful and I could not find correlation between letters can be displayed and number values representing them. Also10
can be used for displaying a blank segment which is not possible for last segment otherwise.This is the sample code that contains all of the information mentioned above. I hope this helps.