How to replace MQTT with homeassistant_api in Python

Hello all. I feel like I’m on the cusp of finding the right info but I never quite get there.
I’m sending the CPU temp of a Raspberry Pi to HA via MQTT/Python and it works as expected.
I would like try doing this with the homeassistant_api in place of MQTT, but I’m not seeing where that’s documented.

I’ve successfully toggled a light with the api, so I have the easy part working. I just don’t see how to create an entity such as sensor.pi_closet_cpu_temperature that will appear in HA.

Can someone shed some light on this for me, please?