MQTT - Space in line causing parse error

Hello, I am having a problem with a space in my items file, here is how I have it listed:

Number attic_t2 "AC Output Temperature [%.1f F]" { mqtt="<[mosquitto:emon/attic_temp_probes/external\ temperature:state:default]" }

Here is the error that I am getting:

2016-06-13 04:35:08.634 [ERROR] [i.internal.GenericItemProvider] - Binding configuration of type 'mqtt' of item ‘attic_t2‘ could not be parsed correctly. org.openhab.model.item.binding.BindingConfigParseException: Missing mqtt binding configuration for item attic_t2

After reading up on everything I could find, I thought escaping the space with the \ was the correct way to go, but openhab seems to disagree!

Can someone explain how to escape the space properly?

Many Thanks

Here is an example that works for me.

Number temp_supply "Supply Temperature [%.1f °C]" <temperature> (temperature , GF_Mancave) { mqtt =
	"<[mqttService:myHouse/services/hvac/unit1/temp:state:default]" }

I wonder if the problem is because you have “” after external. Have you tried “/” instead?

I Just re-read your message. Not sure you can have spaces in a topic. Do you need to have a space, or can you use the underscore character?

Hi Mike -

MQTT allows spaces in topics, we use them all the time…does OH not allow spaces in topics…?

We need to use a space, an underscore would require us to reprogram all of our arduino sketches!

To be honest, I am not sure. Hopefully someone with more knowledge will step in here…

I guess I have the luxury to be able avoid spaces as I am really only getting started with both openHAB 2 and also Arduino devices for my project.

Yeah, the docs seem to point to the fact that you can escape spaces, but I cannot seem to make it work.

Are you sure that the space in the topic name needs special handling?

And sometime the simplest solution is the correct solution…you are correct, it did not need to be escaped at all…

Thank You !!

1 Like

Please mark @watou 's posting as solution, so the thread will be marked as solved…

opps…thanks for the reminder! Done!