# MQTT Werte ohne "value" in Virtual Device

**URL:** <https://community.homey.app/t/mqtt-werte-ohne-value-in-virtual-device/79192>\
**Category:** Fragen & Hilfe\
**Created:** [April 12, 2023, 4:17pm UTC](https://community.homey.app/t/mqtt-werte-ohne-value-in-virtual-device/79192 "2023-04-12T16:17:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_64](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/christian_64/32/25387_2.png) [@Christian\_64](https://community.homey.app/u/Christian_64)\
**Post date:** [April 12, 2023, 4:17pm UTC](https://community.homey.app/t/mqtt-werte-ohne-value-in-virtual-device/79192/1 "2023-04-12T16:17:40Z")

</div>

Hallo zusammen,

ich habe mir eine kleine Solaranlage gebaut und versuche gerade die Victron GX Werte über MQTT abzufragen. Ich bekomme diese auch aber leider schreibt der Victron die Werte immer so in den MQTT Broker: {“value”: 27.450000762939453}

Somit kann ich diese nicht einfach in einem Virtual Device anzeigen lassen. Gibt es einen Trick wie ich die Angabe in eine reine Zahl umwandeln kann? Leider kann ich an der Ausgabe vom Victron nichts ändern. Ich würde die 5-6 Werte die ich brauche einfach mit einer Regel oder einem Script umwandeln… das übersteigt aber meine aktuellen Fähigkeiten

Ich bin um jede Hilfe dankbar!

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 12, 2023, 4:46pm UTC](https://community.homey.app/t/mqtt-werte-ohne-value-in-virtual-device/79192/2 "2023-04-12T16:46:34Z")

</div>

Hast du AdvancedFlow? Wenn ja. dann hast du im Logik-Bereich Aktionskarten zum Lesen eines Feldes aus einem JSON-String.  
Dein Inhalt {…} ist dabbei der JSON String. “value” ist der Feldname.

Beispiel kann ich später zeigen, am Handy kann ich das nicht zeigen 😄

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [April 12, 2023, 4:53pm UTC](https://community.homey.app/t/mqtt-werte-ohne-value-in-virtual-device/79192/3 "2023-04-12T16:53:06Z")

</div>

Bei dieser rechnung rundest du auf ganze zahlen. Wenn Sie beispielsweise ` ,0` in ` ,2` umwandeln, wird auf 2 Dezimalstellen gerundet  
[https://homey.app/f/KrRnSt](https://homey.app/f/KrRnSt)

```auto
{{round([tag_from_mqtt] ,0)}}

```

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 12, 2023, 5:02pm UTC](https://community.homey.app/t/mqtt-werte-ohne-value-in-virtual-device/79192/4 "2023-04-12T17:02:54Z")

</div>

Hier das AdvancedFlow Beispiel. Mit normalem Flow get das nicht, weil man dafür mehrere Aktionen “verketten” muss…

Ich nehme an, den Wert hast du bereits mit dem MQTT-Client vom Broker gelesen, oder?

Dann nimmst du anschließend diese Karte:

 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/7/a7ea3854abd79c7a7daf8ad571d9ebd9ff6f46b4.png)

![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/0/308b0cfb4521fb6d91c4ac24101bd39f91754f76.png)

Als erstes Tag fügst du das Ergebnis des MQTT-Client-Events ein. Das enthält den JSON-String.  
Als Pfad gibst du “value” an.  
Die Karte liefert ein Ergebnis-Tag, das du in ein virtuelles Gerät übernehmen kannst.

---

<div class="post-metadata">

**Author:** ![Christian\_64](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/christian_64/32/25387_2.png) [@Christian\_64](https://community.homey.app/u/Christian_64)\
**Post date:** [April 12, 2023, 5:23pm UTC](https://community.homey.app/t/mqtt-werte-ohne-value-in-virtual-device/79192/5 "2023-04-12T17:23:14Z")

</div>

Danke Ronny,

es hat funktioniert und war so einfach 😅 Zum Glück habe ich nicht 5h versucht es selber hinzubekommen… schicke mir privat deine PayPal Adresse, für die Hilfe bekommst du eine Kiste Bier bezahlt 👍

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 12, 2023, 5:24pm UTC](https://community.homey.app/t/mqtt-werte-ohne-value-in-virtual-device/79192/6 "2023-04-12T17:24:09Z")

</div>

Danke, aber nicht dafür 🙂  
Dafür ist das Forum doch da.

---

<div class="post-metadata">

**Author:** ![Christian\_64](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/christian_64/32/25387_2.png) [@Christian\_64](https://community.homey.app/u/Christian_64)\
**Post date:** [April 18, 2023, 7:43pm UTC](https://community.homey.app/t/mqtt-werte-ohne-value-in-virtual-device/79192/7 "2023-04-18T19:43:30Z")

</div>

Kann mir nochmal @RonnyW oder jemand anderes helfen.

Wie bekomme ich aus dem MQTT Jason der Wert power vereinzelt für einen virtuellen Sensor?

{“sn”:{“Time”:“2023-04-18T20:24:21”,“Main”:{“power”:11616,“counter”:26420.040}},“ver”:1}

Danke Euch!

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 18, 2023, 7:49pm UTC](https://community.homey.app/t/mqtt-werte-ohne-value-in-virtual-device/79192/8 "2023-04-18T19:49:36Z")

</div>

Probier mal als Pfad “sn.Main.power”  
Das heißt übrigens JSON (JavaScript Objekt Notation).
