MMM-Teslamate icon indicating copy to clipboard operation
MMM-Teslamate copied to clipboard

Module Not Populating/Connecting Data

Open Dresch360 opened this issue 2 years ago • 8 comments

Thanks for a great module!

Everything appears to be working on the server side with TeslaMate and Grafana. I can see all of the Tesla data from each database.

Getting a strange error when running in MM - from the log files: Endless stream of this error - 04.06.2022 19:12.15.793] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.16.882] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.17.976] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.19.106] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.20.232] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.21.311] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.22.322] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.23.354] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.24.475] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.25.601] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.26.633] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.27.727] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.28.853] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.29.978] [LOG] MMM-Teslamate: localhost:1883 reconnecting [04.06.2022 19:12.31.006] [LOG] MMM-Teslamate: localhost:1883 reconnecting

Here is the MMM-Teslamate config: { disabled: false, classes: "hide", module: 'MMM-Teslamate', position: 'top_center', config: { mqttServer: { address: 'localhost', //Server address or IP address of the MQTT broker port: 1883, // Port number if other than default (1883) //user: 'user', // Leave out for no user //password: 'password', // Leave out for no password },

    rangeDisplay: "%", // "%" or "range"
    imperial: true, //use imperial units (true = Miles & F) or metric (false = Km & C)

    carID: '1', // defaults to '1'; only override if you have multiple Teslas and want to display 
                // a specific car per instance of the module

    // set to true to enable both the graphic, and the additional stats 
    // (charge remaining, scheduled charge start, etc)
    hybridView: true,
    // size of the visible area
    sizeOptions: {
        // size of the icons + battery (above text)
        width: 450, // px, default: 450
        height: 203, // px, default: 203
        // the battery images itself
        batWitdh: 250, // px, default: 250
        batHeight: 75, // px, default: 75
        // visual distance reduction to the module above
        topOffset: -40, // px, default: -40
    },
    carImageOptions: {
        model: "ms", // mx, ms (S pre-refresh), ? (S post-refresh)

        view: "STUD_3QTR", // STUD_SIDE works better for S/X

        // full list of option codes: https://tesla-api.timdorr.com/vehicle/optioncodes.
        // you need at least the color and the wheels. not all combos work.
        // also consult: https://teslaownersonline.com/threads/teslas-image-compositor.7089/
        options: "PPSW,PFP31,W38B,DV4W",

        // play with this until it looks about right.
        // tested values: 0 for m3/STUD_3QTR, 25 for ms/STUD_SIDE
        verticalOffset: 0,

        opacity: 0.5
    },

    // show inside and outside temperatures below the car image: when AC or preconditioning is running (default), always, or never
    showTemps: "always", // "always", "never"
}

},

Here is the docker-compose.yml file: version: "3"

services: teslamate: image: teslamate/teslamate:latest restart: always environment: - DATABASE_USER=teslamate - DATABASE_PASS=secret - DATABASE_NAME=teslamate - DATABASE_HOST=database - MQTT_HOST=mosquitto - DATABASE_POOL_SIZE=10 ports: - 4000:4000 volumes: - ./import:/opt/app/import cap_drop: - all

database: image: postgres:12 restart: always environment: - POSTGRES_USER=teslamate - POSTGRES_PASSWORD=secret - POSTGRES_DB=teslamate

volumes:
  - teslamate-db:/var/lib/postgresql/data

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

mosquitto: image: eclipse-mosquitto:1.6 restart: always ports: - 1883:1883 volumes: - mosquitto-conf:/mosquitto/config

volumes: teslamate-db: teslamate-grafana-data: mosquitto-conf: mosquitto-data:

Here is the docker ps: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES fe66c685070e eclipse-mosquitto:1.6 "/docker-entrypoint.…" 6 months ago Up 32 minutes 0.0.0.0:1883->1883/tcp, :::1883->1883/tcp pi_mosquitto_1 deea08c123d3 teslamate/grafana:latest "/run.sh" 6 months ago Up 32 minutes 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp pi_grafana_1 e8029f894669 postgres:12 "docker-entrypoint.s…" 6 months ago Up 32 minutes 5432/tcp pi_database_1 baf0cc5d96aa teslamate/teslamate:latest "tini -- /bin/sh /en…" 6 months ago Up 32 minutes 0.0.0.0:4000->4000/tcp, :::4000->4000/tcp pi_teslamate_1

Any help would be greatly appreciated!

Dresch360 avatar Jun 04 '22 23:06 Dresch360

Thanks for providing all the info straightaway :) I cannot see anything obviously wrong tbh, only two things are potentially suspicious:

  • classes: "hide" in the module config - this could be causing issues I guess, if the frontend never renders? Not sure how this would behave tbh
  • using localhost as MQTT server host: are you running both Teslamate and MagicMirror on the same Raspberry Pi / machine?

