spitzlbergerj / MMM-TeslaLogger

Module for MagicMirror showing data from the Teslalogger or teslamate subscribed to via MQTT
GNU Affero General Public License v3.0
5 stars 3 forks source link

New MM install. Not getting values with module #15

Closed natrlhy closed 4 years ago

natrlhy commented 4 years ago

I'm very new to MagicMirror and getting modules setup. I'm running TeslaMate as well.

I wanted to try this module, I've go the config.js file updated with the right mqttServerAddress and such but the values never display. I only see:

State offline  
Odometer NaN km
outside 0 °C
inside 0 °C
Battery Level 0 %
Actual current 0 A
sentry mode off

I used the format xx.xx.xx.x for my IP address and I know I've got the MQTT port right.

MMM-Teslamate is displaying fine so I know the MQTT information is working. I just like the additional stats/data this module presents 👍

spitzlbergerj commented 4 years ago

Hi, sorry for the late reply. Have you ever looked at the error messages in the Browser Console? Please tell me if there are any errors concerning the module. Also check the logfiles for the node-helper.js , which you can find in .pm2/logs. Please report to me what is being logged there as well. and post your config.js section thanks

gerbin01 commented 4 years ago

2020_10_30_21_38_46_MagicMirror_ Hi, I have the same problem. I have a teslalogger, connected to an openhab system. These are the entries of the MagicMirror-out.log:

[2020-10-30 21:17:33.158] [LOG]    [ 'MMM-TeslaLogger tesla/Teslalogger1604089053141 30.10 21:17' ]
[2020-10-30 21:17:33.160] [LOG]    [
  'MMM-TeslaLogger ' +
    'tesla/Teslalogger{"charging":false,"driving":false,"online":true,"sleeping":false,"falling_asleep":false,"speed":0,"power":0,"odometer":24926.700011265431,"ideal_battery_range_km":146.32183723063554,"battery_range_km":146.32183723063554,"outside_temp":17.5,"battery_level":42,"charger_voltage":0,"charger_phases":0,"charger_actual_current":0,"charge_energy_added":0,"charger_power":0,"charge_rate_km":0,"time_to_full_charge":0,"car_version":"2020.40.8 ' +
    '9744d0c0d399","trip_start":"14:09","trip_start_dt":"2020-10-30T13:09:40Z","trip_max_speed":80,"trip_max_power":84,"trip_duration_sec":1233,"trip_kwh":1.7925068799588018,"trip_avg_kwh":177.33512503147179,"trip_distance":10.108019376537413,"ts":"2020-10-30T20:17:28Z","latitude":50.000000,"longitude":10.000000,"charge_limit_soc":88,"inside_temperature":20,"battery_heater":false,"is_preconditioning":false,"sentry_mode":false,"country_code":"at","state":"xxxx","display_name":"xxxx"}'
]

My config.js:

        {
            module: 'MMM-TeslaLogger',
            position: 'lower_third',
            header: 'xxxx',
            config: {
                mqttServerAddress: "192.168.160.78",
                mqttServerPort: "1883",
                mqttServerUser: "xxxx",
                mqttServerPassword: "xxxx",
                mqttTopics: [
                    "Tesla",
                    "tesla/Teslalogger",
                ],
                logging: "true",
                localeStr: "de-DE",
                maxAgeSeconds: "36000",
                style: "lines",

                "displayState": "true",
                "displayOdometer": "true",
        //      "displayOutside_temp": "true",
        //      "displayBattery_level": "true",
        //      "displayCharger_actual_current": "true",
        //      "displayInside_temperature": "true",
        //      "displaySentry_mode": "true",
            }
        },

The Browser console output (I find no error in the output):

Array [ "MMM-TeslaLogger socketNotificationReceived MQTT_PAYLOAD Topic: tesla/Teslalogger JSON: {\"charging\":false,\"driving\":false,\"online\":true,\"sleeping\":false,\"falling_asleep\":false,\"speed\":0,\"power\":0,\"odometer\":24926.700011265431,\"ideal_battery_range_km\":146.32183723063554,\"battery_range_km\":146.32183723063554,\"outside_temp\":17.5,\"battery_level\":42,\"charger_voltage\":0,\"charger_phases\":0,\"charger_actual_current\":0,\"charge_energy_added\":0,\"charger_power\":0,\"charge_rate_km\":0,\"time_to_full_charge\":0,\"car_version\":\"2020.40.8 9744d0c0d399\",\"trip_start\":\"14:09\",\"trip_start_dt\":\"2020-10-30T13:09:40Z\",\"trip_max_speed\":80,\"trip_max_power\":84,\"trip_duration_sec\":1233,\"trip_kwh\":1.7925068799588018,\"trip_avg_kwh\":177.33512503147179,\"trip_distance\":10.108019376537413,\"ts\":\"2020-10-30T20:22:36Z\",\"latitude\":50.000000,\"longitude\":10.000000,\"charge_limit_soc\":88,\"inside_temperature\":20.7,\"battery_heater\":false,\"is_preconditioning\":false,\"sentry_mode\":false,\"country_code\":\"at\",\"state\":\"xxxx\",\"display_name\":\"xxxx\"}" ]

