denverquane / MMM-Teslamate

Magic Mirror Module for the Teslamate utility
MIT License
52 stars 14 forks source link

Connection REFUSED to MQTT loop #32

Closed elevins closed 2 years ago

elevins commented 2 years ago

Teslamate installed and displaying the following on the mirror with no information.

msedge_7lheb7MrVO

Information correctly logging in grafana. This error loops in the magicmirror log with no additional details.

0|mm | [16.05.2022 09:43.36.621] [LOG]
0|mm | MMM-Teslamate: 192.168.4.60:1883 reconnecting 0|mm | [16.05.2022 09:43.36.645] [LOG]
0|mm | MMM-Teslamate 192.168.4.60:1883: Error: Error: connect ECONNREFUSED 192.168.4.60:1883

This is my config, two cars on my account. No info shows with carID: '1' either.

    {
        module: 'MMM-Teslamate',
        position: 'bottom_right',
        config: {
            mqttServer: {
                address: '192.168.4.60',  // Server address or IP address of the MQTT broker
                port: 1883,              // Port number if other than default (1883)
                //user: '',          // Leave out for no user
                //password: '',  // Leave out for no password
            },
            rangeDisplay: "%", // "%" or "range"
            imperial: true, //use imperial units (true = Miles & F) or metric (false = Km & C)
            carID: '2', // 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: "m3", // 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,W39B,DV2W",
                // 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: "hvac_on", // "always", "never"
        }   
    },
denverquane commented 2 years ago

CONNREFUSED would indicate a general routing/connection issue to the MQTT broker. Do you have a firewall on the machine running teslamate, and is the MQTT container exposed outside of the docker-compose network? (assuming you use docker-compose for deployment)

elevins commented 2 years ago

Yes used docker compose for deployment. Containers running on my Synology NAS on same local network as Pi running Magic Mirror. Will take a look at firewall

denverquane commented 2 years ago

Also just pushed a fix from another issue, that could resolve it, but your connection URL string looked correct to me

elevins commented 2 years ago

Firewall disabled. No change. Don't think that is the issue. Using a MQTT desktop application I also get a connection refused error tho. Could my docker compose file have been incorrect. Pasting it below.

version: "3"

services: teslamate: image: teslamate/teslamate:latest restart: always environment:

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

elevins commented 2 years ago

Ok so I noticed that the docker container did not have ports listed in the synology ui. I removed the '#' leading the following lines to uncomment:

ports:

and the ports were now visible in Synology/docker container properties. Both MQTT.fx and Magic Mirror can now connect. However still no information on the mirror. Looking into that.

Strange that connection string showed correct port may be better to leave in uncommented in the docs.

elevins commented 2 years ago

Looks like it is pulling and is now a display issue i need to figure out. Will close this