Car unlocked overnight

I’m not one to cast blame, but there are two of us in the house and it wasn’t me who left the car unlocked overnight !

So I’m trying a little extension to the my_charge_status script for the Kona Electric.

First read the locked status of one door -

# get door locked (strickly speaking just one door .. ).  Returns :
#   0 - unlocked
#   1 - locked
#  -1 - can't read data
def get_locked():
        args = ['locked']
        kwargs = {
            'mode': '22',
            'pid': 'BC04',
            'header': '770',
            'baudrate': 500000,
            'formula': 'bytes_to_int([7:8])',
            'protocol': '6',
            'verify': False,
            'force': True,
        return (int(__salt__['obd.query'](*args, **kwargs)['value'])&4)/4
        return -1

Then send alert if car left unlocked -

# check to see if car left locked
locked = get_locked()
if locked == 0 and driving != 1:
    bot_sendtext('*Car unlocked*')

I’ll leave this running on my car for a few days … if I don’t see any issues I’ll push the updated script to github.


I like this, please update with how it went.

Do you have this in the car explorer library so that I can try it out?
I tested this in the terminal with no avail.

obd.query Doors mode=22 pid=BC04 header=770 formula=‘bytes_to_int([
7:8])’ baudrate=500000 protocol=6 verify=false force=true