Hello everyone
Can anyone help me with my problem?
I want to get information from KODI (coreelec) using JSON and read it over wifi (ESP32) so I can display it on the LCD. I have the basic code in python but I don't know how to do it in arduino.
This is the link I want to extract from. No matter what I do, no output. I just need to point to a specific library and a way to extract, in this case System.Date.
I'm not asking anyone to write me the whole code.
{"id":5,"jsonrpc":"2.0","result":{"System.Date":"12. marca 2025"}}
Now I need to clean out the exit. Remove everything that doesn't belong there.
The next step should be to use one link to get multiple different data and then just select them.
"VideoPlayer.ChannelName",
"System.Date"
and so on.
#include <WiFi.h>
#include <HTTPClient.h>
#include <ArduinoJson.h> //JSON
#define WIFI_SSID "WIFI_AP"
#define WIFI_PASSWORD "WIFI_PASSWORD"
void setup()
{
Serial.begin(115200);
Serial.println();
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
}
Serial.println();
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();
}
void loop()
{
if ((WiFi.status() == WL_CONNECTED))
{
HTTPClient http; //Instanz von HTTPClient starten
http.begin("http://192.168.0.150:8081/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22XBMC.GetInfoLabels%22,%22params%22:{%22labels%22:[%22System.Date%22]},%22id%22:5}");
int httpCode = http.GET(); //Antwort des Servers abrufen
if (httpCode == 200)
{
String payload = http.getString(); //Daten in eine Variable speichern
Serial.println(payload);
}
}
delay(1000);
}