DroneMobile Component

Starting to try and incorporate this into some automations. Is there a way to send a lock or unlock command regardless of what the last status update was? If the sensors haven’t been updated and I try to send a lock command to what shows to be an already locked vehicle it doesn’t seem to go through.
Or do I have to send the refresh_device_status command, and then the lock command?

I apologize that I did not see this until now. Yes, I have an automation that locks the doors every night at 10p.m. It first calls the drone_mobile.refresh_device_status_[Vehicle Name] Service, and then executes the Lock command. I tried to mimic the way the app works as close as possible. The app automatically pulls the device status when you open the app. That way, you should, in theory, have an up-to-date state before performing any functions. I was also trying to be efficient in the calls going back and forth between the API, but maybe we should just issue the command regardless. Or, I could probably add an optional “force command” parameter to send it regardless of the current state. What are your thoughts?

I think the option of a force command wouldn’t be a bad thing. Since my original inquiry I have something set up now that works pretty well, but requires the use of node-red, which isn’t a problem for me as that’s mainly what I use anyway. I have a flow that first uses the drone_mobile.refresh_device_status_[Vehicle Name] service, and then goes on to a “wait until” node that doesn’t proceed until the door lock entity refreshes/becomes “unlocked” or times out after 10 seconds if it doesn’t (refresh does not occur, or doors are already locked.

Thanks to your component, I’m working on a way to integrate passive arming into Home Assistant with a node-red flow. It would let me implement more safeguards than the remote start’s built in option. Wireless Android Auto connection status, connected to home wifi ssid, location, vehicle door status, engine status, etc. Or, simply be able to flip a toggle in Home Assistant to disable that function.

I just pushed an update to add a configuration option to override the state check when interacting with the locks. If you pull this latest version, please know that it will probably break your installation for a second. You can either delete the integration and re-install it, or you can go to configure your installed instance in the integration section of Home Assistant, click “configure”, and then click “OK”. Then you will need to restart the server. If you have any issues, let me know. Thanks.

2 Likes

looks promising will revisit when I have time

To anyone that is using this integration, HA 2022.7 caused this to break. I have fixed the issue and updated code on github. Please download the latest version from there and replace your custom component in your HA instance. I will try to find some time to get this into the official HA repository, but I haven’t ever done anything like that before, so there’s a bit of a learning curve.

Side Note, if anyone knows how best to setup a simple unit test suite, please let me know. That’s really the only thing keeping me from pushing this to the HA repo and getting it code reviewed.

@bjhiltbrand Recently stumbled across this awesome thread, but now having a few issues with installation.

I managed to get the dron_mobile files connected through HACS by adding a custom repository and linking to github. I see the files in custom_components/drone_mobile, so that part is fine. But what to do after has me perplexed. From the readme in mentions to go to integrations and follow the configuration options to specify some information…not sure where to go. I’ve tried searching in HACS, under settings/devices & services, scrolled through the entities - I can’t see any evidence that anything was actually installed. There is a line in one of the files that states “Add entities from the config.” Do I manually add the entities? In the configuration.yaml file? I would appreciate any insight.

Thanks.

@joseph.guy.white There have been some changes to the UI in Home Assistant over the last few releases, so I might need to update the Readme. Once the files are in the custom_components folder, you should be able to access the integration like any other integration in Home Assistant. You may need to restart your HA instance to get it to show up first, though. If you go to the Home Assistant UI, then click on “Settings”, then on “Devices & Services”, and finally click the “Add Integration” button, you should be able to search for DroneMobile in the list of integrations. Click it and it should take you through the setup.

Edit: I just updated the Readme.

Got it working, everything populated once.

When I called the refresh service manually, it errored out though.

Any ideas on what to look at?

Logs:

2022-11-20 14:38:35.073 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2022-11-20 14:38:35.074 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2022-11-20 14:38:37.959 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: unsupported operand type(s) for *: 'NoneType' and 'float'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1744, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1781, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/config/custom_components/drone_mobile/__init__.py", line 66, in async_refresh_device_status_service
    await coordinator.async_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 348, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 551, in _stringify_state
    if (state := self.state) is None:
  File "/config/custom_components/drone_mobile/sensor.py", line 197, in state
    return self.get_value("state")
  File "/config/custom_components/drone_mobile/sensor.py", line 52, in get_value
    (
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'
2022-11-20 14:38:37.964 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547015613104] Error handling message: Unknown error (unknown_error) from 192.168.210.165 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 646, in handle_execute_script
    await script_obj.async_run(msg.get("variables"), context=context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1744, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1781, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/config/custom_components/drone_mobile/__init__.py", line 66, in async_refresh_device_status_service
    await coordinator.async_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 348, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 551, in _stringify_state
    if (state := self.state) is None:
  File "/config/custom_components/drone_mobile/sensor.py", line 197, in state
    return self.get_value("state")
  File "/config/custom_components/drone_mobile/sensor.py", line 52, in get_value
    (
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

I ran the dump - apparently mine doesn’t report temperature but returns a null instead:

  "current_temperature": null,

Guess I’ll try just commenting that bit of code out for now.

Interesting… what remote start module do you have? I have the Compustar CM-DC3 remote start module, and the X1 LTE Module. I believe that by default, temperature is not supported on the CM-DC3, but it is supported when the X1 module is plugged in. I’m interested to know what hardware you have, and if it doesn’t support temperature, or if the API call isn’t reporting the temperature. I’ll do some null handling in the integration for this case.

Edit: I’ve merged in a fix to the codebase. Download it and give it a shot.

According to the Android software, I have the FT-7200S(CM7200). According to the DroneMobile website, I have the FT-X1MAX.

A temp sensor would be nice… I wonder if it can be added?

Great integration. Does anyone’s GPS sensor only always say “NW”. I feel like this used to work, but can’t see any different values in the history.

Can you see a temperature in the DroneMobile app? If you can, I would assume it is supported. If that’s the case, I would be very interested in seeing if there is a difference in the json payloads for requests between the X1 and X1MAX Modules. Would you be comfortable using a packet sniffer to record a session of you interacting with the app (or website) and then getting me the payloads to take a look at them?

Edit: Actually, in theory, you should just have to call the dump service (DroneMobile: dump_device_data_[Vehicle Name]) from inside HA and it should get me the relevant payload I need.

I’m not paying for the premium plan, just the basic one. I grabbed the payloads that I used to write the integration when I was in a trial for the premium plan, so those payloads may have changed since then, which would cause the GPS direction to not update properly.

Would you be comfortable using a packet sniffer to record a session of you interacting with the app (or website) and then getting me the payloads to take a look at them?

Edit: Actually, in theory, you should just have to call the dump service (DroneMobile: dump_device_data_[Vehicle Name]) from inside HA and it should get me the relevant payload I need.

Not sure if this is still helpful, but I used to install these and know the Compustar systems pretty well. Both the DC3 and CM7000/72000 support temperature readings, but both require a thermistor to be plugged in. It doesn’t rely on the X1 module being present, there are also 2-way RF remotes available that report temperature, as well as programmable options in the brain itself that rely on the temperature sensor regardless of which RF kit is installed (such as automatically starting if temperature falls below a certain threshold.) Most likely a “null” return means that the thermistor wasn’t installed, it’s basically a short dongle that plugs into a dedicated port on the brain.

Sounds like you don’t have a thermistor installed. Are you able to access the CM7200 unit in the car? There is a blue 2-pin port where it would be plugged in, and if you look at the backside there may be a label with the legend for the ports.

This is the guy you’re looking for: Thermistor | Compustar

If it is not present, they are available for <$10 from many sources online. Alternately, if you go to a Compustar dealer (especially if you have a good relationship with the one where it was installed) and ask nicely, one of the installers may have a spare in their toolbox. I have a few boxes of miscellaneous parts from my installer days, I’ll take a look tomorrow and see if I happen to have one I could send you.

That’s interesting. I definitely do not have a thermistor installed, yet my Drone Mobile app for both cars shows my temperature still.

Could it be reading from the CAN bus whatever the car is sensing?

Hmm, that is interesting. I reached out to the guy who was the regional Compustar rep until about a year ago and he confirmed that none of the brains had a temp sensor built in, nor do the X1 Drone Mobile modules. It’s possible that it is reading your car’s sensor over CAN, I don’t recall ever noticing that functionality, but what it reads over CAN varies pretty drastically from one model to the next, and the model-specific CAN functions were often not well documented. Install sheets would always have the same generic matrix showing core functions, like whether it can lock/unlock the doors, pop the trunk, read door open status, etc, but even then it wasn’t 100% correct a lot of times and you’d have to go back and run a wire for hood pin or something else that it claimed to support. I’m curious now though, next time I’m doing some work on my car I’m going to unplug the thermistor and see if it still reads temp, it does almost everything over CAN in my car.

Hmmm… do you know if it’s available on Amazon or Bestbuy? Or if I can just make my own?