[SOLVED] MQTT setup functions on certain items. but not on rest?

Hi All the good guys from OpenHAB.
i have been adding stuff to my MQTT to My system. but seems to have ran in to a issue ?
i had one channel that worked from i set it up in the first go. now i added more channels to start adding to my system monitoring. and they just seem to fail me even if i followed the same velocify i used to set up the working on. i do get the information on mqtt explorer but cant seem to get it in to openhab.

i am using mosquito as my broker. all the other stuff seems to work that i set up.
please see attached screen grabs.( trying cpuTemp)
mqtt explorer :

Sitemap :

Things File :

Bridge mqtt:broker:mosquitto "MQTT Broker"              [ host="192.168.1.5", port=1883, clientid="openhab", secure=false]
{
Thing topic system  "System"{
     Channels:
     Type number : DB-TEMP                   "DB-Temp"                    [ stateTopic="OpenHAB-DB/TEMP" ] //currently working 
     Type number : DBCPU_Temp                "CPU Temp"                   [ statTopic="OpenHAB-DB/cpuTemp"]
     Type number : DBLoad                    "CPU Load"                   [ statTopic="OpenHAB-DB/CPULOAD"]
    // Type number : DBmem_used                "Mem Used"                   [statTopic="OpenHAB-DB/MUSED"]
   //  Type number : DBmem_free                "Mem Free"                   [statTopic="OpenHAB-DB/MFREE"]
    // Type number : DBmem_size                "Mem SIZE"                   [statTopic="OpenHAB-DB/MSIZE"]
    // Type number : DBdrive_size              "Drive SIZE"                 [statTopic="OpenHAB-DB/DSIZE"]
   //  Type number : DBdrive_used              "Drive Used"                 [statTopic="OpenHAB-DB/DUSED"]
    // Type number : DBdrive_avail              "Mem Avail"                 [statTopic="OpenHAB-DB/DAVAIL"]
     }

items :

/* OpenHAB-DB 1 */
Number  DB_Temp                     "DB Temp[%.1f °C ]"                             {channel="mqtt:topic:mosquitto:system:DB-TEMP"}
Number  DBCPU_Temp                  "CPU Temp[%.1f °C ]"                            {channel="mqtt:topic:mosquitto:system:DBCPU_Temp"}
Number  DBLoad                      "Load[%.1f % ]"                                 {channel="mqtt:topic:mosquitto:system:DBLoad"}
Number  DBmem_used                  "Mem Used[%.1f MB]"                             {channel="mqtt:topic:mosquitto:system:DBmem_used"}
Number  DBmem_free                  "Mem Free[%.1f MB]"                             {channel="mqtt:topic:mosquitto:system:DBmem_free"}
Number  DBmem_size                  "Total Mem[%.1f MB]"                            {channel="mqtt:topic:mosquitto:system:DBmem_size"}
Number  DBdrive_size                "Total drive [%.1f GB ]"                        {channel="mqtt:topic:mosquitto:system:DBdrive_size"}
Number  DBdrive_used                "Drive Used[%.1f %]"                            {channel="mqtt:topic:mosquitto:system:DBdrive_used"}
Number  DBdrive_avail               "Drive Avail [%.1f %]"                          {channel="mqtt:topic:mosquitto:system:DBdrive_avail"}

Sitemap :

Frame label="OpenHAB-DB 1"   {
        Default item=DB_Temp
        Default item=DBCPU_Temp
        Default item=DBLoad
 }

i am not sure but i think this is my issue ?
the information comes from node red. as below.

load

10/21/2019, 3:44:44 PM node: 66ddd19e.3c311
msg.payload : number
54.2

cputemp

10/21/2019, 3:44:44 PM node: 66ddd19e.3c311
msg.payload : number
54.2

Log

2019-10-21 15:42:09.568 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting undefined value [sourcePattern=%.1f%, targetPattern=%1$s%, exceptionMessage=Conversion = '%']

==> /var/log/openhab2/openhab.log <==

2019-10-21 15:42:10.590 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting undefined value [sourcePattern=%.1f%, targetPattern=%1$s%, exceptionMessage=Conversion = '%']

2019-10-21 15:42:10.592 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting undefined value [sourcePattern=%.1f%, targetPattern=%1$s%, exceptionMessage=Conversion = '%']


The %-sign is a special character in the label definition, I believe you need to write %% if you want a literal %-character.

Number DBLoad "Load[%.1f %% ]" 
1 Like

Ok but that is not the problem temp?

Are you sure? Because the errors in the log complains that the value can’t be transformed, and that the %-character is causing it.

What makes you think it’s the channel that doesn’t work?

Hi @pacive.
Sorry for the hasty reply it actually fixed the error. but i still can’t get the mqtt info to my sitemap.

Looked at your config again and spotted the issue: you have written statTopic instead of stateTopic in your channel configuration (in the .things-file), for all channels except the first one!

Sorry for wasting your time. with this rookie mistake. thats for helping me see where my fault was.

Thanks again.

No problem, you will give back to the community by helping someone else some day!

1 Like