[Ovmsdev] ovms_shell

Mark Webb-Johnson mark at webb-johnson.net
Tue Oct 23 09:49:10 HKT 2018


To help with supporting end-users, I’ve cobbled together a small command line shell for OVMS. It may be of use to others for working on their own cars.

You’ll find it in the ovms v2 repository, under clients, as ovms_shell.pl. It should run fine under unix-like operating systems (Mac, Linux, BSD, etc). Perhaps workable under windows, but would require a perl environment.

Here is an example of it in use:

$ ovms_shell.pl api.openvehicles.com
Welcome to the OVMS shell
Server is api.openvehicles.com:6867 (can be specified on the command line)
Enter 'open <vehicleid> [<password>]' to connect to a vehicle, or 'close' to disconnect

ovms> open DEMO DEMO
Connecting to DEMO...
Connected to server
>MP-A 0 ZxDqLCFCXhe4S8r/LK0gyC KVDjwsJWZxQCrFX+NQ3GRQ DEMO
<MP-S 0 9K0rAt/ViViZkHm2ik/mw8 8wsotf+GCUqVIIhrofBHXg==
Connected and logged in to DEMO
Server reports 1 app(s) connected (including this shell)

Vehicle Firmware Message:
  Version:   1.5.0
  Type:      TRDM
  VIN:       VIN123456789012345
  Signal:     (5)

Vehicle Status Message:
  Battery:   soc 41 cac  soh  voltage  range-full K
  Range:     ideal 146K estimated 131K
  Charge:    state charging mode standard (220 V 13 A, limit 13 A) type
             state 1 mode 0 substate 5
             time 6 duration  (0 kWh) to-full  to-set K/%%
             timer 0 (start 0)
  Cooling:    (limit temp  time ) estimated  K %%

Vehicle Environment Message
  Temps:     inverter 35 motor 45 battery 30 environment 25 charger  cabin  (stale 1)
  Locked:    4
  Trip/Odo:  trip 0 odometer 7098790 speed 50 park-time 0
  12vBatt:   level 12.0 current  (ref )
  Doors:     doors1 124 doors2 24 doors3 0 doors4 0 doors5

Vehicle Location Message:
  Position:  22.442075,114.028017 (lock: 1)
  Direction: 90
  Altitude:  0
  Speed:     1
  DriveMode:
  Battery:   power  used  recd

Vehicle TPMS Message:
  FL:        29 PSI 27 C
  FR:        29 PSI 27 C
  RL:        40 PSI 31 C
  RR:        40 PSI 31 C

Vehicle data is currently 5 second(s) delayed

Vehicle Firmware Message:
  Version:   1.5.0
  Type:      TRDM
  VIN:       VIN123456789012345
  Signal:     (5)

Server Firmware Message:
  Version:   2.1.1-20121216

Vehicle is online live

Vehicle Status Message:
  Battery:   soc 41 cac  soh  voltage  range-full K
  Range:     ideal 146K estimated 131K
  Charge:    state charging mode standard (220 V 13 A, limit 13 A) type
             state 1 mode 0 substate 5
             time 6 duration  (0 kWh) to-full  to-set K/%%
             timer 0 (start 0)
  Cooling:    (limit temp  time ) estimated  K %%

Vehicle Location Message:
  Position:  22.442075,114.028017 (lock: 1)
  Direction: 90
  Altitude:  0
  Speed:     1
  DriveMode:
  Battery:   power  used  recd

Vehicle Environment Message
  Temps:     inverter 35 motor 45 battery 30 environment 25 charger  cabin  (stale 1)
  Locked:    4
  Trip/Odo:  trip 0 odometer 7098790 speed 50 park-time 0
  12vBatt:   level 12.0 current  (ref )
  Doors:     doors1 124 doors2 24 doors3 0 doors4 0 doors5

Vehicle TPMS Message:
  FL:        29 PSI 27 C
  FR:        29 PSI 27 C
  RL:        40 PSI 31 C
  RR:        40 PSI 31 C

(here is some data from another live car - as DEMO is limited)

ovms> metric list v.b
...
Vehicle Response:
  v.b.12v.current
  v.b.12v.voltage                          12.75V
  v.b.12v.voltage.alert
  v.b.12v.voltage.ref                      12.6V
  v.b.c.level.avg
  v.b.c.level.max                          88%
  v.b.c.level.min                          86%
  v.b.c.level.stddev
  v.b.cac                                  144.469Ah
  v.b.consumption                          173.746Wh/km
  v.b.coulomb.recd
  v.b.coulomb.used
  v.b.current                              35A
  v.b.energy.recd
  v.b.energy.used
  v.b.health                               CAC 144.47Ah SOC 100% LIM 87% MIN 86% MAX 88%

ovms> ota status
...
Vehicle Response:
  Running partition: ota_1
  Boot partition:    ota_1
  Firmware:          3.1.010/ota_1/eap (build idf v3.1-dev-1585-g812f959 Aug 26 2018 17:09:48)
  Server Available:  3.1.010 (no update required)

  Sun Aug 26 09:10:00 UTC 2018 OTA release
  ...

It supports both v2 and v3 modules, and doesn’t care - just uses the v2 protocol, and is pretty basic. Messages from the vehicle/server are decoded where implemented, and just dumped on the screen otherwise. Anything you type (other than the system commands ‘open’ and ‘close’) is sent to the car as a type ‘7’ command, and responses shown on the screen. The decodes are not amazing, and at the moment are pretty simple value dumps, but good enough for support purposes.

I use it on the server itself, so it defaults to 127.0.0.1 (but that can be changed on the command line). Similarly, if you configure in ovms_shell.conf a mysql server connection, it can read server passwords from the database directly. Otherwise, you can specify the server password as a parameter on the ‘open’ statement.

As I said, it is pretty much designed just for my own support use, but might be useful to others. Enjoy.

Regards, Mark.

P.S. I haven’t been able to contribute much to the project code for the past month or so. Overwhelmed at work, and out of action with a shoulder rotator cuff problem (cortisone injections are wonderful). Anyway, it seems more under control now, so I should be back to contribute more in the coming weeks. I really need to finish off the bluetooth support, and resolve that alloca crash we have been seeing (related to esp32 wifi stack it seems). Then, I have some fun contributions for the roadster (taking advantage of the 3 bus cable we now have).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20181023/6680e3ef/attachment.html>


More information about the OvmsDev mailing list