Automatic OBD-II Indigo Plugin

Posted on
Fri Mar 02, 2018 10:48 am
rapamatic offline
Posts: 166
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Automatic OBD-II Indigo Plugin

dgarozzo wrote:
I will double check my directions on the required Google API access. Very sorry about that!


No worries and no need to apologize. We got this figured out and the plugin is awesome!

Now that the plugin is working (and automatic seems through the backlog on approving permissions), I've started to poke around a little more. Any way that you could directly expose the JSON data under vehicle as custom device states - I'm thinking specifically of fuel level, for example, to make it easy to show that on a dashboard or use it to trigger alerts to fill up the tank....


Sent from my iPad using Tapatalk

Posted on
Fri Mar 02, 2018 10:55 am
dgarozzo offline
Posts: 116
Joined: Jan 08, 2009

Re: Automatic OBD-II Indigo Plugin

That sounds like a great idea! You should be able to see the json responses in the device variables, right? Do you need me to expose them some other way?


Sent from my iPhone using Tapatalk

Posted on
Fri Mar 02, 2018 11:01 am
DVDDave offline
Posts: 294
Joined: Feb 26, 2006
Location: San Jose, CA

Re: Automatic OBD-II Indigo Plugin

dgarozzo wrote:
I will double check my directions on the required Google API access. Very sorry about that!


Sent from my iPhone using Tapatalk

Thanks for the great plugin! Glad we got this figured out. :D

Posted on
Fri Mar 02, 2018 11:04 am
rapamatic offline
Posts: 166
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Automatic OBD-II Indigo Plugin

dgarozzo wrote:
That sounds like a great idea! You should be able to see the json responses in the device variables, right? Do you need me to expose them some other way?


I think it would be a lot easier to setup indigo triggers if the fuel level (or whatever we are interested in, maybe battery voltage too) is directly exposed as a device state (just like location, ETA, or currentMilesFromHome)...


Sent from my iPad using Tapatalk

Posted on
Mon Mar 05, 2018 6:51 pm
dgarozzo offline
Posts: 116
Joined: Jan 08, 2009

Re: Automatic OBD-II Indigo Plugin

I currently use the following script as an Server Action Execute Script for a trigger of Type Automatic OBD-II Event, Event: Approaching Home.

Code: Select all
car = indigo.devices["Automatic OBD Audi"]
indigo.server.speak("The car is almost home at " + car.states["location"])


One way you can create a trigger based on your fuel would be to create a Trigger on Device State Changed for your device. Choose the State: vehicle, Has Any Change. Then in Condition, you could script something like:

Code: Select all
import json
car = indigo.devices["Automatic OBD Honda"]
myVechicleJson = json.loads(car.states["vehicle"])
indigo.server.log(myVehicleJson["fuel_level_percent"])

# code to return true if fuel level is below 10%



Except, ugh, it looks like the Condition has to be Applescript and not Python??!?!?!?!! So, you'd have to do that in the Action instead of the Condition (or figure out the Applescript equivalent), and then code your action in Python. That kinda stinks.

I'll work on breaking out the useful Vehicle attributes into States.

Posted on
Tue Mar 06, 2018 7:00 pm
dgarozzo offline
Posts: 116
Joined: Jan 08, 2009

Re: Automatic OBD-II Indigo Plugin

v1.0.5 - Plugin has been updated to include fuelLevelPercent, batteryVoltage, and activeDtcs as States for the Device.

Posted on
Thu Mar 08, 2018 9:25 am
rapamatic offline
Posts: 166
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Automatic OBD-II Indigo Plugin

dgarozzo wrote:
v1.0.5 - Plugin has been updated to include fuelLevelPercent, batteryVoltage, and activeDtcs as States for the Device.


Sweet, this is perfect - thanks man!

By the way, I'm getting a fair amount of exception notices in my log - I assume this is just some intermittent bad data coming in from automatic, but any way to not show these messages?