Concerning the endless logs: could you try restarting MagicMirror and checking what's written in the log just before the endless "reconnecting" stream begins? There may be some other errors in there that causes the reconnects.

olexs avatar Jun 05 '22 08:06 olexs

Thanks for you quick response! No luck still, I'm afraid. Yes, I'm running both Telsamate and MagicMirror on the same Pi. There is no error message prior to the "reconnecting" messages.

Here is the log file info from MM just before the "reconnecting" messages: [06.06.2022 03:34.44.041] [LOG] MMM-Teslamate: Socket notification received: MQTT_CONFIG : { mqttServer: { address: 'localhost', port: 1883 }, rangeDisplay: '%', imperial: true, carID: '1', sizeOptions: { width: 450, height: 203, batWitdh: 250, batHeight: 75, topOffset: -40 }, showTemps: 'always', hybridView: true, carImageOptions: { model: 'ms', view: 'STUD_3QTR', options: 'PPSW,PFP31,W38B,DV4W', verticalOffset: 0, opacity: 0.5 } } [06.06.2022 03:34.44.044] [LOG] Adding config [06.06.2022 03:34.44.046] [LOG] MMM-Teslamate: Adding server: { address: 'localhost', port: 1883 } [06.06.2022 03:34.44.049] [LOG] teslamate/cars/1/display_name [06.06.2022 03:34.44.051] [LOG] teslamate/cars/1/state [06.06.2022 03:34.44.053] [LOG] teslamate/cars/1/healthy [06.06.2022 03:34.44.054] [LOG] teslamate/cars/1/latitude [06.06.2022 03:34.44.055] [LOG] teslamate/cars/1/longitude [06.06.2022 03:34.44.056] [LOG] teslamate/cars/1/shift_state [06.06.2022 03:34.44.057] [LOG] teslamate/cars/1/speed [06.06.2022 03:34.44.058] [LOG] teslamate/cars/1/locked [06.06.2022 03:34.44.059] [LOG] teslamate/cars/1/sentry_mode [06.06.2022 03:34.44.060] [LOG] teslamate/cars/1/windows_open [06.06.2022 03:34.44.060] [LOG] teslamate/cars/1/outside_temp [06.06.2022 03:34.44.061] [LOG] teslamate/cars/1/inside_temp [06.06.2022 03:34.44.062] [LOG] teslamate/cars/1/is_climate_on [06.06.2022 03:34.44.063] [LOG] teslamate/cars/1/odometer [06.06.2022 03:34.44.064] [LOG] teslamate/cars/1/ideal_battery_range_km [06.06.2022 03:34.44.064] [LOG] teslamate/cars/1/est_battery_range_km [06.06.2022 03:34.44.065] [LOG] teslamate/cars/1/rated_battery_range_km [06.06.2022 03:34.44.066] [LOG] teslamate/cars/1/battery_level [06.06.2022 03:34.44.067] [LOG] teslamate/cars/1/usable_battery_level [06.06.2022 03:34.44.068] [LOG] teslamate/cars/1/plugged_in [06.06.2022 03:34.44.069] [LOG] teslamate/cars/1/charge_energy_added [06.06.2022 03:34.44.069] [LOG] teslamate/cars/1/charge_limit_soc [06.06.2022 03:34.44.070] [LOG] teslamate/cars/1/scheduled_charging_start_time [06.06.2022 03:34.44.071] [LOG] teslamate/cars/1/time_to_full_charge [06.06.2022 03:34.44.071] [LOG] teslamate/cars/1/update_available [06.06.2022 03:34.44.075] [LOG] MMM-Teslamate: Starting client for: { serverKey: 'localhost:1883', address: 'localhost', port: 1883, options: {}, topics: [ 'teslamate/cars/1/display_name', 'teslamate/cars/1/state', 'teslamate/cars/1/healthy', 'teslamate/cars/1/latitude', 'teslamate/cars/1/longitude', 'teslamate/cars/1/shift_state', 'teslamate/cars/1/speed', 'teslamate/cars/1/locked', 'teslamate/cars/1/sentry_mode', 'teslamate/cars/1/windows_open', 'teslamate/cars/1/outside_temp', 'teslamate/cars/1/inside_temp', 'teslamate/cars/1/is_climate_on', 'teslamate/cars/1/odometer', 'teslamate/cars/1/ideal_battery_range_km', 'teslamate/cars/1/est_battery_range_km', 'teslamate/cars/1/rated_battery_range_km', 'teslamate/cars/1/battery_level', 'teslamate/cars/1/usable_battery_level', 'teslamate/cars/1/plugged_in', 'teslamate/cars/1/charge_energy_added', 'teslamate/cars/1/charge_limit_soc', 'teslamate/cars/1/scheduled_charging_start_time', 'teslamate/cars/1/time_to_full_charge', 'teslamate/cars/1/update_available' ] } [06.06.2022 03:34.44.078] [LOG] MMM-Teslamate: Connecting to mqtt://localhost:1883

