G-Two / homeassistant-subaru

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

All door, trouble, trunk and ignition sensors show as "unavailable" #78

Closed analogpotato closed 1 year ago

analogpotato commented 1 year ago

Just as the title states, all of the sensors show as unavailable. This is on a brand new install of HA, HACS and this extension. I have a Subaru Forester Sport 2019, so I would assume these are supported, but I'm not sure of the troubleshooting steps necessary to solve this. I'm sorry if this is a newbie question, this is my first install of HA and I'm doing my best to figure it out 😅

G-Two commented 1 year ago

Please provide your device diagnostics output. This should help me narrow down the cause of this problem as well as your issue with the missing climate preset options.

Are you able to lock and unlock the car via home assistant?

image

analogpotato commented 1 year ago

24ad98695e4e27bc94b76aea959a6cad.html.zip

Here are the diagnostics, I was testing it last night and the door locks, horn, lights and remote stop worked (when I enabled the remote start via the MySubaru app and then used the integration to stop it). Interestingly, the door locks show "lock" in the options as well, but it's greyed out, unless I tap on the icon to get the "full" setting and then I can lock/unlock it from there.

G-Two commented 1 year ago

The expected output from device diagnostics should be a .txt file containing JSON content that begins with something like:

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.2.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.7",
    "docker": true,
    "arch": "x86_64",
    "timezone": "America/New_York",
    "os_name": "Linux",
    "os_version": "5.15.90",
    "supervisor": "2023.01.1",
    "host_os": "Home Assistant OS 9.5",
    "docker_version": "20.10.22",
    "chassis": "vm",
    "run_as_root": true
  }, ... }

Since you got an HTTP 500, there might be a bug in the diagnostics (which is maybe related to whatever is breaking all your sensors and the climate preset select). Would you please paste all errors and stack traces from your Home Assistant logs?

Finally, I think the behavior you're observing with the lock is correct and is how Home Assistant presents a lock entity where the lock's current lock state is unknown (which is unfortunately the case with Subaru since the STARLINK API does not report whether the doors are locked or unlocked).

analogpotato commented 1 year ago

config_entry-subaru-d883914cf3947bf650067163728d5600.json.txt

I managed to get the right diagnostics I think. I checked under System > Logs but it wasn't able to go back further than today. I will keep hunting it down and see if I have any differences. My wife is using the car a lot today so I'm not able to test it, it may be later tonight I can try to recreate.

G-Two commented 1 year ago

That's the config diagnostics, which look fine. I need the device diagnostics (a much longer, more detailed file that contains your vehicle sensor data as received by the Subaru API). You'll need to go to the device view and download diagnostics from there (see screenshot in my previous comment). If that fails to work (i.e. you get an HTTP 500 again) then I'll definitely need error logs to pinpoint the cause.

analogpotato commented 1 year ago

home-assistant_2023-02-10T18-03-53.757Z.log

Ok I think I got it. I attempted a lights on/off which worked, and a remote start and remote stop.

corey-e commented 1 year ago

I'll add some info to this in case it ends up being related as the 500 error on vehicle diagnostics was one of the issues I ran into. I used to have the paid Starlink services, but my subscription recently ended and this integration completely stopped working. Interestingly, I have not lost access to any features in the Subaru app which may or may not be a bug on their end. When I dug into the code, I realized that if a vehicle doesn't have Starlink Safety Service, it's completely ignored and the vehicle data will never be updated. My vehicle now only has REMOTE as a listed subscription feature so it was never updating. I modified my local version to ignore the check and everything is now working as expecting. I don't know if this is a common thing or not, but if someone else is running into a similar issue it may be worth looking into. I've attached my diagnostics in case it is helpful.

https://github.com/G-Two/homeassistant-subaru/blob/301d1387311a53bae2d8c856299fb68965b8aa43/custom_components/subaru/init.py#L171

subaru.json.txt

G-Two commented 1 year ago

Thanks @corey-e, that was helpful! I've updated init.py to more closely match what I think the mobile app checks for based on your device diagnostic data. Please give pre-release v0.7.5rc0 a try and let me know if everything works (without you needing to make the local modification on your end).

@analogpotato please also try the pre-release and see if it fixes both of your issues.

analogpotato commented 1 year ago

Just updated and that seems to have fixed it! All sensors are showing and the remote climate options show up. My wife has the car at the moment but I will update when she gets back to verify that the remote start is working.

Screenshot 2023-02-10 at 6 48 18 PM

G-Two commented 1 year ago

Great! Can you check and see if the device diagnostics works now as well?

analogpotato commented 1 year ago

subaru-d883914cf3947bf650067163728d5600-JF2SKAKC9KH473059-24ad98695e4e27bc94b76aea959a6cad.json.txt

Just pulled it and it seems as if it's doing it

analogpotato commented 1 year ago

I'm going to go ahead and close the issue, I tested Remote Start a few times and it's 100% working! Thank you again for jumping on a fix so fast and thank you to @corey-e for the assist!

corey-e commented 1 year ago

@G-Two @analogpotato Glad I was able to help and thanks for getting it fixed so quickly. I did verify that the new version is working correctly for me as well.