# JSONPATH of MQTT - Two values in one variable

**URL:** <https://community.openhab.org/t/jsonpath-of-mqtt-two-values-in-one-variable/144522>\
**Category:** Scripts & Rules\
**Created:** [February 17, 2023, 6:50pm UTC](https://community.openhab.org/t/jsonpath-of-mqtt-two-values-in-one-variable/144522 "2023-02-17T18:50:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hoerli](https://community.openhab.org/user_avatar/community.openhab.org/hoerli/32/43102_2.png) [@Hoerli](https://community.openhab.org/u/Hoerli)\
**Post date:** [February 17, 2023, 6:50pm UTC](https://community.openhab.org/t/jsonpath-of-mqtt-two-values-in-one-variable/144522/1 "2023-02-17T18:50:21Z")

</div>

Hello forum,

I am currently connecting a new Shelly device with Tasmota via MQTT to openHAB.  
The Shelly 2.5 has two switchable outputs where you can measure the power.  
The power is output via POWER.  
However, there is only one POWER and the two values are separated by a comma.

```auto
{
  "Time": "2023-02-17T19:22:22",
  "Switch1": "OFF",
  "Switch2": "OFF",
  "ANALOG": {
    "Temperature": 62.4
  },
  "ENERGY": {
    "TotalStartTime": "2023-01-12T19:32:55",
    "Total": 0.003,
    "Yesterday": 0,
    "Today": 0.003,
    "Period": [
      0,
      0
    ],
    "Power": [
      0,
      0
    ],
    "ApparentPower": [
      15,
      0
    ],
    "ReactivePower": [
      14,
      0
    ],
    "Factor": [
      0,
      0
    ],
    "Frequency": 50,
    "Voltage": 238,
    "Current": [
      0,
      0
    ]
  },
  "TempUnit": "C"
}

```

All other values I could comfortably read out correctly via “Incoming Value Transformations”.  
`JSONPATH:$.ENERGY.Total`

What is the easiest way to separate the two values?  
I would like to create two channels.  
One for each value.  
But I am too stupid to create the JSONPATH correctly.

Does anyone have an idea?

 ![Shelly25](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/4/2/42edf664b11214e26c157861db6f4d1152ed5900.png)

---

<div class="post-metadata">

**Author:** ![JensD](https://community.openhab.org/user_avatar/community.openhab.org/jensd/32/56746_2.png) [@JensD](https://community.openhab.org/u/JensD)\
**Post date:** [February 17, 2023, 7:57pm UTC](https://community.openhab.org/t/jsonpath-of-mqtt-two-values-in-one-variable/144522/2 "2023-02-17T19:57:34Z")

</div>

I didn´t tested it but it should be

```javascript
$.ENERGY.Power[0]

```

and

```javascript
$.ENERGY.Power[1]

```

as it is an array

---

<div class="post-metadata">

**Author:** ![Hoerli](https://community.openhab.org/user_avatar/community.openhab.org/hoerli/32/43102_2.png) [@Hoerli](https://community.openhab.org/u/Hoerli)\
**Post date:** [February 17, 2023, 8:06pm UTC](https://community.openhab.org/t/jsonpath-of-mqtt-two-values-in-one-variable/144522/3 "2023-02-17T20:06:38Z")

</div>

Thanks for the quick reply!  
I think that fits.  
See the results unfortunately not until tomorrow, but I now receive a number.
