Repository navigation
Release 0.6.0 - FCON Data Source #102
SquidBytes
announced in
Announcements
Replies: 1 comment 1 reply
|
Hell yeah man, awesome work! |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello again! Sorry for the long delay. I've been quite busy with work and family, and honestly most of my free time has been taken up by video games since I'm finally having fun with them again. I've been fairly addicted to Wardogs and Galactic Racer. But I have been doing small incremental fixes over time as I notice things.
Anyway... with the most recent
0.6.0update I have (finally) added the official FordConnect Query API (FCON), which uses the OAuth 2.0 protocol. FCON is the official API (somewhat quietly) provided by Ford. It's free for anyone to use since it's your vehicle (which is kinda cool, they finally added this). This wasn't a thing when I started working on the Home Assistant integration, which is why my project started with Home Assistant first. I'll give Ford praise there, and I'm happy this was added. If you're curious about more of the project backstory, I have a short write-up on that (and other cool software things I've worked on over the years) in my AI usage disclaimer. And obviously, that's also where I explain that I use AI in the development of LightningROD.For anyone unfamiliar with OAuth 2.0, or with privacy concerns, here is how it works with LightningROD:
Client IDandClient Secret, which you then put into LightningROD.LR_SECRET_KEY).I have been personally testing it for the past 4-6 weeks trying to find issues, and I found some (#99). On my home server I run two copies of LightningROD for testing between updates. For this release I also ran FCON-only instances. This made it easy to spot the differences between the two and track down problems.
It turns out the Home Assistant data isn't as accurate as I initially thought. The biggest one is trip energy. The trip energy number the vehicle sends to Home Assistant is "driving energy" only. It doesn't count climate, accessories, or time sitting in Park. You may be familiar with this from the in-vehicle "Where did my energy go?" screen that shows a breakdown. When testing, I sat in the truck for 45 minutes with it on, and Home Assistant recorded 0.00 kWh for that trip. On normal drives it came out 20-33% lower than what the dash shows. FCON measures the whole trip from key on to key off, the same way the dash does. So Home Assistant trips make efficiency look better than it really is. This also explains why my efficiency never quite matched the dash (#81). This is still a problem, and I'm still thinking about how best to address it.
Right now, when both sources record the same trip, LightningROD keeps Home Assistant's driving energy. In a future update I plan to store both numbers for every trip, so you'll see "trip efficiency" (matches the dash) and "driving efficiency" side by side (and ideally how much went to climate and accessories). It's basically the truck's own "Where did my energy go?" screen. Using both data sources gives both numbers. FCON alone can't provide driving energy. Home Assistant alone might be able to get the total from another FordPass sensor, but I haven't tested that yet.
I also found Home Assistant trips that ended days in the past or showed up twice, and battery/range readings that were all stamped with the same old time (both fixed in 0.6.0).
So with these 2 options, a third one exists: using both, which is how I plan on using it going forward. When both sources record the same drive or charge, LightningROD combines them into a single record instead of duplicates.
A lot of these bugs had already been saving bad data for a while before I caught them. So I've also been working on an "event archive" (#80). LightningROD only pulls the specific values it needs out of each update, and it used to throw away everything else. Now both data sources keep a full, untouched copy of everything they receive:
Each data source has a setting for how long to keep this data (90 days by default, up to 10 years, or 0 to keep it forever).
(Yes, the two settings live in different places and look different. That's on my list to clean up.)
This means that if/when a bug is found in the future, your data can be repaired after the update with the fix. That's what Settings → Data Repair does: it re-reads your archived data through the fixed code, without needing Home Assistant's recorder history. If you want to dig into the full raw data yourself, it's all sitting in the database. (Heads up: it contains PII like your VIN and GPS locations, and it's included in your backups.)
There will still be issues and bugs, I'm sure. If you try FCON outside North America, I'd love to know if it works.
Some final closing remarks: with this project I've never wanted to get "rich" or be famous or anything. I get satisfaction knowing others are using something I created, and that the time I spend working on this can help people other than myself.
Release: https://github.com/SquidBytes/LightningROD/releases/tag/v0.6.0
All reactions