MQTT topic messages to variable

Sure I will do right away. Are there any specific things I have to look at?

Just if it still works. Other apps seem to have problems with the last change.
For the rest, its also build against SDK3

What I saw with the previous update, that I had to restart the Tasmota MQTT app…

I have updated MQTT client to V2.4.0 but I need due to this update I had to restart the Tasmota MQTT.

For the rest no issues, I receive all the different MQTT topics and messages. I don’t see any issue at the moment.

Thx. Regarding restarting of the Tasmota app, that is needed because when updating the mqtt client is stopped and the topic subscriptions are gone.

Yes I know and not a problem.
But What I do not understand is when you reboot Homey. In that case I have to manual restart soma apps like Tasmota MQTT because the MQTT client was not available yet. Maybe this has something to do with the latest firmeware update of Homey. In the past I never had this issue that there was a sorting order needed.

Never the less… The MQTT Client works fine. :relaxed::ok_hand:t2:

Does anyone knows how to get values from labels with spaces? For example, this is what I get in MQTT client:

received '{“temp”:18.9,“hum”:52.4,“ppmw”:7173,“Speed status”:42.5,“Internal fault”:0,“Frost cycle”:0,“Filter dirty”:0,“AirQuality (%)”:200,“AirQbased on”:64,“CO2level (ppm)”:763,

If I want to get the temp, the hum or the ppmw I use this in MQTT Hub:
“valueTemplate”: “$.temp”,
“valueTemplate”: “$.hum”,
“valueTemplate”: “$.ppmw”,

This is working for me, but now I want to show the actual ppm on the device, instead of the ppmw. The label is: “CO2level (ppm)”. But when I use this:

"valueTemplate": "$.CO2level (ppm)"

it’s not showing any value. I assume that it has something to do with the space. Do I have to escape it somehow?

$["CO2level (ppm)"]

That’s fast!
I still get: unexpected $ token.

And don’t i also need the dot (.) somewhere?

Try single quotes: $['CO2level (ppm)']

Same:

“measure_humidity”: {
“capability”: “measure_humidity”,
“stateTopic”: “itho/ithostatus”,
“setTopic”: “”,
“valueTemplate”: “$.hum”,
“outputTemplate”: “”,
“displayName”: “Humidity”
},
“measure_co2”: {
“capability”: “measure_co2”,
“stateTopic”: “itho/ithostatus”,
“setTopic”: “”,
“valueTemplate”: $[‘CO2level (ppm)’]
“outputTemplate”: “”,
“displayName”: “CO2”
}

"valueTemplate": "$['CO2level (ppm)']"

1 Like

That’s it! Thanks a lot:)

Since you react so fast, do you know wether Homey also have a capability like co2 and humidity for a fan/rpm?

2 Likes

hi, i can not add a co2
the dim, temperature and the humidity works,
but when i wil add a co2 do i get an error message


{
  "dim": {
    "capability": "dim",
    "stateTopic": "itho/state",
    "setTopic": "itho/cmd",
    "valueTemplate": "round((value / 255) * 100)",
    "outputTemplate": "round((value / 100) * 255)",
    "displayName": "Dim level" 
  },
  "measure_temperature": {
    "capability": "measure_temperature",
    "stateTopic": "itho/ithostatus",
    "setTopic": "",
    "valueTemplate": "$.temp",
    "outputTemplate": "",
    "displayName": "Temperature"
  },
  "measure_humidity": {
    "capability": "measure_humidity",
    "stateTopic": "itho/ithostatus",
    "setTopic": "",
    "valueTemplate": "$.hum",
    "outputTemplate": "",
    "displayName": "Humidity"
 },
“measure_co2”: {
“capability”: “measure_co2”,
“stateTopic”: “itho/ithostatus”,
“setTopic”: “”,
“valueTemplate”: $[‘CO2level (ppm)’]
“outputTemplate”: “”,
“displayName”: “CO2”
}

That’s not valid, try this:

"valueTemplate": "$['CO2level (ppm)']",

it didnt work

{
“dim”: {
“capability”: “dim”,
“stateTopic”: “itho/state”,
“setTopic”: “itho/cmd”,
“valueTemplate”: “round((value / 255) * 100)”,
“outputTemplate”: “round((value / 100) * 255)”,
“displayName”: “Dim level”
},
“measure_temperature”: {
“capability”: “measure_temperature”,
“stateTopic”: “itho/ithostatus”,
“setTopic”: “”,
“valueTemplate”: “$.temp”,
“outputTemplate”: “”,
“displayName”: “Temperature”
},
“measure_humidity”: {
“capability”: “measure_humidity”,
“stateTopic”: “itho/ithostatus”,
“setTopic”: “”,
“valueTemplate”: “$.hum”,
“outputTemplate”: “”,
“displayName”: “Humidity”
},
“measure_co2”: {
“capability”: “measure_co2”,
“stateTopic”: “itho/ithostatus”,
“setTopic”: “”,
"valueTemplate": "$['CO2level (ppm)']"
“outputTemplate”: “”,
“displayName”: “CO2”
}

You’re using smart quotes instead of regular quotes in your JSON.

this is what i have now and that works good.
i want onley a co2 meter

{
  "dim": {
    "capability": "dim",
    "stateTopic": "itho/state",
    "setTopic": "itho/cmd",
    "valueTemplate": "round((value / 255) * 100)",
    "outputTemplate": "round((value / 100) * 255)",
    "displayName": "Dim level" 
  },
  "measure_temperature": {
    "capability": "measure_temperature",
    "stateTopic": "itho/ithostatus",
    "setTopic": "",
    "valueTemplate": "$.temp",
    "outputTemplate": "",
    "displayName": "Temperature"
  },
  "measure_humidity": {
    "capability": "measure_humidity",
    "stateTopic": "itho/ithostatus",
    "setTopic": "",
    "valueTemplate": "$.hum",
    "outputTemplate": "",
    "displayName": "Humidity"
  }
}

what am I doing wrong,
this is my first time using this