[Twiz O'Meter] MQTT data format questions
- maikt
- Autor
- Expert Boarder
- Beiträge: 225
- Dank erhalten: 209
A little hint: json supports also the array, number and boolean data types, you don't need to send everything as a string
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Delvecchio
- Pro Boarder
- Fabio java
- Beiträge: 583
- Dank erhalten: 912
I'll proceed with all the other values, and share here another test fw asap.
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.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
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.
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- maikt
- Autor
- Expert Boarder
- Beiträge: 225
- Dank erhalten: 209
Okay, converting is a bit tricky (json -> strValue -> numValue), but it should work.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.
Yes, it works: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 the app can also any control items (values)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.
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Delvecchio
- Pro Boarder
- Fabio java
- Beiträge: 583
- Dank erhalten: 912
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
- Pro Boarder
- Fabio java
- Beiträge: 583
- Dank erhalten: 912
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Sherlock
- Senior Boarder
- Beiträge: 155
- Dank erhalten: 116
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Delvecchio
- Pro Boarder
- Fabio java
- Beiträge: 583
- Dank erhalten: 912
Sherlock, be aware: this version is previous the expansion pins fix!Sherlock schrieb: I'll test it in a few days.
It was intended only for testing the full Json payload, with all the values.
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- maikt
- Autor
- Expert Boarder
- Beiträge: 225
- Dank erhalten: 209
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.
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- maikt
- Autor
- Expert Boarder
- Beiträge: 225
- Dank erhalten: 209
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",
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Delvecchio
- Pro Boarder
- Fabio java
- Beiträge: 583
- Dank erhalten: 912
I'll check.maikt schrieb: A small bug: When the MQTT connection is established, the MQTT icon is not updated (it remains crossed out).
Scanning of WiFi networks available is timed each two minutes.maikt schrieb: And: when I arrive at home, the WiFi does not connect automatically.
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: The first problem is the ':' character in the BatteryCell voltage and temperature values. because this character is not allowed in the json transformationPattern.
These data refer to the actual trip (with trip mode active) or of the last trip (with trip mode disactive):maikt schrieb: And I have a question: What are these dates?
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.
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- maikt
- Autor
- Expert Boarder
- Beiträge: 225
- Dank erhalten: 209
OK, I will Check it.Delvecchio schrieb: Scanning of WiFi networks available is timed each two minutes.
Yes, of course.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?
Ah ok. I understandDelvecchio schrieb: These data refer to the actual trip (with trip mode active) or of the last trip (with trip mode disactive):
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.
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- maikt
- Autor
- Expert Boarder
- Beiträge: 225
- Dank erhalten: 209
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- Delvecchio
- Pro Boarder
- Fabio java
- Beiträge: 583
- Dank erhalten: 912
You are right. I totaly forgot a piece of code!maikt schrieb: After I checked the checkbox and saved the change, the checkbox will unchecked immediately.
Enclose the fix.
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: sometimes I get empty MQTT data from TOM
It would be nice. Thank you!maikt schrieb: I can also post my OpenHAB scripts here later
Dieser Beitrag enthält einen Anhang.
Bitte anmelden (oder registrieren) um ihn zu sehen.
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- maikt
- Autor
- Expert Boarder
- Beiträge: 225
- Dank erhalten: 209
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
- Pro Boarder
- Fabio java
- Beiträge: 583
- Dank erhalten: 912
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.