BMW i3 emonHub interface

I’ve written a new emonHub interface to replicate the BMW API used by most BMW cars - in particular the BMW i3.

Any car which can connect via https://www.bmw-connecteddrive.co.uk should be able to be monitored.

I’ve used it to generate feeds on charge and range states.

2 Likes

This change has been merged into the latest emonHub code - thanks @TrystanLea

Hi @stuart

I am new here, I have had a good look around my emonpi but I am unsure how to get this working. any chance of a pointer?

Thanks
Paul

Hi Paul,

Do you have an raspberry pi running the emonPI software already up and running? If not, that’s the first step - follow the guides on this site.

If you do, all you need to do is logon to emonCMS (on your local raspberry pi) and click the setup menu, and “emonhub”.

Click the red “edit config” button and paste the below after the “[interfacers]” line on the screen.

### This interfacer manages communication to BMW API for electric car monitoring
[[BMWi3]]
    Type = EmonHubBMWInterfacer
    [[[init_settings]]]
        timeinverval =600
        duringchargetimeinterval=60
        nodeid = 28
        tempcredentialfile = /tmp/bmwcredentials.json
        bmwapiusername = YOUREMAIL
        bmwapipassword = YOURPASSWORD
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,

You need to change the email and password above, to match the username and password you use at the https://www.bmw-connecteddrive.co.uk website.

Hi Stuart,

Thanks for the information on adding to the my local emonpi.

do I need to create a feed for each item
•battery_size_max
•beRemainingRangeElectricMile
•chargingLevelHv

I have looked under input, but I cannot see the above or even how to apply a filter for the above.

This is one steep learning curve. :smiley:

Thanks
Paul

If you look in the “inputs” section, those values should already be in there if its working.

If you just see a section for “bmwi3” then reboot the PI.

You will need to create feeds once the inputs are working.

Hi Stuart.

A reboot sorted it.
Thanks for your help, having fun building dashboards at the moment.

Paul

Hi @stuart
Just a little update, your interface has been working great. Thanks :smiley:
Paul

Brilliant, thanks for the feedback

@stuart Cool! We have two i3 that I would like to get online, but they are hooked up to https://www.bmw-connecteddrive.de What do I need to do to get that to work? Thanks

Have you tried the solution so far? I suspect it should work, you need to configure the emonhub interface as per the instructions.

No, I havn’t tried the current solution, just assumed it would not work for a “.de” connected-drive. We have two cars connected to the account, and the emonCMS config file doses not seem to have any parameter for selecting the car. Anyhow, guess it’s best to give it a go and see what happens :slight_smile:

The code is here…

so if it doesn’t work, if you find the “EmonHubBMWInterfacer.py” file on your emonhub (PI) install and edit the URL at the top of the file to “.de” you might find it works!

We could always move that setting into the configuration file if you find it works for you. I don’t know whats going to happen as you have two cars on 1 account though - looking at the code it should pick the first one returned by the API

1 Like

Stuart, tried to implement the mod, but alas; updating my raspberry Pi have all but bricked it :smiley: Guess I have been unfaithful and not followed and updated my setup regularly and now have to pay the ultimate price. Will post back when I get things up running again :wink:

Sorry to hear that!

OK, up running again :slight_smile: It’s not working straight off the bat, so I’m trying to locate the EmonHubBMWInterfacer.py file on my Pi. Do you have a hint as to where it is located?

Try /home/pi/emonhub/src/interfacers

I tried changing the url ending to “.de”, but that didn’t do it. I don’t get any inputs and I don’t see anything in the EmonHubLog. Will there be a log-file saved somewhere that I can use for debugging? There is no bmwcredentials.json file in the /tmp directory, so guess the interfacer is not starting

When you restart the emonHUB do you see the lines referencing the BMWi3 interface? like this?

2017-12-03 15:01:14,745 INFO     MainThread EmonHub emonHub emon-pi variant v2.0.0
2017-12-03 15:01:14,746 INFO     MainThread Opening hub...
2017-12-03 15:01:14,748 INFO     MainThread Creating EmonHubBMWInterfacer 'BMWi3' 
2017-12-03 15:01:14,751 INFO     MainThread Loaded credentials from cache

If you dont then the configuration file isnt correctly setup.

Got it up running now, fault 40 - sorry - had put the interfacer into the node area. Not sure if the “.de” change is required, I can test it out if you want to know? I have not had a close look at the input yet, but I assume they are for the first car, I’ll keep an eye on this to se if its consistent.

Actually I have it running on two RPi’s now, found a Pi3 in the drawer and decided to use that for experimenting. I have decide to keep them both running, then they can each monitor one of our two SMA Inverters. I do though have a problem getting the BT turned on on the Pi3 - seems it should work, but when I do the “sudo hciconfig hci0 up” it returns “Can’t get device info: no such device”