Git Product home page Git Product logo

bmw-to-loxone's Introduction

BMW to Loxone Bridge

Pylint HitCount Code Smells Maintainability Rating Security Rating Bugs Vulnerabilities Duplicated Lines (%) Reliability Rating Technical Debt

This Python script establishes a bridge between your BMW vehicle and a Loxone Miniserver, allowing you to monitor various aspects of your BMW remotely and send relevant data to the Loxone system. The script retrieves information from your BMW, such as door lock status, charging status, and location, and then sends this data to your Loxone Miniserver over UDP.

Prerequisites

Before you can use this script, you'll need the following:

  • Python 3
  • The bimmer-connected library
  • Access to a BMW ConnectedDrive account
  • Access to a Loxone Miniserver

Setup

  1. Install the required Python packages using pip: (pip3 is traditionally used on Rapberry Pis to install libraries for Python 3 other systems may use pip)

    pip3 install bimmer-connected
  2. Modify the script to include your BMW and Loxone Miniserver information:

    # BMW login data
    USERNAME = '[email protected]'
    PASSWORD = 'YourSuperSecurePassword'
    VIN = 'VinOfYourCar'
    
    # Loxone Miniserver IP and UDP target port
    MINISERVER_IP = "192.168.1.30"
    MINISERVER_PORT = 1234

    Replace '[email protected]', 'your_super_secure_password', and 'VIN_OF_YOUR_CAR' with your BMW ConnectedDrive account credentials and your BMW's VIN (Vehicle Identification Number). Adjust the miniserver_ip and miniserver_port to match your Loxone Miniserver configuration.

Usage

Run the script to retrieve data from your BMW and send it to your Loxone Miniserver:

python3 bmw2lox.py

The script will print the collected data to the console and send it to the specified Loxone Miniserver. The script only polls the BMW server once and quits again. To execute it every few minutes you can use cron. Keep in mind that the BMW server has a low max polling rate! The following example is for a Raspberry Pi to run the script every 30min:

- In the terminal enter: "crontab -e"
- Then add the line "*/30 * * * * python3 /home/pi/bmw2lox.py"
- Save and exit

Data Sent to Loxone

The script collects the following data from your BMW and sends it to the Loxone Miniserver:

  • all_lids_closed: Indicates whether all lids (doors, trunk, etc.) are closed.
  • all_windows_closed: Indicates whether all windows are closed.
  • car_locked: Indicates whether the car is locked (1 for locked, 0 for unlocked).
  • charging_level_hv: The remaining battery charge percentage.
  • is_charger_connected: Indicates whether the charger is connected to the vehicle.
  • is_charging: Indicates whether the vehicle is currently charging (1 for charging, 0 otherwise).
  • latitude_x10 and longitude_x10: The latitude and longitude of the vehicle's location, multiplied by 10 for compatibility with Loxone.

Please note that some data fields are commented out in the script. You can uncomment and modify these fields to include additional information if needed.

License

This script is provided under the MIT License. Feel free to modify and use it according to your needs.


SonarCloud

bmw-to-loxone's People

Contributors

marcelschreiner avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.