Skip to content

Commit

Permalink
Merge pull request #69 from tesla-local-control/stage
Browse files Browse the repository at this point in the history
stage->main
  • Loading branch information
iainbullock authored Jan 5, 2025
2 parents 536a1db + e2550fc commit 3752498
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 7 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## 0.3.0

- MAJOR NEW Feature: Read car state using BLE

### Changes

- NEW Feature: The following new states / entities are available, more to follow in future releases:
- Sensors: Battery Level (State of Charge); Battery Range; Charge Energy Added; Charger Current; Charger Power; Inside Temp; Outside Temp; Tyre Pressures
- Binary_Sensors: Battery Heater On; Frunk Open; Windows Open; Door Lock
- Switches: Charger; Climate; Sentry Mode
- Numbers: Charging Current; Charging SOC Limit; Climate Temp
- Covers: Charge Port; Trunk
- Selects: Heated Seat Front Left; Heated Seat Front Right
- Buttons: Force Data Update

- NEW Feature: Status / type of charge cable is reported as a sensor

- Fixes:
- Error for setting climate temp #61 (_docker)
- Error 'Icons should be specified in the form "prefix:name" for dictionary value @ data['icon']' when processing MQTT discovery message topic #124 (_core)
- Getting more information over BLE is now possible. #66 (_docker)
- Fetch limited vehicle info over BLE #25 (_core)
- Any potential to "read state" via bluetooth? #115 (_core)
- read SoC possible? #124 (-addon)
- Read state of charge cable connected? #117 (-addon)

## 0.2.2

### Changed
Expand Down
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22.7-alpine3.20 AS build
FROM golang:alpine3.21 AS build

RUN apk add --no-cache git

Expand All @@ -8,19 +8,20 @@ RUN mkdir -p /app/bin
RUN git clone https://github.com/teslamotors/vehicle-command.git /vehicle-command
WORKDIR /vehicle-command
ENV GOPATH=/root/go
RUN git checkout tags/v0.1.0
# RUN git checkout tags/v0.2.1
RUN go get ./... && \
go build ./... && \
go install ./...

FROM alpine:3.20.3
FROM alpine:3.21.0

# install dependencies
RUN apk add --no-cache \
bluez \
bluez-deprecated \
mosquitto-clients \
openssl
openssl \
jq

# Create various working directories
RUN mkdir /data
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Tesla BLE MQTT Docker

Send commands via MQTT to a Tesla car using Bluetooth Low Energy (BLE). BLE bypasses the current Fleet API rate limitation and does not rely on the API.
### Update: it is now possible to read state as well as send commands using Bluetooth

Send commands and read state via MQTT for a Tesla car using Bluetooth Low Energy (BLE). BLE bypasses the current Fleet API rate limitation and does not rely on the API.
The MQTT setup can run on your Home Assistant (HA) system or any device separate from your HA server, e.g. Raspberry Pi located close to where you park your car

**Prerequisite: Have an MQTT broker installed (in Home Assistant or other of your choice).**
If Home Assistant is already using the MQTT integration, then the various entities will be auto-discovered by HA.

### Note regarding polling / reading of state
The current release doesn't poll to read state. You (or more likely a HA automation) need to press the 'Force Data Update' button to read / update the state. This will wake the car and keep it awake as long as you keep requesting state updates (which can be problematic for battery usage). I will collect feedback and implement some polling capability in a future release

## Two options to run this tool:

### 1 - Tesla BLE MQTT Docker
Expand Down
2 changes: 1 addition & 1 deletion app
3 changes: 2 additions & 1 deletion libproduct.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function validateEnvVars() {
VIN_PATTERN='^([A-HJ-NPR-Z0-9]{17})(\|[A-HJ-NPR-Z0-9]{17})*$'
INT0PLUS_PATTERN='^[0-9]+$'
INT1PLUS_PATTERN='^[1-9][0-9]*$'
FLOAT_PATTERN='[0-9]*\.?[0-9]+'
# Hostname & IPv4 Address
MQTT_SERVER_PATTERN='^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\b|\b([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$'

Expand All @@ -17,7 +18,7 @@ function validateEnvVars() {
exitOnError=1
fi

if ! echo $BLE_CMD_RETRY_DELAY | grep -Eq "$INT1PLUS_PATTERN"; then
if ! echo $BLE_CMD_RETRY_DELAY | grep -Eq "$FLOAT_PATTERN"; then
log_fatal "Fatal; BLE_CMD_RETRY_DELAY:$BLE_CMD_RETRY_DELAY is not compliant, please check this setting"
exitOnError=1
fi
Expand Down

0 comments on commit 3752498

Please sign in to comment.