Messages like this:

Code: Select all
Mar 8, 2018, 8:17:21 AM    Automatic OBD-II                FYI - Exception caught getting vehicle info: state value type must be bool, int, real, or string


Thanks
-Ray


Sent from my iPad using Tapatalk

Posted on
Thu Mar 08, 2018 3:28 pm
dgarozzo offline
Posts: 116
Joined: Jan 08, 2009

Re: Automatic OBD-II Indigo Plugin

Shouldn’t be any exceptions. I’ll look into it.


rapamatic wrote:
dgarozzo wrote:
v1.0.5 - Plugin has been updated to include fuelLevelPercent, batteryVoltage, and activeDtcs as States for the Device.


Sweet, this is perfect - thanks man!

By the way, I'm getting a fair amount of exception notices in my log - I assume this is just some intermittent bad data coming in from automatic, but any way to not show these messages?

Messages like this:

Code: Select all
Mar 8, 2018, 8:17:21 AM    Automatic OBD-II                FYI - Exception caught getting vehicle info: state value type must be bool, int, real, or string


Thanks
-Ray


Sent from my iPad using Tapatalk



Sent from my iPhone using Tapatalk

Posted on
Thu Mar 08, 2018 3:29 pm
rapamatic offline
Posts: 166
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Automatic OBD-II Indigo Plugin

dgarozzo wrote:
Shouldn’t be any exceptions. I’ll look into it.



I'll turn on debugging so you get more info


Sent from my iPad using Tapatalk

Posted on
Thu Mar 08, 2018 4:26 pm
rapamatic offline
Posts: 166
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Automatic OBD-II Indigo Plugin

Here's a sample debug log:

Code: Select all
Mar 8, 2018, 4:09:40 PM
   Automatic OBD-II Debug          Automatic - Minivan
   Automatic OBD-II Debug          _refreshStatesFromAPI for Automatic - Minivan (C_400027b0f9a87963)
   Automatic OBD-II Debug          Bearer 8e5c1e5f52565eb889fc982921a27e1d0b3114b3
   Automatic OBD-II Debug          vehicleJson updated
   Automatic OBD-II Debug          {"model":"Odyssey","fuel_level_percent":52.0,"display_name":null,"url":"https://api.automatic.com/vehicle/C_400027b0f9a87963/","created_at":"2017-04-30T15:03:25.617000Z","battery_voltage":13.391,"active_dtcs":[],"updated_at":"2018-03-08T22:09:40.535000Z","submodel":"Touring Elite","year":2014,"fuel_grade":"regular","id":"C_400027b0f9a87963","make":"Honda"}
   Automatic OBD-II Debug          _addVehicleToCars: C_400027b0f9a87963
   Automatic OBD-II Debug          getting fuel level percent
   Automatic OBD-II Debug          getting battery voltage
   Automatic OBD-II Debug          getting active dtcs (MILs)
   Automatic OBD-II                FYI - Exception caught getting vehicle info: state value type must be bool, int, real, or string
   Automatic OBD-II Debug          Bearer 8e5c1e5f52565eb889fc982921a27e1d0b3114b3
   Automatic OBD-II Debug          tripJson updated


Looks like its an issue with null data from the check engine light?


Sent from my iPad using Tapatalk

Posted on
Mon Mar 19, 2018 2:41 pm
dgarozzo offline
Posts: 116
Joined: Jan 08, 2009

Re: Automatic OBD-II Indigo Plugin

v1.0.7 released. Should fix the exception.

Posted on
Mon Mar 19, 2018 2:43 pm
dgarozzo offline
Posts: 116
Joined: Jan 08, 2009

Re: Automatic OBD-II Indigo Plugin

The problem wasn't null data - it was getting back a JSON object instead of a string. I needed to convert the JSON back to a string before setting the state.

Who is online

Users browsing this forum: No registered users and 1 guest