Skip to content

Commit ae9e8d3

Browse files
raphmurbaylanger
andauthored
v0.2.0 release; merge stage to main (#99)
* Add missing counter (#96) * [feat] Auto MAC addr detection (#90) * Update Docs and anticipate ble cfg removal (#98) * Prepare 0.2.0 (#100) * Update CHANGELOG.md * v0.2.0 release; bump to main v0.2.0 * [chg] Dockerfile replace ash.* to bashio * v0.2.0 release; bump to main v0.2.0 - fix body-ctrl-state --------- Co-authored-by: Pierre Belanger <[email protected]>
1 parent 387077f commit ae9e8d3

File tree

9 files changed

+107
-41
lines changed

9 files changed

+107
-41
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ This repository contains the following add-ons
1717
![Supports aarch64 Architecture][aarch64-shield]
1818
![Supports amd64 Architecture][amd64-shield]
1919

20+
![Reported Installations][installations-shield-stable]
21+
2022

2123
<!--
2224
Notes to developers after forking or using the github template feature:

tesla_ble_mqtt/CHANGELOG.md

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,70 @@
11
# Changelog
22

3+
## 0.2.0
4+
5+
### <p>**WARNING WARNING WARNING**<br>
6+
Upgrading from 0.0.10 or previous? DO NOT UPGRADE PRIOR TO READ THE 0.1.0 UPGRADE INSTRUCTIONS.</p>
7+
8+
### <p>**BREAKING CHANGE**<br>
9+
On/off and Open/Close entities have been grouped under switches and covers.</p>
10+
/!\ It will affect your current Home Assistant MQTT entities (if you use them)
11+
12+
| Old Entity Name | New Entity Name |
13+
|:------------------|:-------------------------|
14+
| windows-close | windows (open/close) |
15+
| windows-vent | " |
16+
| charging-start | charger (start/stop) |
17+
| charging-stop | " |
18+
| charge-port-open | charge-port (open/close) |
19+
| charge-port-close | " |
20+
| climate-on | climate (on/off) |
21+
| climate-off | " |
22+
| trunk-open | trunk (open/close) |
23+
| trunk-close | " |
24+
25+
26+
### Changed
27+
28+
- NEW Feature: Car's BLE MAC address is now auto-detected
29+
- NEW Feature: Info Bluetooth Adapter, view in add-on's Log tab
30+
- NEW Feature: Added more car specific commands; see below for the list
31+
- NEW Feature: Migrated buttons to covers and switches
32+
- NEW: Icons were added in the UI!
33+
- CHG: Increased tesla-control command-timeout from 5s to 20s
34+
- CHG: Removed Setting ble\_mac\_list; obsoleted by BLE MAC address auto-detection
35+
- CHG: Removed scan-bleln-macaddr, obsoleted by BLE MAC address auto-detection
36+
37+
- Added commands
38+
39+
| Commands | Note |
40+
|:------------------|:---------------|
41+
| autosecure-modelx | Model X |
42+
| auto-seat-and-climate | |
43+
| body-controller-state | |
44+
| drive | |
45+
| flash-lights | |
46+
| frunk-open | |
47+
| honk | |
48+
| lock | |
49+
| media-toggle-playback | |
50+
| tonneau-close | Cybertruck |
51+
| tonneau-open | Cybertruck |
52+
| tonneau-stop | Cybertruck |
53+
| trunk-close | |
54+
| trunk-move | |
55+
| trunk-open | |
56+
| unlock | |
57+
58+
## 0.1.2
59+
60+
### Changed
61+
62+
- CHG: Fix allow empty setting BLE MAC addr (Docker standalone)
63+
364
## 0.1.1
465

566
### Changed
667

7-
<p>WARNING WARNING WARNING<br>
8-
DO NOT UPGRADE PRIOR TO READ THE 0.1.0 UPGRADE INSTRUCTIONS<br>
9-
WARNING WARNING WARNING</p>
10-
1168
- CHG: Fix upgrade forcing to redeploy the key to the car
1269

1370
## 0.1.0

tesla_ble_mqtt/DOCS.md

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,56 @@ The advantage of the MQTT setup is that it can run on a device separate to your
77

88
# Installation and setup
99

10-
If you have already created a key pair that you want to reuse, place the private key in `/share/tesla_ble_mqtt`
10+
If you have already created a key pair that you want to reuse, place the private key in `/share/tesla_ble_mqtt`.
11+
The key must have the following naming scheme: `/share/tesla_ble_mqtt/VIN_private.pem` and `/share/tesla_ble_mqtt/VIN_public.pem` where `VIN` is your car VIN.
12+
/!\ To access this repository you will need access to the host filesystem and not only access to the config folder.
1113

12-
## 1.1 HA Add-on: install below and configure
14+
## Install the addon and configure
1315

1416
[![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https://github.com/tesla-local-control/tesla-local-control-addon)
1517

18+
#### Install the addon directly from Home Assistant. Add the custom repository: `https://github.com/tesla-local-control/tesla-local-control-addon`
1619

17-
You will need to provide:
18-
- vin_list : VIN single or multiple separated by either of | , or space; Required
19-
- ble_mac_list : BLE MAC Addr list single or multiple separated by a | (pipe); Optional for car presence detection
20-
- presence_detection_loop_delay: The delay between each time the process checks for the presence of your car(s)
21-
- presence_detection_ttl : TTL in seconds when car is considered gone after last received BLE advertisement; 0 to disable detection
22-
- mqtt_server : Hostname or IP of your MQTT server; Default 127.0.0.1
23-
- mqtt_port : MQTT service port; Default 1883
24-
- mqtt_useranme : MQTT Username; Default anonymous
25-
- mqtt_password : MQTT Password
26-
- ble_cmd_retry_delay : Delay to retry sending a command to the car over BLE; Default 5
27-
- Start the add-on, check the logs for anything suspecious.
20+
#### Fill in the required settings:
21+
- vin_list: single VIN or list of VINs separated by either of | , or space; Required
22+
- mqtt_server: Hostname or IP of your MQTT server; Default 127.0.0.1
23+
- mqtt_port: MQTT service port; Default 1883
24+
- mqtt_useranme: MQTT Username; Default anonymous
25+
- mqtt_password: MQTT Password
26+
- debug: Activate if you are having issues, you will most likely not need it; Default off
2827

29-
ATTENTION: If you have multiple cars and require presence detection, the cars' position in vin_list vin{n} must match the position in the ble_mac_list. In other words, the BLE MAC Addr in the 2nd position must match the same car's VIN in the 2nd position of the tesla_vin_list.
28+
The module will periodically scan for your car presence by default. You can use the optional settings to adjust the behaviour:
29+
- presence_detection_ttl: TTL in seconds when car is considered gone after last received BLE advertisement; **0 to disable presece detection**
30+
- presence_detection_loop_delay: delay between each presence check with BLE scanning
31+
Other optional settings:
32+
- ble_cmd_retry_delay: Delay to retry sending a command to the car over BLE; Default 5. Don't go too far below this value.
3033

31-
## 1.2 For the standalone Docker version please see https://github.com/tesla-local-control/tesla_ble_mqtt_docker
34+
#### Start the add-on, check the logs for anything suspecious.
35+
Check the apparition of new devices called Tesla_BLE_VIN (one per VIN) that should have appeared. Click it to view the the associated entities in path: Settings -> Devices & Services -> Devices (tab) -> Tesla_BLE_MQTT
3236

33-
## 2.0 Check in HA for new devices named Tesla_BLE_MQTT_VIN ???
37+
## Pair key with your car (if not already done)
3438

35-
- A new device called Tesla_BLE_MQTT should have automatically appeared. Click it to view the the associated entities.
36-
- If this is the first time you have run the container, press the 'Generate Keys' button in HA (Settings -> Devices & Services -> Devices (tab) -> Tesla_BLE_MQTT). This will generate the public and private keys as per Shanker's blog
37-
- **Wake up your car using the Tesla App**. Then press the 'Deploy Key' button. This will deploy the public key to the car. You will then need to access your car and use a Key Card to accept the public key into the car (see the blog for screenshots)
38-
- If the command succeed to initiate the pairing with the car, the following will show in the add-on logs: `Sent add-key request to [YOUR_CAR_VIN]. Confirm by tapping NFC card on center console.` Go in your car and tap your NFC card on the center console and on the car's screen `Phone Key pairing request`, confirm your accept the pairing
39-
- If the command failed, the following error will show up: `Error: failed to find BLE beacon for [YOUR_CAR_VIN]. (xxx): can’t scan: context deadline exceeded`. You car might just be too far from your Bluetooth adapter. The command will be tried in case bluetooth is weak or unavailable...
40-
- Then you are ready. Press the other button entities to send various commands... You can use the relevant service calls in HA automations if you wish
39+
If this is the first time you run the addon, you will need to pair with your car. For this:
40+
1. Ensure your car is not too far from your HA system (within BLE reach)
41+
2. Press the 'Generate Keys' button in HA. This will generate the public and private keys
42+
3. Go inside your car and authenticate by placing your key card on the center console
43+
4. In HA press the button 'Deploy Key' (you can use the companion app). This will deploy the public key to the car.
44+
If the command succeeds, the following will show in the add-on logs: `KEY DELIVERED; IN YOUR CAR, CHECK THE CAR's CENTRAL SCREEN AND ACCEPT THE KEY USING YOUR NFC CARD`
45+
5. You will then see a message on screen to accept the new key. Press accept.
46+
If the command succeeds, the following will show in the add-on logs: `acceptKeyConfirmationLoop; congratulation, the public key has been accepted vin:$vin`
4147

48+
If any of points 4 or 5 fails, you will see these messages in the logs: `Could not send the key; Is the car awake and sufficiently close to the bluetooth adapter?` or other relevant messages. Your car might just be too far from your Bluetooth adapter. The command will be tried in case bluetooth is weak or unavailable...
49+
50+
## Explore
51+
52+
Then you are ready. Press the other button entities to send various commands... You can use the relevant service calls in HA automations if you wish.
53+
Be careful, as for now the car is not sending back state to the HA entities.
54+
55+
This addon does not behave like the "Tesla Custom Integration". For example, when you are sending a command to your car with your phone, this entity Tesla_BLE_VIN will not update. It is currently not possible.
4256

4357

4458
## Troubleshooting
4559

46-
[Core Issues](https://github.com/tesla-local-control/tesla_ble_mqtt_core/issues)
47-
[Home Assistant Addon Issues](https://github.com/tesla-local-control/tesla-local-control-addon/issues)
48-
[Stanalone Docker Issues](https://github.com/tesla-local-control/tesla_ble_mqtt_docker/issues)
60+
Please use [tesla-local-control-addon Issues](https://github.com/tesla-local-control/tesla-local-control-addon/issues)
61+
62+
If you have already identified a bug in the code, please see [tesla_ble_mqtt_core Issues](https://github.com/tesla-local-control/tesla_ble_mqtt_core/issues)

tesla_ble_mqtt/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ RUN apk add --no-cache \
2626
COPY app /app/
2727
COPY libproduct.sh /app/
2828
RUN chmod a+x /app/run.sh
29-
RUN sed -i 's|#!/bin/ash|#!/command/with-contenv bashio|' /app/run.sh
29+
RUN sed -i 's|#!/bin/ash.*|#!/command/with-contenv bashio|' /app/run.sh
3030

3131
CMD [ "/app/run.sh" ]

tesla_ble_mqtt/config.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: "Tesla Local Commands"
2-
version: "0.1.1"
2+
version: "0.2.0"
33
slug: "tesla_local_commands"
44
description: "Local BLE calls to control your Tesla."
55
url: "https://github.com/tesla-local-control/tesla-local-control-addon"
@@ -18,15 +18,13 @@ map:
1818
startup: services
1919
options:
2020
vin_list: ""
21-
ble_mac_list: ""
2221
mqtt_server: ""
2322
mqtt_port: "1883"
2423
mqtt_username: ""
2524
mqtt_password: ""
2625

2726
schema:
2827
vin_list: 'match(^([A-HJ-NPR-Z0-9]{17})(\|[A-HJ-NPR-Z0-9]{17})*$)'
29-
ble_mac_list: 'match(^([0-9A-Fa-f]{2}(:[0-9A-Fa-f]{2}){5})(\|[0-9A-Fa-f]{2}(:[0-9A-Fa-f]{2}){5})*$)?'
3028
mqtt_server: str
3129
mqtt_port: str?
3230
mqtt_username: str?

tesla_ble_mqtt/libproduct.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
function initConfigVariables() {
55

66
### Required Configuration Settings
7-
export BLE_MAC_LIST="$(bashio::config 'ble_mac_list')"
87
export MQTT_SERVER="$(bashio::config 'mqtt_server')"
98
export MQTT_PORT="$(bashio::config 'mqtt_port')"
109
export MQTT_USERNAME="$(bashio::config 'mqtt_username')"
@@ -41,6 +40,8 @@ function initConfigVariables() {
4140

4241
# Prevent bashio to complain for "unbound variable"
4342
export BLE_LN_LIST=""
43+
export BLE_MAC_LIST=""
44+
export BLTCTL_COMMAND_DEVICES=""
4445
export BLECTL_FILE_INPUT=""
4546
export COLOR=true
4647
export ENABLE_HA_FEATURES=""

tesla_ble_mqtt/translations/en.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ configuration:
22
vin_list:
33
name: Single or multiple VINs separated by either of ,;| VIN found in Tesla app
44
description: Single 5YJ3E1EB6JF111222 Multiple 5YJ3E1EB6JF111222|5YJ3E1EB6JF333444|...
5-
ble_mac_list:
6-
name: Single or multiple BLE MACs (aa:bb:cc:dd:ee:ff) separated by a | (pipe); Optional for proximity detection
7-
description: Use Android "BLE scanner" or iOS "nRF Connect"; First locate your car's BLE Local Name, it starts with letter S and ends with C. In the app for the car, find the MAC address. If you have multiple Twsla cars, use the signal strength to figure out which one to pick.
85
presence_detection_ttl:
96
name: Presence detection TTL
107
description: TTL in second when the car is considered gone after the last BLE ping; Default 240; 0 to disable detection

tesla_ble_mqtt/translations/fr.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ configuration:
55
ble_presence_detection_ttl:
66
name: TTL ou le véhicule est considéré encore présent suite au dernier message reçu
77
description: TTL en seconde pour considérer un véhicule non présent; Défault 240, mettre 0 pour désactivé la détection
8-
ble_mac_list:
9-
name: Une ou plusieurs BLE MACs (aa:bb:cc:dd:ee:ff) séparées par un , ou | ou espace blanc; Optionnel pour la détection de véhicule(s)
10-
description: Utilisez Android "BLE scanner" ou iOS "nRF Connect"; 1) localiser le BLE Local Name de votre véhicule. Le nom commence par la lettre S et termine par C. Trouvez pour cette entrée le MAC Address. Si vous avez plusieurs véhicules, utiliser la puissance du signal pour déterminer lequel d'entre-eux chosir.
118
mqtt_server:
129
name: MQTT Serveur
1310
description: Adresse IP or Hostname pour le serveur MQTT

0 commit comments

Comments
 (0)