Publish temperature number without unit

trying to publish a temperature number without a unit “°C” .If i send it as a Number:Temperature it wont go.As a Number it works fine.I use “{“temperature”:%f}” at format before publish .I tried “REGEX:s/°C//g” at outgoing transformation to try to not to send “°C” but only the number but it didnt work.Any ideas?

1 Like

Publish with what? There are dozens of add-ons that publish.

ok let me explain lil better,i want to send to my nspanel my room temperature so nspanel display it on the screen.So i ve made a mqtt channel with command topic


and format before publish


Then i link my room’s temp item to that channel using “Follow” profile.
Now if my room’s temp item is Number all is working fine.If the item is Number:Temperature ,as it should be, its no go.So i want the channel to publish only the number without the unit.

I think if you add °C to the Units of Measurement field of the Channel config, the MQTT binding will strip off the units when it publishes.

But I don’t know how that works and interacts with the “format before publish” field. I don’t think that will work.

So you’ll probably need to use a transformation instead to strip the units from the value before publishing. I know of no way to do that from the format before publish field. You’ll want to use the JS transformation I think.

you are right thnx mate.

Hi All,
I am really a beginner and have started with openhab / nspanel as this eems to me the “best way” to use the NS panel. I have used the configuration guide 2.9 from Alf Pfeiffer, so far so good, everything works: starting screen, NXpanel page trigger and I see all the nice buttons. However, the “simple” publising of the temperature on the starting screen fails. The script in the rule I use

import org.slf4j.LoggerFactory
def logger = LoggerFactory.getLogger("org.openhab.core.automation.nspanel")
def Current_Indoor_Temp = ir.getItem("Current_Indoor_Temperature").state.intValue()
def Current_Outdoor_Temp = ir.getItem("Current_Outdoor_Temperature").state.intValue()
def json = String.format("{ \"summary\": { \"title\": \"Out %d°C\", \"text\": \"In %d°C\" } }",Current_Outdoor_Temp, Current_Indoor_Temp)

The log shows:

  • 2023-04-14 22:31:35.800 [WARN ] [rnal.defaultscope.ScriptBusEventImpl] - Item ‘nxpanel_temperature_command’ does not exist.
  • 2023-04-14 22:31:35.801 [INFO ] [org.openhab.core.automation.nspanel ] - nxpanel_temperature_command{ “summary”: { “title”: “Out 16°C”, “text”: “In 16°C” } }

The nxpanel_temperature_command is a channel linked to the thing “NSpanel”, and the both temepratures are linked to the command. I have tried everything and read the guide over and over again but cannot find what is wrong. Help is appreciated!
Best regards,

This sentence doesn’t make much sense and it may have bearing on the error. Channels are linked to Items. Channels exist on Things. You don’t link a Channel to a Thing.

And the error is very clear, there is no Item with the name nxpanel_temperature_command in your configuration. You cannot command a Channel, only Items.

1 Like

Thanks Rich, this really helped. I had to make an item “nxpanel_temperature_command” and linked that to the NXpanel temperature control channel. BR Henk