DroneMobile Component

Haha. No worries. I find that Fiddler is way more user friendly, and my go to tool of choice. On rooted android, I used httpcanary to watch app traffic. I used postman to test the endpoints I found and send requests outside of the regular flow.

I abandoned Wireshark completely, I just pulled up the developer console in Firefoxā€¦ :man_facepalming:
Iā€™ll look into HTTPcanary to see what happens when I send a command and get a push back.
I have a POC (VERY messy, more like notes.) Working on cleaning it up. version 1a will be raw python script until I can figure out what I need to do to make it Hassio compliant.

I did test the API with Postman, and i was still having trouble with the commands, until I saw that I was posting with plain text and not application/JSON, instant success.

edit: bad typing

I now have working code. which includes using the refresh token. Being that we are working with cars and not just a light bulb, I considered it a little more secure to not have the password available in plain text. I will implement a notification path to warn the user that the refresh token has expired. (unfortunately I could not find an answer on when that is as AWS documentation says it is programmable from 5min to 10years) but it would be evident thru failure. I will leave the ability to leave it in the config if the user doesnā€™t care.
Still havenā€™t gotten to the Hassio setup yet, but i still havenā€™t gotten a releasable script ready. It works and is no longer just notes as my prior implementation was, but it isnā€™t really user friendly at this point. Might not be until the weekend 'til I have any considerable amount of time to really get anywhere.

edit: today I learned you can use a keyring (not desirable because that makes the core no longer able to autoboot) or thru AWS. Doesnā€™t change my decision to give the user the option for a ā€œtemporaryā€ password

Nice! I would agree that using the refresh token is the best route to go. Please let me know if you need me to test code. I also have 2 cars on my account. I donā€™t know if you have more than 1 car, but it would be good to make sure we can handle multiple vehicle scenarios.

The main package is near completion, I am cleaning up the code, and fail testing.
I will be posting to github in the next week or so. Being the holiday season I have several other projects that unfortunately take precedence. Iā€™ve really only been able to work on this during my down time at work in a browser IDE (not particularly ideal).
From there, I need to look into how to get it on PyPi so hassio can import it. as well as building the integration. (any help here will be appreciated)
Iā€™ll appreciate anyone who can help with bug reporting once its uploaded.
As this will be my first public deployment, please be kind =).

Thanks for your patience.

1 Like

Sorry folks, been quite busy. I finished my last ā€˜bigā€™ project for the holidays.
I had my father(system software eng) and uncle(back end dev) peek at my code before going public,
they pointed out a few logical flaws and at least 2 security issues.
Also, in my testing I noticed 2 new issues:

The AWS auth server went down about 2 weeks ago, I didnā€™t think about that and have to add better error/exception handling.
As @bjhiltbrand pointed out, there is no ā€˜auto refreshā€™ of the telemetry (e.g. the interior temperature).
This is not simply a server issue, it is also that the module doesnā€™t appear to actually update most of the sensors to the server unless the car is actually running, and/or there is an explicit api call to do so. I assume this is in the interest of saving battery life. It does appear to update on any successful command, but I wouldnā€™t recommend any type of auto polling by hassio to show things like the door locks(mine always shows unlocked for some reason anyway. must have missed a connection) or even the battery level.
I have to address the security holes and some of the unseen errors before I would want to stamp my name on it and post.
I am off for 2 weeks starting Festivus and plan to take a hard look into it.
At this point, I am uncertain if I will be porting to hassio, it appears to be outside my skill level at this moment, and with the impracticality of updating the sensors, it may not even be worth it. I will still be (eventually) releasing the package, and will be personally be running it as an external script.
Sorry to disappoint, but once it is released, I would not be opposed to someone else implementing it themselves if they so chose.

Happy Holidays!
cheers.

Not only that, Iā€™m pretty sure the main driver behind not updating until a command is sent is to limit the amount of data used per SIM card. There is a limit in their terms of service for the varying tiers, and it states that they reserve the right to charge you more if you go over those data limits.

From the Terms and Conditions:

  1. General Practices Regarding Use & Storage:
    You acknowledge that Firstech, LLC may establish general practices and limits concerning use of the Service, including without limitation, the maximum number of times (and the maximum duration for which) you may access the Service in a given period of time. Also, customers with the ā€œBasic Planā€ of service may be required to upgrade their service to the ā€œPremium Planā€ if they are found to use the service in excess of 70KB per month for three consecutive months. Use exceeding 70KB is considered excessive use or for commercial applications and will be subject to an upgrade to a higher usage plan, deemed ā€œPremium Planā€. In the rare event that customers exceed ā€œPremium Planā€ usage rates, Firstech, LLC reserves the right to charge the customer for additional usage.

Any kind of heartbeat service would almost assuredly overrun that data allotment.

I was at a loss as to the flow to get any plugin into HASS IO, or to Pypi, as well. I can research it over the course of the next couple weeks, as I am wrapping up at work as well. I will have some time to spend on this. If you would be willing, I would like to get a hold of what you have so far and poke around with it to see if I can QA it any further. Send me a message if you want. Thanks.

