Door Status on CAN

Discussion in 'Gen 3 Prius Technical Discussion' started by ErikJ, May 21, 2018.

Tags:
  1. ErikJ

    ErikJ New Member

    Joined:
    Jan 3, 2018
    23
    5
    0
    Location:
    Palo Alto, CA
    Vehicle:
    2015 Prius Plug-in
    Model:
    Plug-in Base
    Hi all,

    I am currently working on a project for my Prius and I need to be able to know the door and window status over CAN. I have found the window status on message ID 0x638, data byte 4 (2 bits per window), but I can't seem to locate the door status. I have found a bit in message 0x626 that appears to indicate the status of either the dome light or the door indicator on the dash, however I would love to know the status of each door individually. Does anyone know if that is available or will I need to do more reverse engineering?

    Thanks!
    Erik

    PS. ID 0x638 also appears to contain the lock status and hatch button state on bytes 2 and 6, if this is useful to anyone!
     
  2. ErikJ

    ErikJ New Member

    Joined:
    Jan 3, 2018
    23
    5
    0
    Location:
    Palo Alto, CA
    Vehicle:
    2015 Prius Plug-in
    Model:
    Plug-in Base
    For the curious, here's how to decode the door lock and window status:

    Code:
    def windowStatus(data, window):
        status = (data >> (2 * window)) & 0x03
        if status == 1:
            return "Fully Open"
        if status == 2:
            return "Closed"
        if status == 3:
            return "Partially Open"
        return "N/A"
    
    Code:
    if msg.arbitration_id == 0x638:
        if msg.data[1] & 0x80:
            print("Driver Door:       " + ("Unlocked" if msg.data[2] & 0x10 else "Locked"))
            print("Passenger Door:    " + ("Unlocked" if msg.data[2] & 0x08 else "Locked"))
            print("Rear Doors:        " + ("Unlocked" if msg.data[2] & 0x06 else "Locked"))
            print("Hatch:             " + ("Unlocked" if msg.data[2] & 0x01 else "Locked"))
            print("Hatch Button:      " + ("Pressed" if msg.data[6] & 0x40 else "Released"))
            print("Driver Window:     " + windowStatus(msg.data[4], 3))
            print("Passenger Window:  " + windowStatus(msg.data[4], 2))
            print("Right Rear Window: " + windowStatus(msg.data[4], 1))
            print("Left Rear Window:  " + windowStatus(msg.data[4], 0))
    
     
    Buzzhead likes this.
  3. RobH

    RobH Senior Member

    Joined:
    Sep 18, 2006
    2,359
    954
    69
    Location:
    Sunnyvale, California
    Vehicle:
    2006 Prius
    Check the wiring diagram to see if the door switches are separately connected to an ECU. I suspect that they are all on one connection. My wife's CT200h displays which door is open, while my Gen2 Prius only displays that a door is open.
     
  4. taxibuddy

    taxibuddy Junior Member

    Joined:
    Jan 31, 2018
    76
    54
    0
    Location:
    Atlanta
    Vehicle:
    2014 Prius v wagon
    Model:
    Two
    Maybe this is overly picky but your code returns inaccurate information if one rear door is locked and the other isn't.
     
  5. ErikJ

    ErikJ New Member

    Joined:
    Jan 3, 2018
    23
    5
    0
    Location:
    Palo Alto, CA
    Vehicle:
    2015 Prius Plug-in
    Model:
    Plug-in Base
    Hi @taxibuddy - unfortunately, the two rear doors appear to be connected in a "logical-AND" configuration - if either is unlocked, the status bits show 'unlocked' for both. I am expecting the same for the 'door-open' status, as there is only 1 wire going to the ECU for both rear doors in the wiring diagram.
     
  6. ErikJ

    ErikJ New Member

    Joined:
    Jan 3, 2018
    23
    5
    0
    Location:
    Palo Alto, CA
    Vehicle:
    2015 Prius Plug-in
    Model:
    Plug-in Base
    @RobH: The wiring diagram shows that there are inputs for the following "courtesy switches":
    - Front Left
    - Front Right
    - Rear (both in parallel)
    - Hatch
    - Hood

    I think it should be possible, therefore, to read these on the CAN bus...
     
  7. ErikJ

    ErikJ New Member

    Joined:
    Jan 3, 2018
    23
    5
    0
    Location:
    Palo Alto, CA
    Vehicle:
    2015 Prius Plug-in
    Model:
    Plug-in Base
    Got it! It was sharing the same message as the parking brake, which I had already filtered out and is why I couldn't find it...
    For future reference:
    Code:
    if msg.arbitration_id == 0x620:
        if msg.data[1] & 0x80:
            print("Driver Door:       " + ("Open" if msg.data[5] & 0x20 else "Closed"))
            print("Passenger Door:    " + ("Open" if msg.data[5] & 0x10 else "Closed"))
            print("Rear Doors:        " + ("Open" if msg.data[5] & 0x0c else "Closed"))
            print("Hatch:             " + ("Open" if msg.data[5] & 0x02 else "Closed"))
            print("Parking Brake:     " + ("On" if msg.data[7] & 0x10 else "Off"))
    
    Still no sign of the hood status (even on that message), but I don't need that anyway.
     
    RobH likes this.
Loading...