Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not sending updates to ABRP #25

Closed
jAr4s opened this issue Feb 7, 2023 · 12 comments
Closed

Not sending updates to ABRP #25

jAr4s opened this issue Feb 7, 2023 · 12 comments
Assignees
Labels
good first issue Good for newcomers question Further information is requested

Comments

@jAr4s
Copy link

jAr4s commented Feb 7, 2023

Hi, I have a problem. Don't know what am I doing wrong. Here is my (censored) composer file:

version: "3"

services:
  teslamate:
    image: teslamate/teslamate:latest
    restart: always
    environment:
      - ENCRYPTION_KEY=xxx
      - DATABASE_USER=xxx
      - DATABASE_PASS=xxx
      - DATABASE_NAME=xxx
      - DATABASE_HOST=xxx
      - MQTT_HOST=${MQTT_HOST}
      - MQTT_PORT=${MQTT_PORT}
      - MQTT_USERNAME=${MQTT_USERNAME}
      - MQTT_PASSWORD=${MQTT_PASSWORD}
    ports:
      - XXXX:XXXX
    volumes:
      - ./import:/opt/app/import
    cap_drop:
      - all

  database:
    image: postgres:14
    restart: always
    environment:
      - POSTGRES_USER=xxx
      - POSTGRES_PASSWORD=xxx
      - POSTGRES_DB=xxx
    volumes:
      - teslamate-db:/var/lib/postgresql/data

  grafana:
    image: teslamate/grafana:latest
    restart: always
    environment:
      - DATABASE_USER=xxx
      - DATABASE_PASS=xxx
      - DATABASE_NAME=xxx
      - DATABASE_HOST=xxx
    ports:
      - XXXX:XXXX
    volumes:
      - teslamate-grafana-data:/var/lib/grafana

  mosquitto:
    image: eclipse-mosquitto:2
    restart: always
    command: mosquitto -c /mosquitto-no-auth.conf
    #ports:
    #  - XXXX:XXXX
    volumes:
      - mosquitto-conf:/mosquitto/config
      - mosquitto-data:/mosquitto/data

  ABRP:
    container_name: TeslaMate_ABRP
    image: fetzu/teslamate-abrp:latest
    restart: always
    # privileged: true
    # NOTE: un-comment the previous line to run the container in privilege mode (necessary on RaspberryPi)
    environment:
      - MQTT_SERVER=mosquitto
     # - MQTT_HOST=${MQTT_HOST}
     # - MQTT_PORT=${MQTT_PORT}
      - MQTT_USERNAME=${MQTT_USERNAME}
      - MQTT_PASSWORD=${MQTT_PASSWORD}
      - USER_TOKEN=afff38c7-d220-40c3-88e0-60146f9e1d24
      - CAR_NUMBER=1
      - CAR_MODEL=tesla:m3:22:60lfp:heatpump #NOTE: This is optional, see below
     
volumes:
  teslamate-db:
  teslamate-grafana-data:
  mosquitto-conf:
  mosquitto-data:

Everything builds without any issues, telamate is working fine. I can see when I am subscribing MQTT topic that the data is being published by MQTT correctly.
In the Teslamate-ABRP logs I have this:

$ sudo docker-compose logs ABRP
Attaching to TeslaMate_ABRP
TeslaMate_ABRP | {'--model': None,
TeslaMate_ABRP | '-a': False,
TeslaMate_ABRP | '-h': False,
TeslaMate_ABRP | '-l': False,
TeslaMate_ABRP | '-p': False,
TeslaMate_ABRP | 'CAR_NUMBER': None,
TeslaMate_ABRP | 'MQTT_PASSWORD': None,
TeslaMate_ABRP | 'MQTT_SERVER': None,
TeslaMate_ABRP | 'MQTT_USERNAME': None,
TeslaMate_ABRP | 'USER_TOKEN': None}
TeslaMate_ABRP | Connected with result code 0. Connection with MQTT server established.
TeslaMate_ABRP | Car model manually set to: tesla:m3:22:60lfp:heatpump
TeslaMate_ABRP | 2023-02-07 11:03:31: Car is (unknown state), not sending any update to ABRP.
TeslaMate_ABRP | 2023-02-07 11:03:32: Car is (unknown state), not sending any update to ABRP.
TeslaMate_ABRP | 2023-02-07 11:03:33: Car is (unknown state), not sending any update to ABRP.
TeslaMate_ABRP | 2023-02-07 11:03:34: Car is (unknown state), not sending any update to ABRP.
TeslaMate_ABRP | 2023-02-07 11:03:35: Car is (unknown state), not sending any update to ABRP.
TeslaMate_ABRP | 2023-02-07 11:03:36: Car is (unknown state), not sending any update to ABRP.
TeslaMate_ABRP | 2023-02-07 11:03:37: Car is (unknown state), not sending any update to ABRP.
TeslaMate_ABRP | 2023-02-07 11:03:38: Car is (unknown state), not sending any update to ABRP.
TeslaMate_ABRP | 2023-02-07 11:03:39: Car is (unknown state), not sending any update to ABRP.

Do you see any wrong inputs in my docker-compose file above?

@fetzu
Copy link
Owner

