[Twiz O'Meter] MQTT data format questions

  • maikt
  • maikts Avatar
  • Autor
  • Expert Boarder
  • Expert Boarder
  • Beiträge: 202
  • Dank erhalten: 174
09 Mai 2023 01:06 #243934 von maikt
[Twiz O'Meter] MQTT data format questions
It works, I managed to transform the json data :)




A little hint: json supports also the array, number and boolean data types, you don't need to send everything as a string :)
Anhänge:
Folgende Benutzer bedankten sich: Delvecchio

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • Delvecchio
  • Delvecchios Avatar
  • Pro Boarder
  • Pro Boarder
  • Fabio java
  • Beiträge: 486
  • Dank erhalten: 686
09 Mai 2023 09:42 - 09 Mai 2023 10:27 #243943 von Delvecchio
[Twiz O'Meter] MQTT data format questions
Thanks for the test and happy for the resuts.
I'll proceed with all the other values, and share here another test fw asap.

maikt schrieb: A little hint: json supports also the array, number and boolean data types, you don't need to send everything as a string :)

I know, but thanks anyway for the information. It's easier for me to send all data as string, because I already have them in memory, formatted as string (ready to be sent to ToM display). Reverting them to their original datatypes would require a lot of work for me and unuseful work for ToM processor, with decreasing of performance.

Just for curiousity:
- when you process/display received data, does the app let you modify the 3 digits name in a more human readable way?
- can the app control a certain value and take some action according to it? I ask you because ToM already sends the triggered alarm via mqtt, with a different control element (i.e. another number for "XXX", instead of 255) and in case the app can control this field, it could have sense to add a json payload also for triggered alarm.
Letzte Änderung: 09 Mai 2023 10:27 von Delvecchio.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • maikt
  • maikts Avatar
  • Autor
  • Expert Boarder
  • Expert Boarder
  • Beiträge: 202
  • Dank erhalten: 174
09 Mai 2023 21:28 #243947 von maikt
[Twiz O'Meter] MQTT data format questions

Delvecchio schrieb: I know, but thanks anyway for the information. It's easier for me to send all data as string, because I already have them in memory, formatted as string (ready to be sent to ToM display). Reverting them to their original datatypes would require a lot of work for me and unuseful work for ToM processor, with decreasing of performance.

Okay, converting is a bit tricky (json -> strValue -> numValue), but it should work.

Delvecchio schrieb: Just for curiousity:
- when you process/display received data, does the app let you modify the 3 digits name in a more human readable way?

Yes, it works:

Delvecchio schrieb: - can the app control a certain value and take some action according to it? I ask you because ToM already sends the triggered alarm via mqtt, with a different control element (i.e. another number for "XXX", instead of 255) and in case the app can control this field, it could have sense to add a json payload also for triggered alarm.

Yes the app can also any control items (values)
Anhänge:
Folgende Benutzer bedankten sich: Delvecchio

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • Delvecchio
  • Delvecchios Avatar
  • Pro Boarder
  • Pro Boarder
  • Fabio java
  • Beiträge: 486
  • Dank erhalten: 686
14 Mai 2023 20:27 #244142 von Delvecchio
[Twiz O'Meter] MQTT data format questions
I completed the Json payload for all the values.
Here is the second Json test firmware.
I hope it will work fine.

Dieser Beitrag enthält einen Anhang.
Bitte anmelden (oder registrieren) um ihn zu sehen.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • Delvecchio
  • Delvecchios Avatar
  • Pro Boarder
  • Pro Boarder
  • Fabio java
  • Beiträge: 486
  • Dank erhalten: 686
27 Mai 2023 21:06 #244494 von Delvecchio
[Twiz O'Meter] MQTT data format questions
Did someone test it? Maikt?

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • Sherlock
  • Sherlocks Avatar
  • Senior Boarder
  • Senior Boarder
  • Beiträge: 113
  • Dank erhalten: 65
27 Mai 2023 21:36 #244496 von Sherlock
[Twiz O'Meter] MQTT data format questions
I'll test it in a few days.
Folgende Benutzer bedankten sich: Delvecchio

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • Delvecchio
  • Delvecchios Avatar
  • Pro Boarder
  • Pro Boarder
  • Fabio java
  • Beiträge: 486
  • Dank erhalten: 686
27 Mai 2023 22:09 - 27 Mai 2023 22:10 #244497 von Delvecchio
[Twiz O'Meter] MQTT data format questions

Sherlock schrieb: I'll test it in a few days.

Sherlock, be aware: this version is previous the expansion pins fix! ;)
It was intended only for testing the full Json payload, with all the values.
Letzte Änderung: 27 Mai 2023 22:10 von Delvecchio.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • maikt
  • maikts Avatar
  • Autor
  • Expert Boarder
  • Expert Boarder
  • Beiträge: 202
  • Dank erhalten: 174
28 Mai 2023 00:36 - 28 Mai 2023 00:38 #244499 von maikt
[Twiz O'Meter] MQTT data format questions
Sorry, so far I've only come to install the firmware. The data is also transferred to the MQTT broker. I'll look at the data over the next few days.

A small bug: When the MQTT connection is established, the MQTT icon is not updated (it remains crossed out)

And: when I arrive at home, the WiFi does not connect automatically.

And: The MQTT prefix is not shown in the MQTT Explorer.
Letzte Änderung: 28 Mai 2023 00:38 von maikt.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • maikt
  • maikts Avatar
  • Autor
  • Expert Boarder
  • Expert Boarder
  • Beiträge: 202
  • Dank erhalten: 174
28 Mai 2023 01:53 - 28 Mai 2023 01:59 #244500 von maikt
[Twiz O'Meter] MQTT data format questions
So I started to transfer and convert the JSON data from the MQTT Broker to openhab. The first problem is the ':' character in the BatteryCell voltage and temperature values. because this character is not allowed in the json transformationPattern.
In addition, the value C13 is missing



And I have a question: What are these dates?
"tKT": "1384",
"tKR": "64",
"tTM": "33319",
"tKW": "12.8",
"t10": "9.2",
"t01": "0.09",
"tMN": "0.02",
"tKH": "14.9",
Anhänge:
Letzte Änderung: 28 Mai 2023 01:59 von maikt.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • Delvecchio
  • Delvecchios Avatar
  • Pro Boarder
  • Pro Boarder
  • Fabio java
  • Beiträge: 486
  • Dank erhalten: 686
28 Mai 2023 11:35 - 28 Mai 2023 11:41 #244510 von Delvecchio
[Twiz O'Meter] MQTT data format questions

maikt schrieb: A small bug: When the MQTT connection is established, the MQTT icon is not updated (it remains crossed out).

I'll check.

maikt schrieb: And: when I arrive at home, the WiFi does not connect automatically.

Scanning of WiFi networks available is timed each two minutes.

maikt schrieb: The first problem is the ':' character in the BatteryCell voltage and temperature values. because this character is not allowed in the json transformationPattern.

Ok. I changed (for example) from C1: to C01. I enclose the fw with this mod. Can you tell me if C13 is fixed too?

maikt schrieb: And I have a question: What are these dates?

These data refer to the actual trip (with trip mode active) or of the last trip (with trip mode disactive):
tKT = driven Km
tKR = estimated remaining Km
tTM = time
tKW = consumed kWh
t10 = kWh/100 Km
t01 = kWh/1 Km
tMN = kWh/1 min
tKH = average speed

Dieser Beitrag enthält einen Anhang.
Bitte anmelden (oder registrieren) um ihn zu sehen.

Letzte Änderung: 28 Mai 2023 11:41 von Delvecchio.
Folgende Benutzer bedankten sich: maikt, AndiEcker

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • maikt
  • maikts Avatar
  • Autor
  • Expert Boarder
  • Expert Boarder
  • Beiträge: 202
  • Dank erhalten: 174
28 Mai 2023 13:44 #244511 von maikt
[Twiz O'Meter] MQTT data format questions

Delvecchio schrieb: Scanning of WiFi networks available is timed each two minutes.

OK, I will Check it.

Delvecchio schrieb: Ok. I changed (for example) from C1: to C01. I enclose the fw with this mod. Can you tell me if C13 is fixed too?

Yes, of course.

Delvecchio schrieb: These data refer to the actual trip (with trip mode active) or of the last trip (with trip mode disactive):

Ah ok. I understand

But I think there is one more problem: sometimes I get empty MQTT data from TOM:
{ "XXX": "255", "SOC": "", "SOH": "", "B-T": "", "M-T": "", "Tun": "", "kWh": "", "Amp": "", "RPM": "", "Nm ": "", "FW ": "", "C1:": "", "C2:": "", "C3:": "", "C4:": "", "C5:": "", "C6:": "", "C7:": "", "C8:": "", "C9:": "", "C10": "", "C11": "", "C12": "", "C14": "", "C14": "", "Pac": "", "T1:": "", "T2:": "", "T3:": "", "T4:": "", "T5:": "", "T6:": "", "T7:": "", "Reg": "", "ECO": "", "Nor": "", "Spo": "", "CSt": "0", "tAY": "", "B12": "", "PN1": "", "PN2": "", "KmT": "32855", "KmR": "255", "KmH": "", "SeT": "", "tKT": "", "tKR": "", "tTM": "", "tKW": "", "t10": "", "t01": "", "tMN": "", "tKH": "", "kW ": "", "CEt": "", "CdK": "", "C-T": "30", "CKw": "", "Min": "", "T-T": "", "Acc": "", "AnX": "", "AnY": "", "AnZ": "" }

Otherwise it's looking pretty good, thanks. If you are interested, I can also post my OpenHAB scripts here later.
Anhänge:
Folgende Benutzer bedankten sich: AndiEcker, Delvecchio

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • maikt
  • maikts Avatar
  • Autor
  • Expert Boarder
  • Expert Boarder
  • Beiträge: 202
  • Dank erhalten: 174
28 Mai 2023 14:02 - 28 Mai 2023 14:15 #244512 von maikt
[Twiz O'Meter] MQTT data format questions
With the last firmware, it is not possible to activate the 'Additional Json payload' via the web interface. After I checked the checkbox and saved the change, the checkbox will unchecked immediately.
Letzte Änderung: 28 Mai 2023 14:15 von maikt.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • Delvecchio
  • Delvecchios Avatar
  • Pro Boarder
  • Pro Boarder
  • Fabio java
  • Beiträge: 486
  • Dank erhalten: 686
28 Mai 2023 14:39 - 28 Mai 2023 14:45 #244513 von Delvecchio
[Twiz O'Meter] MQTT data format questions

maikt schrieb: After I checked the checkbox and saved the change, the checkbox will unchecked immediately.

You are right. I totaly forgot a piece of code! :blush:
Enclose the fix.

maikt schrieb: sometimes I get empty MQTT data from TOM

This could happen only at the early beginning of boot, when the values aren't yet stored in memory. Please let me know if it happens secondly.

maikt schrieb: I can also post my OpenHAB scripts here later

It would be nice. :) Thank you!

Dieser Beitrag enthält einen Anhang.
Bitte anmelden (oder registrieren) um ihn zu sehen.

Letzte Änderung: 28 Mai 2023 14:45 von Delvecchio.
Folgende Benutzer bedankten sich: maikt

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • maikt
  • maikts Avatar
  • Autor
  • Expert Boarder
  • Expert Boarder
  • Beiträge: 202
  • Dank erhalten: 174
28 Mai 2023 15:20 #244517 von maikt
[Twiz O'Meter] MQTT data format questions
[quote="Delvecchio"
This could happen only at the early beginning of boot, when the values aren't yet stored in memory. Please let me know if it happens secondly.[/quote]
I would say that happens at the end, i.e. before the TOM shuts down, because I see this data after a charging process or after DC converter activity.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • Delvecchio
  • Delvecchios Avatar
  • Pro Boarder
  • Pro Boarder
  • Fabio java
  • Beiträge: 486
  • Dank erhalten: 686
28 Mai 2023 16:10 #244520 von Delvecchio
[Twiz O'Meter] MQTT data format questions
Yes, this happens for the same reason.
ToM switches off when there isn't traffic on the canbus for more than 500msec, so it's possibile that if a payload is sent during that period all values are zeroed.
If this is a problem, I can try to invent something to prevent it. But I'm not sure to succeed.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

   Become a Patron