wimaha / TeslaBleHttpProxy

TeslaBleHttpProxy is a program written in Go that receives HTTP requests and forwards them via Bluetooth to a Tesla vehicle. The program can, for example, be easily used together with evcc.
Apache License 2.0
31 stars 7 forks source link

Add arm docker image for raspberry pi zero #32

Open nriel opened 4 months ago

nriel commented 4 months ago

I can't use the docker image due to wrong architecture

dglaude commented 4 months ago

I think the image is arm64 and on 32 bit arm (armv6?) like PiZero, you would need armhf. Not sure it will run or it is still possible/easy to run docker on a PiZero. It would be more easy on a PiZero 2W that would be able to run the arm64 container.

Maybe the topic could be enhanced a little bit and also have also a docker image that works on x86-64 to run on an Intel NUC or that kind of small size computer.

nriel commented 4 months ago

I see the following error:

 tesla-ble-http-proxy The requested image's platform (linux/arm64) does not match the detected host platform (linux/arm/v6) and no specific platform
 was requested 0.0s 
Attaching to tesla-ble-http-proxy
tesla-ble-http-proxy  | exec /teslaBleHttpProxy: exec format error
tesla-ble-http-proxy exited with code 0

Docker in general works fine, but only with supported images.

In order to get going, I installed the proxy as a go-application and it is running fine. Only thing I can't get to work is to load it as a systemd service on boot. It always complains about the certificate not being found. I already tried to put it into /root/key/*cert, but that does not seem to be the path being searched for. When building, I added the cert to the /key folder and while running with ./TeslaBleHttpProxy it also does start correctly with the certifcates found in the root folder of TeslaBleHttpProxy

**Edit: moving the files from /root/key to /key worked like a charm :) Not the nicest way, but as the path is hard-coded into to go application, I don't see another solution with my limited knowledge.

little-penguin88 commented 4 months ago

I made a start script which changes to the TeslaBleHttpProxy dir and then in there let ./TeslaBleHttpProxy start. so it works with the /key folder in that dir. And then I added that script to a @reboot cron job

nriel commented 4 months ago

Could you please share the script? Thanks!

little-penguin88 commented 4 months ago

Sure. I called it StartTeslaProxy.sh and it has the following content to start the application and is putting the output into a logfile. And it assumes you have TeslaBleHttpProxy dir in your home folder directly. If that is not the case you just need to specify the whole path to your TeslaBleHttpProxy dir to make it work

cd TeslaBleHttpProxy
./TeslaBleHttpProxy > TeslaProxy.log 2>&1 &

You then need to make it executable with

chmod +x StartTeslaProxy.sh

And then add it to crontab with

crontab -e

and in that file just paste @reboot ./StartTeslaProxy.sh

lemocine commented 4 months ago

got the same problem. i cant work around myself since im to dumb to install go and compile myself. is there a possiblity to make the docker container for armv7? only solution for me i got rn is to make a clean new install with 64bit raspberry pi os and start over with my whole setup.

nvm i upgraded my raspberry4 to 64 bit. worth it, needed to be done anyway :)!

ugoetzen commented 4 months ago

Same here. I got an PiZero 2W and cant get it running due to the wrong platform.

wimaha commented 4 months ago

I will try adding this binarys in the docker image. I come back here, when it‘s completed.

wimaha commented 4 months ago

Can you try via wimaha/tesla-ble-http-proxy:dev if it's working?

ugoetzen commented 4 months ago

Just gave it a try on a PiZero 2W:

root@raspible:/home/udo/TeslaBleHttpProxy# docker pull wimaha/tesla-ble-http-proxy:dev
dev: Pulling from wimaha/tesla-ble-http-proxy
be490e8d6aa6: Pull complete 
6be72e41f1a7: Pull complete 
017206a48663: Pull complete 
Digest: sha256:e910b36091c21b4c45b4b972cc143cce58251f028f45c8958f11fedce1cae296
Status: Downloaded newer image for wimaha/tesla-ble-http-proxy:dev
docker.io/wimaha/tesla-ble-http-proxy:dev
root@raspible:/home/udo/TeslaBleHttpProxy# docker compose up
[+] Running 2/1
 ✔ Container tesla-ble-http-proxy                                                                                                                                    Created                                                   0.5s 
 ! tesla-ble-http-proxy The requested image's platform (linux/arm64) does not match the detected host platform (linux/arm/v7) and no specific platform was requested                                                           0.0s 
Attaching to tesla-ble-http-proxy
tesla-ble-http-proxy  | exec /teslaBleHttpProxy: exec format error
tesla-ble-http-proxy exited with code 0

seems the platform is still not the right one.

swa72 commented 3 months ago

I'm a noob myself when it comes to docker, but ...

services:
  tesla-ble-http-proxy:
    image: wimaha/tesla-ble-http-proxy:dev
    container_name: tesla-ble-http-proxy
    volumes:
      - ~/TeslaBleHttpProxy/key:/key
      - /var/run/dbus:/var/run/dbus
    restart: always
    privileged: true
    network_mode: host
    cap_add:
      - NET_ADMIN

that got me going :-) Note the different image name.

ugoetzen commented 3 months ago

Ok, I was just pulling the Dev image, but obviously not calling it within the docker-compose.yml file. The dev image is working for me as well on a PiZero 2W as swa72 described above.

nriel commented 3 months ago

On Raspberry pi zero W still crashing with error 132

wimaha commented 3 months ago

Should be working with Version 1.2.2 now. If there are any other errors, please open new issue.

nriel commented 3 months ago

With raspberry pi zero w still getting code error 132.

dpkg --print-architecture shows: armhf

lits101 commented 3 months ago

With raspberry pi zero w still getting code error 132.

dpkg --print-architecture shows: armhf

I'm also getting error 132 on a Raspberry Pi Zero W.

wimaha commented 2 months ago

There is a new version on dev tag. Can some one test this with Raspberry Pi Zero W?

image: wimaha/tesla-ble-http-proxy:dev

wimaha commented 2 months ago

I've release the version with 1.2.5

lits101 commented 2 months ago

I've just spun up a new instance of 1.2.5 in docker-compose on a Raspberry Pi 0 W and I can confirm I'm still getting the "Restarting (132)" error.

pi@teslaproxy2:~/teslableproxy $ docker ps
CONTAINER ID   IMAGE                         COMMAND                CREATED          STATUS                           PORTS     NAMES
e01a5844ad69   wimaha/tesla-ble-http-proxy   "/teslaBleHttpProxy"   59 seconds ago   Restarting (132) 9 seconds ago             tesla-ble-http-proxy
sovathnahim commented 3 weeks ago

How the program can communication to the car ?

Do you mean , we need to connect wifi to raspi which we have installed "TeslaBleHttpProxy"? I still do not understand, the instruction to do it ? after input the Tesla Vin , we need to scanned the new Key card or just the known current tesla Keycard, basically tesla need to confirm by paired key card every time we set up any key card , phone or remote. Actually , I am successfully installed it but not yet testing, So please kindly advice , thanks