# Running function based on if statement

I have a stream of data coming in with housekeeping numbering. Basically 15 bytes of info. The third byte is a count between 0-29. the fourth and fifth byte represent a different value based on the third. Meaning if it is 0 then it may be voltage, 1 may be current, 2 a reading. So if I make a function using the callback of when the data comes in and if the third value is x then the fourth and fifth get converted in x way. So a function to separate and another to convert. I figured in the first which is triggered with the third value changing. And each value would trigger another function to convert so I am not running 29 conversions each time it changes I canât use callback for that based on value. So how do a I trigger a callback via an if statement? I also need the output to update on the app so I need the callback?

simplified ex.
@app.callback(Output(âhk_tempâ, âchildrenâ),Input(âmsfâ,âvalueâ))

def hk_parse(msf):
if msf==0:
hk_0(hk_temp)
elif msf==1:
hk_1(hk_temp)

@app.callback(Output(âhk_0_outputâ,âchildrenâ), Input(???))
def hk_0(hk_temp):
hk_0_temp=int(hk_temp,16)*0.358
retrun hk_0_temp

@app.callback(Output(âhk_1_outputâ,âchildrenâ), Input(???))
def hk_1(hk_temp):
hk_1_temp=int(hk_temp,16)*0.7589512
retrun hk_1_temp