MQTT Type of Entity

Hi All (relative newbie here)

I have managed to setup an MQTT Service and Device and Entity that retrieves a value from another server.

Whilst it successfully retrieves the value it only works if the Type of Entity is Text. If I use number (which I want it to be) then it just returns Unknown.

The format returns is 12345 or -12345 (for example). It is essentially the power in Watts.

I presume this has something to do with Value Template. Should I use Type of Entity Text (and if so how do I convert it to an number) OR should I use Type of Entity Number (and if so how do I stop it returning “Unknown”)?

The connection itself seems to work - just the last step in getting this in the right format.

Here is an image showing the value returned from the remote server:

Any help / pointers appreciated.

It would help if you would share the YAML or whatever code you are using to create the sensor. Generally speaking, all HA stuff is technically text, but if you add a unit of measure to it, then it will get treated like a number.

1 Like

Solved - thank you so much - was missing unit of measure.