Check devices connected via mqtt

hello guys! Can you tell me how to check from home assistant when a device connected via MQTT is on or off? I tried with the Nmap Tracker integration and it worked quite well, but I would like to know if there is a better alternative method. Thanks in advance

use mqttexplorer to see if device publishes if its on/off
on off

You could subscribe to such topics then with a binary sensor to say if on/off

LWT = last will and testament