Skip to content

openWB SOC endpoint

Tim (robske_110) edited this page Jan 31, 2022 · 3 revisions

This documents how to create a simple soc endpoint for use in openWB. Recently the VW login slightly changed and the native adapter for openWB broke, which is why this was created. Nevertheless, this is also useful if you are already running IDDataLogger and want to avoid excessive and unnecessary requests to VW by another implementation just to get the SOC.

Steps:

  1. Create a file openWBsoc.php in the vwid web folder.

    To do this on a standard installation (on a raspberry pi / Debian) execute the following command:

    sudo nano /var/www/html/vwid/openWBsoc.php

    And paste this content into it:

<?php
define("ALLOW_KEY_AUTHENTICATION", true);
require "login/loginCheck.php";
require_once "DatabaseConnection.php";

$socRes = DatabaseConnection::getInstance()->queryStatement("SELECT batterysoc FROM carStatus ORDER BY time DESC LIMIT 1")->fetch(PDO::FETCH_ASSOC);

echo($socRes["batterysoc"]);
  1. You can now enter the URL http(s)://IP/vwid/openWBsoc.php?key=<AUTH_KEY> in openWB. AUTH_KEY is a key that is created on installation, and additional ones can be generated at any time. (See https://github.com/robske110/IDDataLogger/blob/master/docs/beginnerguide.md#finishing-set-up).

    For standard installations IP is the IP of your PI in your local network or the hostname if you have made ID DataLogger available from the internet.