fetzu commented Feb 10, 2023

Hey @jAr4s, thanks for opening the issue here.

At first glance, I do not see any issue with your compose file. It also looks like that the ABRP container is able to connect to your MQTT instance properly.

Could you please try to connect to MQTT using a client (MQTT explorer for example and check what state of the car is being broadcast?

PS: You might want to generate a new API key for ABRP, because you inadvertently published it in your issue message.

@fetzu fetzu added good first issue Good for newcomers question Further information is requested labels Feb 10, 2023
@fetzu fetzu self-assigned this Feb 10, 2023
@BlackDolphinX
Copy link

I had the same issue.
It seemed that TeslaMate was not sending MQTT messages.

After I restarted TeslaMate everything started working.

@jAr4s
Copy link
Author

jAr4s commented Feb 11, 2023

38A9B9C4-C68D-44BF-A578-E1AB220AEE94
@fetzu thanks. Teslamate is broadcasting MQTT correctly as I receive it in Home Assistant and monitor the status of my car. I have checked teslamate topic in MQTTool too - it’s looks okay.
I published ABRP API key on purpose so you can see that the format of it is okay. Already genereted new one.
@BlackDolphinX thank but that doesn’t seem to be a problem in my case as I mentioned above.

@fetzu
Copy link
Owner

fetzu commented Feb 11, 2023

So from the looks of it, it looks like everything is configured properly, that MQTT is broadcasting properly, and that teslamate-abrp is able to read the MQTT topic. Could you please check what is being published at teslamate/cars/1/state ?

@jAr4s
Copy link
Author

jAr4s commented Feb 11, 2023

@fetzu Asleep, or after waking up the car (by checking it in the Tesla app) - online.

DBE8E85F-7EC8-456E-8E30-80F86282B6B2

@fetzu
Copy link
Owner

fetzu commented Feb 11, 2023

That's strange.

The issue might be that teslamate-abrp is not getting the right data from MQTT.

  1. I see you are using a custom config file for the MQTT container (/mosquitto-no-auth.conf), and also (possibly) specifying a user/password for the teslamate-abrp container. Maybe this could be an issue (teslamate-abrp being able to connect to the MQTT server but not getting any actual data back)? Is there any chance you could check that (maybe post a censored version of the MQTT conf)?
  2. I see you are using the eclipse-mosquitto:2 docker image (I am using 1.6). Might be something to consider if 1. doesn't pan out.

@jAr4s
Copy link
Author

jAr4s commented Feb 19, 2023

  1. I'd love to share my mosquitto-no-aut.conf but I have no idea where/how to find this file. Could you give me some hint please? When I enter command "find . -name mosquitto-no-auth.conf" it only returns with these two locations:

./var/lib/docker/overlay2/371bd9a13c40531a2aba7920ebc57a9d21602c1f89bdfb60d3a2b842560b9716/diff/mosquitto-no-auth.conf
./var/lib/docker/overlay2/22bb6fe9d5467cfad50ff305e007b30502cecdd330238d3c5a9a198d9d65a38d/merged/mosquitto-no-auth.conf

which I cannot access. Sorry I am a newbie in the docker and I used default docker-compose.yml file from the manual https://docs.teslamate.org/docs/installation/docker

@fetzu
Copy link
Owner

fetzu commented Mar 3, 2023

Sorry to only be replying so late.

  1. If you have access to your container via shell, can you just "cat ./var/lib/docker/overlay2/22bb6fe9d5467cfad50ff305e007b30502cecdd330238d3c5a9a198d9d65a38d/merged/mosquitto-no-auth.conf" (or whatever the current path to it is)
  2. Maybe eve simpler: try replacing the mosquitto service in your docker compose with the following:
mosquitto:
  image: eclipse-mosquitto:1.6
  restart: always
  volumes:
    - mosquitto-conf:/mosquitto/config
    - mosquitto-data:/mosquitto/data

This will use an older docker image for mosquitto (but I know that this one works)

@cusooner
Copy link

I can confirm changing the docker compose file settings as suggested above fixes the problem.

mosquitto:
image: eclipse-mosquitto:1.6
hostname: mosquitto
restart: always
volumes:
- mosquitto-conf:/mosquitto/config
- mosquitto-data:/mosquitto/data

@fetzu
Copy link
Owner

fetzu commented Mar 27, 2023

@jAr4s can you confirm it worked for you as well so we can close this issue?

@rpearson-catdevnull
Copy link

I had this same issue on a new install and changing the mosquitto image to image: eclipse-mosquitto:1.6 fixed this for me.

@fetzu
Copy link
Owner

fetzu commented Jul 11, 2023

EDIT: Nevermind.

I might have found the reason why @jAr4s configuration wasn't working: it seems like the image eclipse-mosquitto:2 is bit more strict with authentification and is throwing up issues when trying to authentificate even though the server is not set up for it (and it seems like eclipse-mosquitto:1.6 largely ignored this).

If you are having the same issues, just remove the "MQTT_USERNAME" and "MQTT_PASSWORD" from all services (teslmate and teslamate_ABRP) and you should be fine. If authentification is setup on our MQTT (eclipse-mosquitto) service, it should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants