G-Two / homeassistant-subaru

Subaru STARLINK custom component for Home Assistant.
Apache License 2.0
54 stars 6 forks source link

External temperature not available #38

Closed FerriteGiant closed 2 years ago

FerriteGiant commented 2 years ago

In both versions I've tested (v0.5.2 and v0.6.0rc5) home assistant says the external temperature sensor.<VIN>_external_temp is "Unavailable". I testing with the official home assistant integration and I do get the temperature reading.

This is for a 2019 Forester and Home Assistant 2021.12.5

G-Two commented 2 years ago

Most likely this is due to Subaru returning erroneous data. You can confirm by adding debug logging of the underlying subarulink package to your configuration.yaml

logger:
  default: warning
  logs:
    subarulink: debug

You'll find vehicle condition reports in your logs that look similar to:

 2022-01-02 15:25:56 DEBUG (MainThread) [subarulink.controller] {"data": {"cancelled": False,
        "errorCode": None,
        "errorDescription": None,
        "remoteServiceState": "finished",
        "remoteServiceType": "condition",
        "result": {
            "data": {
                "AVG_FUEL_CONSUMPTION": "45",
                "BATTERY_VOLTAGE": "12.1",
                "DISTANCE_TO_EMPTY_FUEL": "305",
                "DOOR_BOOT_LOCK_STATUS": "UNKNOWN",
                "DOOR_BOOT_POSITION": "CLOSED",
                "DOOR_ENGINE_HOOD_LOCK_STATUS": "UNKNOWN",
                "DOOR_ENGINE_HOOD_POSITION": "CLOSED",
                "DOOR_FRONT_LEFT_LOCK_STATUS": "UNKNOWN",
                "DOOR_FRONT_LEFT_POSITION": "CLOSED",
                "DOOR_FRONT_RIGHT_LOCK_STATUS": "UNKNOWN",
                "DOOR_FRONT_RIGHT_POSITION": "CLOSED",
                "DOOR_REAR_LEFT_LOCK_STATUS": "UNKNOWN",
                "DOOR_REAR_LEFT_POSITION": "CLOSED",
                "DOOR_REAR_RIGHT_LOCK_STATUS": "UNKNOWN",
                "DOOR_REAR_RIGHT_POSITION": "CLOSED",
                "EXT_EXTERNAL_TEMP": "-64.0", 
                "LAST_UPDATED_DATE": "2021-12-25T19:16:26+0000",
                "ODOMETER": "18921035",
                "POSITION_HEADING_DEGREE": "14",
                "POSITION_SPEED_KMPH": "0",
                "POSITION_TIMESTAMP": "2021-12-19T19:07:49Z",
                "SEAT_BELT_STATUS_FRONT_LEFT": "NOT_BELTED",
                "SEAT_BELT_STATUS_FRONT_MIDDLE": "NOT_EQUIPPED",
                "SEAT_BELT_STATUS_FRONT_RIGHT": "BELTED",
                "SEAT_BELT_STATUS_SECOND_LEFT": "UNKNOWN",
                "SEAT_BELT_STATUS_SECOND_MIDDLE": "UNKNOWN",
                "SEAT_BELT_STATUS_SECOND_RIGHT": "UNKNOWN",
                "SEAT_BELT_STATUS_THIRD_LEFT": "UNKNOWN",
                "SEAT_BELT_STATUS_THIRD_MIDDLE": "UNKNOWN",
                "SEAT_BELT_STATUS_THIRD_RIGHT": "UNKNOWN",
                "SEAT_OCCUPATION_STATUS_FRONT_LEFT": "UNKNOWN",
                "SEAT_OCCUPATION_STATUS_FRONT_MIDDLE": "NOT_EQUIPPED",
                "SEAT_OCCUPATION_STATUS_FRONT_RIGHT": "UNKNOWN",
                "SEAT_OCCUPATION_STATUS_SECOND_LEFT": "UNKNOWN",
                "SEAT_OCCUPATION_STATUS_SECOND_MIDDLE": "UNKNOWN",
                "SEAT_OCCUPATION_STATUS_SECOND_RIGHT": "UNKNOWN",
                "SEAT_OCCUPATION_STATUS_THIRD_LEFT": "UNKNOWN",
                "SEAT_OCCUPATION_STATUS_THIRD_MIDDLE": "UNKNOWN",
                "SEAT_OCCUPATION_STATUS_THIRD_RIGHT": "UNKNOWN",
                "TRANSMISSION_MODE": "PARK",
                "TYRE_PRESSURE_FRONT_LEFT": "2250",
                "TYRE_PRESSURE_FRONT_RIGHT": "2300",
                "TYRE_PRESSURE_REAR_LEFT": "2300",
                "TYRE_PRESSURE_REAR_RIGHT": "2200",
                "TYRE_STATUS_FRONT_LEFT": "UNKNOWN",
                "TYRE_STATUS_FRONT_RIGHT": "UNKNOWN",
                "TYRE_STATUS_REAR_LEFT": "UNKNOWN",
                "TYRE_STATUS_REAR_RIGHT": "UNKNOWN",
                "VEHICLE_STATE_TYPE": "IGNITION_OFF",
                "WINDOW_BACK_STATUS": "UNKNOWN",
                "WINDOW_FRONT_LEFT_STATUS": "VENTED",
                "WINDOW_FRONT_RIGHT_STATUS": "VENTED",
                "WINDOW_REAR_LEFT_STATUS": "UNKNOWN",
                "WINDOW_REAR_RIGHT_STATUS": "UNKNOWN",
                "WINDOW_SUNROOF_STATUS": "UNKNOWN",
            },
            "notes": None,
            "success": True,
        },
        "serviceRequestId": None,
        "subState": None,
        "success": True,
        "updateTime": None,
        "vin": "JF2ABCDE6L0000003",
    },
    "dataName": "remoteServiceStatus",
    "errorCode": None,
    "success": True,
}

If EXT_EXTERNAL_TEMP is -64.0, this an erroneous value, and the integration will show the sensor as unavailable until a valid temperature is reported. If you run a location update command from the integration, it should hopefully update the temp to a valid number and no longer be marked as unavailable.

Relevant controller code: https://github.com/G-Two/subarulink/blame/v0.4.0/subarulink/controller.py#L981

FerriteGiant commented 2 years ago

The value is indeed '-64.0'. However I tried "Locate", "Refresh" and remotely turning the car on and back off and the value doesn't change. (Sidenote: I also just noticed that the "ignition" sensor always shows "off" even when the car is on.)

FerriteGiant commented 2 years ago

Oh, well, that's interesting. The value just randomly showed up like 10 minutes after doing all that stuff.

stboch commented 2 years ago

Yeah the Subaru data is weird like that... honestly though don't plan on relying on the ignition sensor because even in my 2020 the inconsistent timing of updates and data, unless I am on a long car ride I almost never get it updating...