Most of my python is relegated to local functions, and wrapping existing wrappersā€¦ This is my first real attempt to wrap an api directly. As I mentioned before, I have it ā€˜workingā€™. In fact I use it everyday at work since they managed to block the drone site(and i have little to no cell svc inside), but not ā€œcodeanywhere.comā€ thru which I can SSH into my home server and send a ā€˜remote_startā€™ from my code. But it is messy, I have a new revision building, Iā€™ll try to get on it more tomorrow/the weekend and at least have the class structure re-built. then I will re build the test script into something like an actual app. Iā€™ll post the git link once I have something to show.

Sounds good. Iā€™m already ā€œstalkingā€ you on github. :wink: I appreciate your hard work on this. Thanks.

@itkfilelor thanks for the hard work. Looking forward to see the ā€œfinishedā€ product.

Any updates on this? The google home integration stopped working a while back, would be nice to have it integrated into HA.

Just to add to this, I created a node.js wrapper that could be useful. This is not directly consumable in HA out of the box but someone could easily make a node-red contrib plugin that can utilize this.

Repo: https://github.com/Hacksore/drone-mobile

Nice!
Thanks for picking up my slack! :wink:
I havenā€™t run it yet, but I peeked at the code and it looks pretty good.
Sorry I havenā€™t been around. Seems life always likes to get in the way. Havenā€™t made much progress since my last report. I wonā€™t be abandoning the project, and I assure you I will post what I have once I have something usable. But I canā€™t make any projections at this point. My beloved recently informed me that we will be remodeling our kitchen. And by we, I mean DIYā€¦ She also told me I ā€œneed to do something about that cave you call an officeā€ (basically curtains in the basement). So I guess I will be building an actual room down here. :sweat_smile:
Iā€™ll do my best. Sorry for all the delay.

In the interest of not gilding the lily further, here is what I have thus far that at least pretends to work. I am building a CLI tool around it (its not going very well :sweat_smile:). I will post that, and hopefully an actual install script when I can.

Cheers :beers:

In the manual it does show a uart port it has tx rx and power im wondering if an esp with a uart interface can replicate the commands thus eliminating the need for drone mobile also possibly making it cheaper to build a homemade variant. I have a compustar and uart adaptor but without the drone mobile device I canā€™t tie into the device to watch the command. But I can figure out the baud rate along with possibly finding commands to do sometgingā€¦ Iā€™m on mobile sorry for crap text

The compustar device has a uart interface id tie into the TX and rx find the baud rate and see if thereā€™s an easier solution!!

Heads up, it would appear drone changed the api a bit. looking into it and will post back when I update my fake module. haha
For now I wont be able to do much more than change the commands and endpoints, but I did find a few more to add to my list.

I may just be an idiotā€¦ something looked different, and my slapped together shell command stopped workingā€¦
maybe itā€™s not. sighā€¦

OK I AM an idiotā€¦ my refreshToken expired and being a shotty coder, my error handling is bunk :sweat_smile: iā€™ll commit an update.

Alright, I still have more work to do (i.e. - I still need to decouple my API logic from the integration and put it out to pypi.org and I need to do some work on callbacks after events trigger so that Home assistant shows the correct state), but it is working. If you would like to download this and manually install it in your HA instance (just copy it to your custom_components folder), go for it. Please let me know if you have any questions. This is my first time doing anything in Python, and I am still not completely clear on the Home Assistant integration flow, so please go easy on me. :wink: Once I get it to a more stable place, I plan on putting into HA core, hence why Iā€™m not messing with HACS or anything like that.

2 Likes

Alright, I just finished a pretty big overhaul of the integration that now brings all the sensors and toggles in to track and interact with. I am still a bit fuzzy on the implementation of the trunk lock, as Home Assistant is supposed to allow me to treat it as a latching lock and allow a simple ā€œOpenā€ button, but it doesnā€™t seem to want to work that way. For now, you just have to ā€œUnlockā€ it, and wait for the state to update the sensor back to closed after you close the trunk. If anyone has experience in getting locks to play nice in HA, please let me know. Please download the latest code on github (linked in the previous comment), and let me know what you think. Thanks.

Alright, so there is an issue tracking the ā€œis_onā€ property of the HA switch for remote start. The problem is that DroneMobile has 3 different properties (ignition_on, engine_on, and remote_start_status) that track various aspects of the remote start system. As far as I can tell, here is how these properties work:

engine_on is set to true when the car is running, and false when itā€™s not. However, I have observed instances where I started the car, and issued multiple refresh commands, and that engine_on state has not changed to true.

ignition_on is set to true with the ignition is on. I would have thought that this would be tracking whether or not a physical key was in the car, and the ignition was in the ā€œonā€ position. However, I have seen this value set to true when starting the car via remote start.

remote_start_staus is set to true when a vehicle is started using remote start. The issue is that this value is persisted in home assistant, and is only updated when a remote_start or remote_stop command is issued. This means that you could trigger a remote start, drive somewhere, and turn off the car as normal, and Home Assistant would still think that the car was running. This is the scenario that caused me to catch this issue.

So, the question isā€¦ How do we go about accurately tracking and updating the current running status of the vehicle, so that this status is always reflected by the switch state in Home Assistant? Any thoughts on this are much appreciated. Thanks.