DIY OVMS (Open Vehicles) Integration

I get errors if I use https for the calls to https://api.openvehicles.com:6868
“curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number”
if I use http it works fine but I don’t like sending an unencrypted password to the internet.
Any Ideas what’s the cause?

Hello,
I tried several times to get the token from dexter-web.de but failed.
I managed to get the one from www.openvehicles.com
Has anyone of you managed to get a Token from the dexter-web.de server, if it was possible for you, can you help me? Thank you

Same issue here. The procedure doesn’t seem to work with Dexter-web.de. Did you ( @dolam ) manage to get the european car to work on the US openvehicles.com ?

No, non ho provato perchè il server americano in passato mi dava problemi

I also had the curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number error message trying to get a token from https://api.openvehicles.com:6868. It looks like port 6868 expects http. However if you change that to port 6869 the https request works.

In addition, my password contained special characters which could not be put into the token request URL as-is, so I first used https://www.urlencoder.org/ to url-encode the password itself.

Is it possible to send command to stop charging?
I made an automation to send a notification when SoC reaches 80%, and I would like to stop charging at that point.

That may depend on your car.

https://docs.openvehicles.com/en/latest/

Smart EQ. " Control charge:no"…

Apologies, that is a typo from my end, you should be using port 6869 as you discovered. I’ve updated the blog post since. :slight_smile:

Sorry I didn’t seem to get notifications for thread replies so I didn’t see any of these!

Its set up in your preferences.

Use the WEB Editor to create a file “/store/events/vehicle.charge.stop/10-notify” with this line:

notify raise text info usr.charge.batt “Battery is charging stop”

How can you make “send a notification when SoC reaches 80%” ??

Hey there I think this is great! really keen to set this up, I have to admit I’m a bit of a rookie with YAML and HA, side note the blog images seem to be broken but what I am having issues with getting HA to accept the configuration, most of what I have done has been integrations. Currently running HA OS but getting the following when validating the config

Integration error: -binary_sensor - Integration ‘-binary_sensor’ not found.
Integration error: -sensor - Integration ‘-sensor’ not found.

found some code from dexter who works for me:

  - platform: command_line
    scan_interval: 60
    name: car_charging
    command: |-
      username='…'; password='…'; vehicleid='…'; ip='https://ovms.dexters-web.de:6869';\
      c=$(curl -X GET -sc - "$ip/api/cookie?username=$username&password=$password" -o /dev/null);\
      echo "${c}" | curl -X GET -sb - "$ip/api/status/$vehicleid"
    value_template: "{{ value_json.chargestate }}"
 …

copied from https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/issues/624

what would be the new syntax/code because of the newest changes in HA?
described here:

Also, in vehicleid field, what I need to write? The GCM sender ID?
Thanks!

Everything with - platform: command_line needs to be updated.

So the example shown would end up being:

command_line
    - sensor:
        scan_interval: 60
        name: car_charging
        command: |-
          username='…'; password='…'; vehicleid='…'; ip='https://ovms.dexters-web.de:6869';\
          c=$(curl -X GET -sc - "$ip/api/cookie?username=$username&password=$password" -o /dev/null);\
          echo "${c}" | curl -X GET -sb - "$ip/api/status/$vehicleid"
        value_template: "{{ value_json.chargestate }}"

Put this in configurations.yaml. Or also in command_line.yaml works, but then drop the first level in YAML.

And vehicle ID is whatever you registered as vehicle ID in Dexters.

I can confirm this works well. The only thing I don’t like is that for every metric I need to make two HTTP requests for every sensor, while the OVMS server gives a nice full JSON.

Note to self: always try the initial solution before going with the replies and comments. @jabelone blog writeup works perfectly well with Dexter’s server.

The hostname is ovms.dexters-web.de

This means the REST service can be used to update multiple entities, which is way easier to maintain and has less chances of hitting the rate limit on the server.

I’m getting an error:
The system cannot restart because the configuration is not valid: Error loading /config/configuration.yaml: while scanning a simple key in “/config/configuration.yaml”, line 25, column 4 could not find expected ‘:’ in “/config/configuration.yaml”, line 26, column 13

Any idea what’s wrong?

I’ve done it like this and it works!

But it’s still not compliant with the latest version, so some changes should be done?

sensor:
  - platform: command_line
    scan_interval: 60
    name: car_charging
    command: |-
      username='...'; password='...'; vehicleid='...'; ip='https://ovms.dexters-web.de:6869';\
      c=$(curl -X GET -sc - "$ip/api/cookie?username=$username&password=$password" -o /dev/null);\
      echo "${c}" | curl -X GET -sb - "$ip/api/status/$vehicleid"
    value_template: "{{ value_json.chargestate }}"
    json_attributes:
      - soc
      - soh
      - vehicle12v_current
      - chargepower
      - chargekwh
      - temperature_cabin
      - temperature_battery
      - charging
      - charge_estimate
      - chargeduration
      - estimatedrange
      - chargetype
      - speed
      - odometer

  - platform: command_line
    scan_interval: 60
    name: charge_info
    command: |-
      username='...'; password='...'; vehicleid='...'; ip='https://ovms.dexters-web.de:6869';\
      c=$(curl -X GET -sc - "$ip/api/cookie?username=$username&password=$password" -o /dev/null);\
      echo "${c}" | curl -X GET -sb - "$ip/api/charge/$vehicleid"
    value_template: "{{ value_json.chargepower }}"
    json_attributes:
      - linevoltage
      - battvoltage
      - chargecurrent
      - chargepower
      - chargetype
      - chargestate
      - soc
      - units
      - idealrange
      - estimatedrange
      - mode
      - chargelimit
      - chargeduration
      - chargeb4
      - chargekwh
      - chargesubstate
      - chargetimermode
      - chargestarttime
      - chargetimerstale
      - cac100
      - soh
      - charge_etr_full
      - charge_etr_limit
      - charge_limit_range
      - charge_limit_soc
      - cooldown_active
      - cooldown_tbattery
      - cooldown_timelimit
      - charge_estimate
      - charge_etr_range
      - charge_etr_soc
      - idealrange_max
      - cp_dooropen
      - pilotpresent
      - charging
      - caron
      - temperature_pem
      - temperature_motor
      - temperature_battery
      - temperature_charger
      - temperature_ambient
      - temperature_cabin
      - carawake
      - staletemps
      - staleambient
      - charging_12v
      - vehicle12v
      - vehicle12v_ref
      - vehicle12v_current

The beginning of your block should be:

command_line:
    - sensor:
        scan_interval: 60
        name: car_charging

They’ve swapped around how module-sensor relation is defined (I guess for better maintainability of YAML files). Used to be that you defined each sensor and then which module/platform it uses. But I guess this means you have a jumble of mixed platforms in a single file. Now you define the module command_line and every sensor under it, meaning it can only be defined in a more concise way.

Hi all, if you want to use OVMS v3 with MQTT, I’ve put together a respository with a pretty complete set of YAML. The method used by Jaimyn uses HTTP access through OVMS v2. Neither is better or worse, just depends on what you like!