Brandawg93 / homebridge-fordpass

Control your Ford vehicle in HomeKit using Homebridge.
GNU General Public License v3.0
61 stars 15 forks source link

Home app is displaying the wrong status #28

Closed captconstruct closed 3 years ago

captconstruct commented 3 years ago

Before Submitting an Issue

Make sure you have the latest LTS from https://nodejs.org and the latest packages: npm upgrade -g homebridge homebridge-fordpass

Also include debug log output from startup through seeing the issue: homebridge -D

There are no errors in the debug log.

Describe the bug The app shows incorrectly when the vehicle is locked and running. It does this after I start the vehicle and unlock it without the app. Let's say that I open the Home app, and it shows that the vehicle is locked and off. If I start the vehicle without the app, the app will update and show the car running. But if I turn the car back off, the app doesn't update. It still shows the car as running.

To Reproduce

Steps to reproduce the behavior:

  1. Unlock or start vehicle without the app.
  2. Turn off or lock the car without the app.

Expected behavior

  1. App shows vehicle locked or off then becomes unlocked or running.
  2. App shows vehicle unlocked or running then locked and off.

Please answer these questions before submitting this issue:

On what OS are you running homebridge: Raspbian GNU/Linux 10
On what iOS version are you having issues: iOS 14 Public Beta 6, MacOS 10.15.6 Catalina
Does this issue occur consistently or randomly: consistently
If applicable, what was the last version that worked properly: N/A
Brandawg93 commented 3 years ago

This is because it can take Ford's API up to 30 minutes to update itself. The app can only see what the Ford API sees, unfortunately. The vehicle doesn't send an update every time you lock/unlock or start/stop your car. If you use the app to lock/unlock or start/stop the car, it will update the API.

dmike3 commented 3 years ago

This is because it can take Ford's API up to 30 minutes to update itself. The app can only see what the Ford API sees, unfortunately. The vehicle doesn't send an update every time you lock/unlock or start/stop your car. If you use the app to lock/unlock or start/stop the car, it will update the API.

I started with homekit and went into the fordpass app which showed the car running.

I went back to the home app and it still showed the car was off but it was on...

Anything we can do to fix that ?

Brandawg93 commented 3 years ago

Previously, I had the update interval set to every 30 minutes. I've lowered it to every 1 minute in my latest test version. You can try it by running npm -g i homebridge-fordpass --unsafe-perm. This should make the app and Homekit sync up every minute. Let me know if this helps.

dmike3 commented 3 years ago

Previously, I had the update interval set to every 30 minutes. I've lowered it to every 1 minute in my latest test version. You can try it by running npm -g i homebridge-fordpass --unsafe-perm. This should make the app and Homekit sync up every minute. Let me know if this helps.

I assume the version number is the same? 1.1.2 ?

Brandawg93 commented 3 years ago

Whoops... npm -g i homebridge-fordpass@test --unsafe-perm. I forgot the test on the end.

dmike3 commented 3 years ago

Whoops... npm -g i homebridge-fordpass@test --unsafe-perm. I forgot the test on the end.

Quick test, and it seems to update a lot faster now.

Does Ford have a limitation on how many times you can check-in over the API?

Lastly, i'm digging through your code. Where is the code the pertains to how often it checks in?

Brandawg93 commented 3 years ago

https://github.com/Brandawg93/homebridge-fordpass/blob/master/src/index.ts#L164

I haven't committed the test stuff yet. I haven't stress tested their API to see what the limitation is, but I just didn't want everyone's homebridge to be attempting to update every second.

dmike3 commented 3 years ago

https://github.com/Brandawg93/homebridge-fordpass/blob/master/src/index.ts#L164

I haven't committed the test stuff yet. I haven't stress tested their API to see what the limitation is, but I just didn't want everyone's homebridge to be attempting to update every second.

Thanks.

It seems to work and update much faster. This will work better for automation purposes.

Brandawg93 commented 3 years ago

This should be reflected in v1.1.3.

dmike3 commented 3 years ago

Something to add, and I may need to open another issue.

The doors would automatically unlock on their own for some reason. I found 45 minutes later the door went to unlock?!

not sure what's going on, but I've removed the plugin for now. Don't need my stuff getting robbed from my car.

Brandawg93 commented 3 years ago

Would they unlock on their own or would the API just say that they were unlocked? The default state for the doors in the API is unlocked. If the API stops working from Ford's end (which I've seen happen several times), the switches revert to their default values. It doesn't mean that the doors actually unlocked on the car. Ford's API is pretty rough to be honest which is probably why this API isn't open to the public.

dmike3 commented 3 years ago

Would they unlock on their own or would the API just say that they were unlocked? The default state for the doors in the API is unlocked. If the API stops working from Ford's end (which I've seen happen several times), the switches revert to their default values. It doesn't mean that the doors actually unlocked on the car. Ford's API is pretty rough to be honest which is probably why this API isn't open to the public.

Yeah, long story short. I have a virtual switch and automation under homekit.

May be the fault of both. The state not reflecting the actual lock state and then the VS sending an unlock command.

Here is what I had setup for automation. I use this to communicate back to Homeseer. I'm thinking a native plugin needs to be made for Homeseer.

VS Switch Off = Lock Doors VS Switch ON = Unlock Doors Lock Doors = VS Switch Off Unlock Doors = VS Switch On

dmike3 commented 3 years ago

Would they unlock on their own or would the API just say that they were unlocked? The default state for the doors in the API is unlocked. If the API stops working from Ford's end (which I've seen happen several times), the switches revert to their default values. It doesn't mean that the doors actually unlocked on the car. Ford's API is pretty rough to be honest which is probably why this API isn't open to the public.

It's not available to the general public? How are you making it work?

Brandawg93 commented 3 years ago

I found another github project where someone reverse engineered the app and basically modified what they had.

https://github.com/d4v3y0rk/ffpass

captconstruct commented 3 years ago

This is because it can take Ford's API up to 30 minutes to update itself. The app can only see what the Ford API sees, unfortunately. The vehicle doesn't send an update every time you lock/unlock or start/stop your car. If you use the app to lock/unlock or start/stop the car, it will update the API.

Thanks for letting us know. I appreciate the plugin more than you know. I'm not the best at coding, so if I'd found a bug, I just wanted to help in some small way.