# \[APP\]\[Pro\] MQTT Hub - Community version

**URL:** <https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463>\
**Category:** Apps\
**Tags:** app, mqtt, homey-pro\
**Created:** [July 26, 2024, 3:58pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463 "2024-07-26T15:58:53Z")\
**Posts on this page:** 20\
**Page:** 10

<div class="post-metadata">

**Author:** ![Greg\_McKinney](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/greg_mckinney/32/81500_2.png) [@Greg\_McKinney](https://community.homey.app/u/Greg_McKinney)\
**Post date:** [January 14, 2025, 9:59pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/190 "2025-01-14T21:59:24Z")

</div>

> [@RonnyW](#):
>
> `(value) => { return (JSON.parse(value).pir_detected == 1) }`

I found a possible bug in MQTT Hub.

```auto
{
  "onoff": {
    "capability": "onoff",
    "stateTopic": "home/e04b4100adac0000000000007bac0000_m/status",
    "setTopic": "",
    "valueTemplate": "$.pir_detected",
    "outputTemplate": "",
    "displayName": "Motion"
  }
}

```

This will correctly reflect the state of motion sensor as a light switch and then if I replace

```auto
  "onoff": {
    "capability": "onoff",

```

with

```auto
  "alarm_motion": {
    "capability": "alarm_motion",

```

Then everything works correctly for a while. I did have it revert to not working once. I had it powered off, so I am not sure if that was causing the re-failure. I was able to make 2 sensors work using this process. How do I log this issue as I am new to Homey.

---

<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:** [January 14, 2025, 10:30pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/191 "2025-01-14T22:30:02Z")

</div>

The MQTT Hub app settings offers a log. There you should find error messages if an error happens while converting a value (I think). And you should see the values read from MQTT Broker.

 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/d/bd541ad81b21209f5d9ffb22a0621a39f6df473b.png)

It shouldn’t male any difference whether you use onoff or alarm\_motion capability. Both are boolean and are changed by a true/false value.

If you are using the value template `"valueTemplate": "$.pir_detected",`, then it’s using the number value (0 or 1) instead of true/false.  
You can check if the connection is working if you set the calue in MqttExplorer to true/false instead of 0/1:

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

This way you can check if the JSON path is taken and the JSON value is used.

But at the end you will need a JS function to parse the JSON and then convert the number into a boolean value. I can check this the next days how a converter should be defined…

---

<div class="post-metadata">

**Author:** ![Greg\_McKinney](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/greg_mckinney/32/81500_2.png) [@Greg\_McKinney](https://community.homey.app/u/Greg_McKinney)\
**Post date:** [January 14, 2025, 10:46pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/192 "2025-01-14T22:46:20Z")

</div>

I checked the logs and saw no errors which confused me on why it was not working. The logs on the client and the Hub both indicated that I should be seeing something instead of absolutely nothing. That is what drove me to experiment with different device capabilities. I had tried every variation of conversion and nothing was giving a result before switching devices. It took switching the capabilities to get a result. I have been using the devices to correctly trigger flows after using the swapping method I described.

---

<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:** [January 14, 2025, 10:48pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/193 "2025-01-14T22:48:22Z")

</div>

You can try with a custom MQTT topic. Create a topic “test”, set it to true/false in MqttExplorer. Then add a MQTT device using this test topic and check if this is read. Just to be sure the connection is ok.  
If this is working, then it’s a issue with the JSON/value conversion.

---

<div class="post-metadata">

**Author:** ![Greg\_McKinney](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/greg_mckinney/32/81500_2.png) [@Greg\_McKinney](https://community.homey.app/u/Greg_McKinney)\
**Post date:** [January 14, 2025, 10:58pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/194 "2025-01-14T22:58:25Z")

</div>

I am not following your line of thinking. If

```auto
{
  "alarm_motion": {
    "capability": "alarm_motion",
    "stateTopic": "home/e04b4100adac0000000000007bac0000_m/status",
    "setTopic": "",
    "valueTemplate": "$.pir_detected",
    "outputTemplate": "",
    "displayName": "Motion"
  }
}

```

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/4/b462a5f82a071dc2220b46337b324d6ddf874d57.jpeg)

is now working correctly in a flow. How can value conversion be the issue?

---

<div class="post-metadata">

**Author:** ![luguber](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/luguber/32/16795_2.png) [@luguber](https://community.homey.app/u/luguber)\
**Post date:** [January 15, 2025, 6:51am UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/195 "2025-01-15T06:51:01Z")

</div>

Hmmm, I don’t get it to work though.  
The field is interpeded as a number when I select it as a tag, and I can copy the value to a number variable. So it should be a number. Not sure how else to check it.  
I also tried to add type: number to the capability, but it didn’t make a difference.  
I tried just to test to add min and max properties, but these doesn’t seem to work either.  
Unit works fine.

```auto
  "measure_monetary.import.0": {
    "capability": "measure_monetary",
    "stateTopic": "Pow-U/prices",
    "setTopic": "",
    "valueTemplate": "$.prices.0",
    "outputTemplate": "",
    "type": "number",
    "units": "kr",
    "decimals": "4",
    "title": "Price Now"
  }

```

---

<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:** [January 15, 2025, 7:38pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/196 "2025-01-15T19:38:16Z")

</div>

I tested again…it seems there is a bug in Homey FW.

You can decrease the number of decimals like

```auto
"decimals": 0,

```

This is shown in the UI.  
But it’s not possible to increase the number of decimals beyond the original capability settings.  
I’ll ask Athom if that’s by design or a bug 🙂

---

<div class="post-metadata">

**Author:** ![luguber](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/luguber/32/16795_2.png) [@luguber](https://community.homey.app/u/luguber)\
**Post date:** [January 15, 2025, 10:27pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/197 "2025-01-15T22:27:37Z")

</div>

Thank you for your help!  
I see dropping the quotes around the number helps as I wasn’t able to reduse either when using the double quotes. Maybe that was the problem when I tested the max and min properties as well, as I used the quotes then too.  
I recently got updated to the 12.3.0 stable fw, not sure if it behaved any differntly on previous 12.2.1 fw as I didn’t try this on that fw.

---

<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:** [January 15, 2025, 11:28pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/198 "2025-01-15T23:28:09Z")

</div>

Afaik, with JSON formatting, putting numeric values between double qoutes, ‘formats’ numeric values as string values.  
In that case, a Homey device setting which takes numeric values only, will not respond / error.

---

<div class="post-metadata">

**Author:** ![VSurlien](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/vsurlien/32/17240_2.png) [@VSurlien](https://community.homey.app/u/VSurlien)\
**Post date:** [February 13, 2025, 7:41pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/200 "2025-02-13T19:41:47Z")

</div>

Hi,  
I have the MQTT Hub v4.3.10 installed on a Homey Pro 2023.  
I am trying to add a MQTT Device with a simple switch on/off with state and set topic.  
The closet i find is Closed (True | False) as a garagedor\_closed

 ![Garagedoor](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/3/b34537b303752d89fb39c49e9a07c7b31839f66d.png)

Is this switch on/off not available or am I just not able to find it?

BR Vegard

---

<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:** [February 13, 2025, 8:01pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/201 "2025-02-13T20:01:07Z")

</div>

Hi, I had to check it myself 😅  
The app just shows the capability name defined by Athom.

In your case, the `onoff` capability is right. So “Turned on” is the right one.

```auto
{
  "type": "boolean",
  "title": {
    "en": "Turned on",
    "nl": "Aangezet",
    "de": "Eingeschaltet",
    "fr": "Activé",

```

Thanks for the hint. I’ll check if I can add the capability name in addition.

---

<div class="post-metadata">

**Author:** ![VSurlien](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/vsurlien/32/17240_2.png) [@VSurlien](https://community.homey.app/u/VSurlien)\
**Post date:** [February 14, 2025, 4:23pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/202 "2025-02-14T16:23:52Z")

</div>

Thanks, it was exactly what I was looking for, Thanks @RonnyW

---

<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:** [February 14, 2025, 7:01pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/203 "2025-02-14T19:01:08Z")

</div>

New **test version 4.3.11**

- Changed capability selection in pair view. Added capability id.

Because there are so many capabilities now, it’s easier to find the right one by ID and not by title.

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

---

<div class="post-metadata">

**Author:** ![Erik\_Z1](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/erik_z1/32/13319_2.png) [@Erik\_Z1](https://community.homey.app/u/Erik_Z1)\
**Post date:** [February 14, 2025, 7:47pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/204 "2025-02-14T19:47:18Z")

</div>

I’m facing the same challenge. Have you managed to get it working in the meantime?

---

<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:** [February 14, 2025, 7:54pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/205 "2025-02-14T19:54:09Z")

</div>

The app offers all new capabilities in pair view.  
What exactly is the problem?

---

<div class="post-metadata">

**Author:** ![VSurlien](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/vsurlien/32/17240_2.png) [@VSurlien](https://community.homey.app/u/VSurlien)\
**Post date:** [February 17, 2025, 8:24pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/207 "2025-02-17T20:24:11Z")

</div>

This page wil probably help you if you are struggeling with finding the correct capability:  
[https://apps-sdk-v3.developer.homey.app/tutorial-device-capabilities.html](https://apps-sdk-v3.developer.homey.app/tutorial-device-capabilities.html)

---

<div class="post-metadata">

**Author:** ![PhilippeMa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/philippema/32/12434_2.png) [@PhilippeMa](https://community.homey.app/u/PhilippeMa)\
**Post date:** [February 20, 2025, 8:10pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/208 "2025-02-20T20:10:33Z")

</div>

Hi

I’m facing the same problem as vasiya.

I setup my gPlugM which gives me the total power consumption of my house.  
I’m able to brows the data in MQTT explorer. The value which i yould like to have on my virtual device from MQTT Hub. Ho do i get the Value Pi to be represented in the virtual device.

Topic: MaurerHome/gPlugM/SENSOR

{“Time”:“2025-02-20T21:00:12”,“z”:{“SMid”:“63536221”,“Pi”:1.942,“Po”:0.000,“Pi1”:0.000,“Pi2”:0.000,“Pi3”:0.000,“Po1”:0.000,“Po2”:0.000,“Po3”:0.000,“U1”:0.000,“U2”:0.000,“U3”:0.000,“I1”:0.491,“I2”:0.197,“I3”:0.231,“Ei”:16816.360,“Eo”:0.000,“Ei1”:8237.385,“Ei2”:8578.978,“Eo1”:0.000,“Eo2”:0.000,“Q5”:497.554,“Q6”:0.001,“Q7”:0.000,“Q8”:6033.209,“Q51”:252.571,“Q52”:244.983,“Q61”:0.000,“Q62”:0.001,“Q71”:0.000,“Q72”:0.000,“Q81”:2391.543,“Q82”:3641.666}}

Ho does the Topics section has to be configured?  
{  
“measure\_power”: {  
“capability”: “measure\_power”,  
“stateTopic”: “MaurerHome/gPlugM/SENSOR”,  
“setTopic”: “”,  
“valueTemplate”: “z.Pi”,  
“outputTemplate”: “”,  
“displayName”: “”  
}  
}

---

<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:** [February 20, 2025, 8:47pm UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/209 "2025-02-20T20:47:48Z")

</div>

Try to change

```auto
"valueTemplate": "z.Pi",

```

into

```auto
"valueTemplate": "$.z[0].Pi.value",

```

Because the value of _ **Pi** _ is always a numeric value, quoting is not needed/undesired, so you’d format it like this:

```auto
"valueTemplate": $.z[0].Pi.value,

```

(quoting the value makes it a _string/text_ value).

Make sure to use straight quotes `"` instead of the fancy ones you posted `”`

---

<div class="post-metadata">

**Author:** ![PhilippeMa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/philippema/32/12434_2.png) [@PhilippeMa](https://community.homey.app/u/PhilippeMa)\
**Post date:** [February 21, 2025, 8:11am UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/210 "2025-02-21T08:11:42Z")

</div>

Hi Thanks for your answer.  
With  
“valueTemplate”: $.z[0].Pi.value,  
I’ll get the following error on Saving  
Invalid Value: class

If i return it sets the quotes themself.

I see the published data of my gplugM in the Hub Log, but I’m not able to setup a MQTT Device with MQTT Hub. Is the MQTT Client even necessary?  
It looks for me like an issue with the MQTT Device from MQTT Hub but I’m not sure.

Does anyone have another input which i could try?  
Thanks

---

<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:** [February 22, 2025, 4:59am UTC](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463/211 "2025-02-22T04:59:29Z")

</div>

Hi Philippe,

No problem!

> [@PhilippeMa](#):
>
> Is the MQTT Client even necessary?

Yes, MQTT hub uses it, to publish and receive messages.

> [@PhilippeMa](#):
>
> If i return it sets the quotes themself.

Yes, my bad; I noticed it seems to be hardcoded somehow…

> [@PhilippeMa](#):
>
> I’ll get the following error on Saving  
> Invalid Value: class

You’ll need to pick a matching class when you create the device; I picked “sensor”.  
But you can change it afterwards as well:

> ![1000044312](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/d/0d9a81a663beaff76cc624ff029bf77c82a822da.jpeg)

Sooo, after lots of trial & error, I found a working solution.  
You most probably need to use:

```auto
"valueTemplate": "$.z.Pi",

```

As example, and to compare, I used this MQTT message from topic ‘homey2/system/info’;  
I used two values for my virtual MQTT device:

```auto

{
  "system": {
    "freememMachine": 112508928,
    "cpus": [
      {
        "model": "ARMv7 Processor rev 10 (v7l)",
        "speed": 996,
        "times": {
          "user": 1226178
        }
      },
      {
        "model": "ARMv7 Processor rev 10 (v7l)",
        "speed": 996,
        "times": {
          "user": 12277290
        }
      }
    ],
  },
}

```

Virtual MQTT device:

```auto
{
  "measure_data_size": {
    "capability": "measure_data_size",
    "stateTopic": "homey2/system/info",
    "setTopic": "",
    "valueTemplate": "$.system.freememMachine",
    "outputTemplate": "",
    "displayName": ""
  },
  "measure_data_rate": {
    "capability": "measure_data_rate",
    "stateTopic": "homey2/system/info",
    "setTopic": "",
    "valueTemplate": "$.system.cpus[0].times.user",
    "outputTemplate": "",
    "displayName": ""
  }
}

```

[Previous page](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463.md?page=9)

[Next page](https://community.homey.app/t/app-pro-mqtt-hub-community-version/113463.md?page=11)