Thanks again for your help!

Dresch360 avatar Jun 06 '22 07:06 Dresch360

Very weird. I've added extra logging to the reconnect handler, can you git pull the changes and try to start it up again, then post any extra info that gets output in the log?

There are a couple reasons why the MQTT server could be kicking out clients into a reconnect. Do you run any other clients on the same MQTT server, any other Teslamate integrations or something like that?

olexs avatar Jun 06 '22 11:06 olexs

Thanks again for your reply. Same message now, but it also indicates "error was: undefined"

[06.06.2022 20:20.31.751] [LOG] MMM-Teslamate: localhost:1883 reconnecting, error was: undefined [06.06.2022 20:20.32.834] [LOG] MMM-Teslamate: localhost:1883 reconnecting, error was: undefined [06.06.2022 20:20.33.953] [LOG] MMM-Teslamate: localhost:1883 reconnecting, error was: undefined

Dresch360 avatar Jun 07 '22 00:06 Dresch360

Damn, so no message from the server telling why the reconnect happens. Shame.

Most likely issue is the client ID clashing with another client connecting to the same MQTT server. Which is possible if you have some other client based on the Javascript mqtt library connecting to the same server. Do you have any other clients using the Teslamate MQTT - some other integrations, or anything at all apart from Teslamate itself?

olexs avatar Jun 07 '22 20:06 olexs

Thanks again for your help and quick response.

Nope - no other instances or clients being used for Teslamate or MQTT server. It's strange because I tested Docker and the databases separately and they all are showing normal operation, including MMM-Teslamate.

Dresch360 avatar Jun 08 '22 02:06 Dresch360

Did you managed to solve your issue? I seem to be having the same problem as you.

[19.01.2023 17:30.10.432] [LOG] MMM-Teslamate: 172.0.0.1:1883 reconnecting, error was: undefined [19.01.2023 17:30.32.194] [LOG] MMM-Teslamate: 172.0.0.1:1883 reconnecting, error was: undefined [19.01.2023 17:30.37.020] [LOG] MMM-Teslamate: 172.0.0.1:1883 reconnecting, error was: undefined

remusache avatar Jan 19 '23 16:01 remusache

I would recommend instead of localhost to use the host IP address. sometimes this is the fix. IP addresses is absolute location pointer - while localhost sometimes is relative to the context that you call it from and thus may mean something different than expected.

iskrenpp avatar Apr 02 '23 02:04 iskrenpp