Skip to content

Instantly share code, notes, and snippets.

@SebastianStehle
Created November 26, 2023 16:25
Show Gist options
  • Save SebastianStehle/a997326074352f2e0a759a14f26b8a31 to your computer and use it in GitHub Desktop.
Save SebastianStehle/a997326074352f2e0a759a14f26b8a31 to your computer and use it in GitHub Desktop.
// Das Objekt muss nur das abbilden was du auch wirklich brauchst. Du kannst JSON properties ignorieren, wenn du sie nicht brauchst.
// DOKU: https://github.com/square/moshi
class SensorData {
SensorStatus cloud;
SensorStatus mqtt;
// Der Json property name ist nicht in JAva, deshalb müssen wir hier den Namen überschreiben.
@Json(name = "script:10") SensorScript script;
}
// MQTT und Cloud teilen sich ja die gleiche Struktur
class SensorStatus {
Boolean connected;
}
class SensorScript {
Int: id;
Boolean: running;
ArrayList<String> errors;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment