Guys,
I am writing my first custom module (really largely based of @plord great SOC logging. I have a question though
I see the code uses to retrieve the soc data - cool good with that however given the fact that I also have a logger
def get_soc_display():
try:
args = [‘soc’]
kwargs = {
‘mode’: ‘21’,
‘pid’: ‘05’,
‘header’: ‘7E4’,
‘baudrate’: 500000,
‘formula’: ‘bytes_to_int(message.data[33:34])’,
‘protocol’: ‘6’,
‘verify’: False,
‘force’: True,
}
return salt[‘obd.query’](*args, **kwargs)[‘value’]/2.0
except:
return -1
however given the fact that I also have a logger set up querying the same data (i am actually not sure thesec are the same because i cant test at the sec) but you get the point
obd.query BBM mode=220 pid=105 header=7E4 bytes=54 formula=‘bytes_to_int(message.data[34:35])/2’ unit=% baudrate=500000 protocol=6 verify=false force=true
strong text
Is there not a way from within a custom module to query the BBM rather than duplicating the query ? It seems it would make the code a lot cleaner
I hope this makes sense - thanks in adavance