The mirror shows only empty values, the same as above shown by natrlhy.

Thank you & best regards

spitzlbergerj commented 4 years ago

Hello gerbin01, I will try to check it during the weekend.

At first the log entries show that the data was fetched from the MQTT server and also processed in node_helper.js. This is already very good.

Are there entries in the MagicMirror-err.log?

Greetings Sepp

spitzlbergerj commented 4 years ago

Hi and good morning, i've been trying around for a while now and can't reproduce the problem. At my place all values are shown, which come in via telegrams.

The only thing different is the topic of the MQTT server. My topic is "Tesla"

"MMM-TeslaLogger socketNotificationReceived MQTT_PAYLOAD Topic: Tesla JSON: {"charging":false,"driving":false,"online":false,"sleeping":true,"falling_asleep":false,"speed":0,"power":0,"odometer":8193.54627838486,"ideal_battery_range_km":359.769541497015,"battery_range_km":359.769541497015,"outside_temp":0,"battery_level":80,"charger_voltage":0,"charger_phases":0,"charger_actual_current":0,"charge_energy_added":0,"charger_power":0,"charge_rate_km":0,"time_to_full_charge":0,"car_version":"2020.40.4 ffa5212dba76","trip_start":"13:41","trip_start_dt":"2020-10-27T12:41:18Z","trip_max_speed":22,"trip_max_power":14,"trip_duration_sec":115,"trip_kwh":0.11017590163665296,"trip_avg_kwh":336.52191865597018,"trip_distance":0.32739591547760938,"ts":"2020-11-01T09:12:23Z","latitude":48.25007,"longitude":11.576149,"charge_limit_soc":0,"inside_temperature":0,"battery_heater":false,"is_preconditioning":false,"sentry_mode":false,"country_code":"de","state":"Bayern","display_name":"xxxxxx"}"

And my config looks like:

{
    module: 'MMM-TeslaLogger',
    position: 'lower_third',
    header: 'Tesla',
    config: {
        mqttServerAddress: '192.168.178.xxx',  // Server address or IP address
        mqttServerPort: '1883',          // Port number if other than default
        // mqttServerUser: '',          // Leave out for no user
        // mqttServerPassword: '',  // Leave out for no password
        mqttTopics: [
            "Tesla",
            "teslamate/cars/1/+",
         ],
        logging: true,
        localeStr: 'de-DE',
        maxAgeSeconds: 3600,    // Reduce intensity if values are older
        // style: "groupedLines",
        // style: "image",
        style: "lines",
        imageURL: 'http://192.168.178.xxx/img/teslaModelSBlack.png',

        displayState: true,
        displayOdometer: true,
        displayOutside_temp: true,
        displayBattery_level: true,
        displayCharger_actual_current: true,
        displayInside_temperature: true,
        displaySentry_mode: true,
      }
},
spitzlbergerj commented 4 years ago

and my MQTTClient.exe.config at the teslalogger raspberry looks like

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxxx" >
            <section name="MQTTClient.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxxxxxxx" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <applicationSettings>
        <MQTTClient.Properties.Settings>
            <setting name="MQTTHost" serializeAs="String">
                <value>192.168.178.xxx</value>
            </setting>
            <setting name="Topic" serializeAs="String">
                <value>Tesla</value>
            </setting>
            <setting name="Name" serializeAs="String">
                <value />
            </setting>
            <setting name="Password" serializeAs="String">
                <value />
            </setting>
        </MQTTClient.Properties.Settings>
    </applicationSettings>
</configuration>
gerbin01 commented 4 years ago

Hi Sepp,

I think the MQTT config works fine, I see the values in my browser. The array is shown, but it can not be interpreted in the Module. The MagicMirror-err.log is empty. Is it possible to set a debug level in the module?

2020-11-01 13_28_03-MagicMirror²

