Skip to content

Commit

Permalink
First stab at some Tesla Model S rules
Browse files Browse the repository at this point in the history
  • Loading branch information
markwj committed Feb 6, 2014
1 parent d271d46 commit ceac9e2
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions rules/teslamodels
@@ -0,0 +1,53 @@
# Tesla Model S Rules file...

unique 508 1

# BRAKE pedal position
decoder ID:165 brakepedalpos { (($d2<<8)+$d1,'%'); }
coverage ID:165 1,2

# PACK info (chargingrate??)
decoder ID:222 chargingrate { ((($d2<<8)+$d1)/100,'kph'); }
decoder ID:222 essvoltage { ((($d4<<8)+$d3)/100,'V'); }
coverage ID:222 1,2,3,4

# GEAR, ACCELERATOR, POWER
decoder ID:254 gear { (&choice($d1,0x00,'off',0x04,'park',0x0c,'neutral',0x08,'reverse',0x10,'drive'),''); }
decoder ID:254 brake { (($d2==0x10)?'on':'off',''); }
decoder ID:254 accelpos { (($d4<<8)+$d3,'%'); }
decoder ID:254 powerregen { ((($d6<<8)+$d5)/100,'kW'); }
coverage ID:254 1,2,3,4,5,6

# SPEED (regenbrakelight?)
decoder ID:256 driving { (($d1==0x21)?'driving':'stopped',''); }
decoder ID:256 regenbrakelight { (($d2==0x09)?'on':'off',''); }
decoder ID:256 speed { ((($d4<<8)+$d3)/10,'mph'); }
coverage ID:256 1,2,3,4

# LIGHTS ?
decoder ID:266 lights { (&choice($d1,0x89,'on',0x8a,'off'),''); }
coverage ID:266 1

# WH/KM ????
decoder ID:26A whkm { (($d2<<8)+$d1,'wh/km'); }
coverage ID:26A 1,2

# CHARGE LEVEL
decoder ID:2C8 soc { ($d2,'%'); }
coverage ID:2C8 2

# COUNTRY
decoder ID:398 country { (chr($d1).chr($d2),''); }
coverage ID:398 1,2

# 3D2: 2x 4 byte counters, count up when on
# total Kwh used???
# 2B 5A 23 00 D4 0A 26 00

# VIN
decoder ID:508:00 vin1 { (chr($d2).chr($d3).chr($d4).chr($d5).chr($d6).chr($d7).chr($d8),''); }
decoder ID:508:01 vin2 { (chr($d2).chr($d3).chr($d4).chr($d5).chr($d6).chr($d7).chr($d8),''); }
decoder ID:508:02 vin3 { (chr($d2).chr($d3).chr($d4),''); }
coverage ID:508:00 1,2,3,4,5,6,7,8
coverage ID:508:01 1,2,3,4,5,6,7,8
coverage ID:508:02 1,2,3,4

0 comments on commit ceac9e2

Please sign in to comment.