msp1974 / homeassistant-jlrincontrol

An integration for JLR InControl to Home Assistant
MIT License
65 stars 11 forks source link

Integration automatic updates #137

Open craigo1975 opened 6 months ago

craigo1975 commented 6 months ago

Hi,

What a cracking integration, only just found it this week, loving all the info it pulls into HA. I've tried various different configuration options all with my PIN populated but I'm finding the integration only seems to update once a day even though I've set the scan interval to every 5 minutes. I've setup a manual refresh button that works and was about to configure an automation to manually refresh every 5 minutes but thought I would check if there is a known issue with the integration not refreshing itself automatically or just my miss-understanding? I have setup automations to notify me when the car is started up and driving (sensor.my_car_current_status) so was assuming that scanning every 5 mins would pick up a change in status within 5 mins of having started a journey? or do I need to set the health info scan to every 5 minutes to achieve that?

Thanks, Craig

ismarslomic commented 6 months ago

@craigo1975 are you using the main version og beta version?

craigo1975 commented 6 months ago

Hi! I'm using the latest main version 2.2.7.

Here's an example that hopefully displays my query:

I have the "scan interval" set to every 5 minutes, "Health Update" every hour: 1

Home Assistant checked for activity at 8:10 My partner left home in the car at 8:15 At 8:43 no activity has been identified, the car shows as being at home locked, when in fact it's been driving for 28 minutes and is 10 miles away? 2 3

I just don't understand what info the "scan interval" every 5 minutes pulls back? It seems if I want to get alerted that our car has been unlocked and is moving, then I need to perform a "health update" every 5 mins as the "scan interval" set to 5 minutes doesn't seem to identify anything or update any sensors, but I'm concerned about the "don't set health update to less than 2 hours" advice in the instructions?

At 9:09, 54 minutes after the car had been moving still no sensor updates 4

Then at 9:10, I assume as part of the hourly Health update it identifies that the car is turned on and moving... 5 6

Any advice will be greatly appreciated

msp1974 commented 6 months ago

Just for info on scan interval v health update. Your car (well most cars) should send updates to the JLR servers on certain events like unlocking, starting engine, stopping engine etc. The scan interval reads this current info from the JLR servers. The health update requests the car to send its info to the servers for us then to read a current status.

I'm wondering if your car is not sending these event updates as we normally see but only when you request a health update.

I have posted tonight on the forum page about work we have been doing to better get current status from the JLR server data. It will be a number of weeks as I am not able to work on this for a little while but we can see if this improves the situation.

I assume the app reflects the status correctly? You will need to have the app open to test this as the first time you load it, it often calls a health update.

craigo1975 commented 6 months ago

Sounds like your theory is spot on.

I just tried a test for extra info: open Home Assistant at 12:49 and it shows HA last checked for activity at 12:10 (I assume as part of the hourly health check) Screenshot 2024-03-21 124939

I then went into the land rover app at 12:50 which initially said last connected 16 hours ago, but after a few seconds updated itself...I assumed that would be the equivalent of a heath check but via the Land Rover app and updates the LR servers?

So I was half expecting Home Assistant to then pull the new info from the LR servers within 5 minutes of 12:50?

However at 13:05, Home Assistant still hasn't pulled any updates as part of the 5 minute scans? Screenshot 2024-03-21 130518

Then strangely, 30 seconds later and 5 mins earlier than the hourly scheduled health update, Home Assistant updated... Screenshot 2024-03-21 130703

To me this indicates the servers that Land Rover expose to Home Assistant were updated around 10 minutes after I opened the LR app?