In the screenshot I see two errors, ist this output helpful for you?

2020-11-01 13_40_01-MagicMirror²

Thank you & best regards Gerald

spitzlbergerj commented 4 years ago

Hallo Gerald,

ich wechsle mal auf deutsch.

Beim Installieren des Moduls hast du im Modulverzeichnis das Kommando

npm install

ausgeführt, oder? Es sieht so aus, als wären nicht alle Abhängigkeiten geladen worden. Kannst du das nochmal machen bitte?

Viele Grüße

Sepp

gerbin01 commented 4 years ago

Hallo Sepp,

npm install durchgeführt, folgende Ausgabe habe ich bekommen:

pi@MagicMirror:~/MagicMirror/modules/MMM-TeslaLogger $ npm install
audited 165 packages in 9.908s

14 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Die Anzeige im Browser hat sich nicht verändert. Zur Sicherheit den Raspi noch einmal durchgestartet, gleiches Ergebnis. Meine MagicMirror Version ist 2.13.0.

Viele Grüße Gerald

spitzlbergerj commented 4 years ago

Hello Gerald,

I have found the problem. Unfortunately I cannot correct it quickly. I have to change something more.

It is because I assume that the MQTT topic from TeslaLogger is "Tesla". I have added this, because I can also process data from teslamate. I did not think that this could be another name. Sorry.

Quick solutions (1 or 2):

  1. correct the code for you You change line 197 in the file MMM-TeslaLogger.js - replace "Tesla" with your topic

  2. change TeslaLogger MQTT configuration Change the topic to "Tesla" in the file MQTTClient.exe.config it should be

            <setting name="Topic" serializeAs="String">
                <value>Tesla</value>
            </setting>

I still have to think about the general solution. I document the current error in the documentation.

Many greetings

Sepp

gerbin01 commented 4 years ago

Hello Sepp,

thank you - now it works :-)

Have a nice weekend! Best regards Gerald

spitzlbergerj commented 4 years ago

Hallo Gerald,

Interessehalber: hast du die TeslaLogger Config geändert oder das JavcaScript?

Am einfachsten wäre es natürlich, wenn ich „festschreibe“, dass das TeslaLogger Topic Tesla sein muss 😉

Viele Grüße

Sepp

gerbin01 commented 4 years ago

Hallo Sepp,

ich habe das JavaScript geändert. Grund dafür ist, dass ich den Teslalogger in openhab integriert habe, dort passt für mich die Struktur nicht, wenn das Topic nur „Tesla“ heißen würde.

Ich fände es aber auch o.k., wenn in der Doku steht, dass wenn man das Topic ändert, dies im JavaScript auch geändert werden muss. Der MagicMirror ist eh kein fertiges Ding „out oft the box“, somit ist ein wenig basteln auch o.k.

Viele Grüße

Gerald

spitzlbergerj commented 4 years ago

Hallo Gerald, könntest du für mich bitte was testen?

Kannst du die Zeile 197 so ändern:

                if (payload.topic === this.config.mqttTopics[0]) {

In der Config müsste dann das Topic für den Teslalogger das erste Topic sein. Dann müsste es meiner Meinung nach funktionieren. Danke Sepp

gerbin01 commented 4 years ago

Hallo Sepp,

funktioniert. Hab es soeben getestet.

Schöne Grüße

Gerald

Von: Josef Spitzlberger Gesendet: Sonntag, 1. November 2020 17:30 An: spitzlbergerj/MMM-TeslaLogger MMM-TeslaLogger@noreply.github.com Cc: gerbin01 geb01@gmx.at; Comment comment@noreply.github.com Betreff: Re: [spitzlbergerj/MMM-TeslaLogger] New MM install. Not getting values with module (#15)

Hallo Gerald, könntest du für mich bitte was testen?

Kannst du die Zeile 197 so ändern:

                           if (payload.topic === this.config.mqttTopics[0]) {

In der Config müsste dann das Topic für den Teslalogger das erste Topic sein. Dann müsste es meiner Meinung nach funktionieren. Danke Sepp

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/spitzlbergerj/MMM-TeslaLogger/issues/15#issuecomment-720114520 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AIHEMTJSLGVO5CVMCIQFQ3TSNWEIBANCNFSM4RTPBGDA . https://github.com/notifications/beacon/AIHEMTPKTNT4QBD56NASAC3SNWEIBA5CNFSM4RTPBGDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFLWBGWA.gif

spitzlbergerj commented 4 years ago

Super, Danke!