Recreate Deleted MQTT Entity (Discovery Not Working?)

I had an MQTT sensor created via yaml:

I deleted the yaml code, then deleted the entity in hass (it was reporting as unavailable).

I then tried to create it via a script to “discover” the device, similar to comment #6:

I tried to make four entities overall, each tied back to the same device. 3 of the 4 of them worked successfully. The first one - which should’ve recreated the manual yaml device - won’t come back.

How do I get this entity back?

Ignore me!

The problem was that I had the device_class parameter set to sensor instead of what it should have been. I found the error in the logs.