[APP][Pro] MQTT Hub - Community version

Yeah that’s what I was thinking too, although I’m not sure of meter is always “total” or if it can also be “total increasing” (which means that it will always increase, but it can also be reset to 0, like “daily usage” values).

I added the state_class attribute to HA auto discovery:

Should be ok this way, right?

Harrie already started to add capability dependent values like device_class.
This could also be added. Buut this will need a static mapping for every capability and its HA states I think.

I’m not 100% familiar with the format that HA requires, but it looks okay to me :+1:t2:

New live version 4.3.6:

  • Fixed show/hide details in app settings.
  • Added state_class for measure/meter capabilities.
1 Like

Hi!
Pretty new Homey User so bare with me :slight_smile:
I added my Nibe Heatpump as a MQTT Device with MQTT-hub and client…
Works perfectly good except I´m missing a capability for a quite important value.
Its called “Degree Minutes” and is a negativ 16-bit value (normally between -60 and -2000)
The raw MQTT json looks like below.
I´m struggling to find a capability to match it ot, I saw one of the previous post about custom cababilites but it it possible to solve in any good way?

Thank you :slight_smile:

{
“register”: “43005”,
“factor”: 10,
“size”: “s16”,
“mode”: “R/W”,
“titel”: “Degree Minutes (16 bit)”,
“info”: “Degree minutes, 16bit value (-32768 < x < 32767). Values outside valid values are rounded to the closest valid value.”,
“unit”: “”,
“min”: “-30000”,
“max”: “30000”,
“logset”: false,
“data”: -56,
“raw_data”: -56,
“timestamp”: 1736256148208
}

New test version 4.3.7:

  • Added generic Number and Text capabilities.

@JohanW
Standard Homey capabilities are use case specific (don’t know a better description). They all have a meaning or unit.
So I just added two generic capabilities to the app: “Number” and “Text”.
That are simple capabilities to store numbers or strings without unit or other dependencies.
There is also a capability changed trigger added.
Please install the test version (link above) and try it this fits your needs.

1 Like

Thanks for the swift reply, seem to work perfectly as far as I can see :slight_smile:

Hello @RonnyW ,

Running latest version of your app. For some reason, my tamper alarm, motion alarm, switches and locks only get published as “sensor” in MQTT, and then it broke my HA Devices/Automations from devices in Homey . Do you have any clue why this happened?
bilde
Old:
bilde
New:
bilde

I published a new test version that should fix this bug. Can you please check and give a feedback? If it’s ok again, I want to release it to live channel asap.

Thanks for your feedback and sorry for the circumstances :slight_smile:

@RonnyW , Thanks! You can publish to live.

2 Likes

Thanks, 4.3.9 is live now.

1 Like

New test version 4.3.10:

  • Added capability specific device_class for HA auto discovery.

This added a device_class attribute for sensors that are passed to MQTT HA auto discovery.

If anyone wants to check if the mapping is correct:

That’s the mapping:

That are the device classes used:

Please let me know if you notice any wrong states in your HA entities.

1 Like

I have a Linknlink motion detector connected to the Homey MQTT Broker. I can see messages being correctly sent with MQTT Explorer. I also have the Homey MQTT Hub installed. I have a MQTT Client installed, but I don’t think I need it for this configuration.

{
“alarm_motion”: {
“capability”: “alarm_motion”,
“stateTopic”: “home/e04b4100adac0000000000007bac0000_m/status”,
“setTopic”: “”,
“valueTemplate”: “$.pir_detected”,
“outputTemplate”: “”,
“displayName”: “Motion alarm”
}
}
I added a MQTT device. I have tried many variations in the valueTemplate format, but the device is not showing any values being received. The history stays blank, but I see the status toggling between 0 and 1. Please help.

MQTT Hub uses the MQTT Client to connect with the broker. So yes, you need both for it to work.

I tried with and without the MQTT Client. How do I verify that the client is configured correctly? The MQTT Client logs don’t flag anything for me.

Your Mqtt topic doesn’t have a boolean value used by an alarm_motion capability. You have to convert it to true/false.
This would be easy with MathJS conversion. But you also have a JSON string as value that needs to pe parsed.
So I think a JS function is needed.

Please try this as value template (not checked, just as idea).

(value) => { return (JSON.parse(value).pir_detected == 1) }
 

I tried this:

{
  "alarm_motion": {
    "capability": "alarm_motion",
    "stateTopic": "home/e04b4100adac0000000000007bac0000_m/status",
    "setTopic": "",
    "valueTemplate": "(value) => { return (JSON.parse(value).pir_detected == 1) }",
    "outputTemplate": "",
    "displayName": "Motion"
  }
}

I also tried:
“valueTemplate”: “(JSON.parse(value).pir_detected == 1)”

“valueTemplate”: “($.pir_detected == 1)”

I have tried some other variations too, but no data is showing up in the MQTT device. Is there any source or tools that I can use for figuring this out?

Please format code by using the </> button.
Because when you actually use fancy qoutes nothing works
:x:
" :white_check_mark:

Hi,

Is it possible to set number of decimals in a capability?
I have a capability like this:

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

But, it is rounding to two decimals. (otherwise it works fine).

The source json is like this (just a small excerpt):

"prices":{"0":1.0149,"1":1.0127, ...
    "decimals": 4,

should work (value as number, not as string).
You can use all elements of capability options: