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?

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.