These widgets send MQTT messages to HA. I first designed the GUI. I then added MQTT to send the messages to HA. Once I liked it, I converted the python file into an executable.
With PyQt5, I used the Designer tool to make the GUI. There’s tons of resources on how to use PyQt and Designer tool so I won’t spend much time on it. I saved the GUI as a .ui file. PyQt can convert that file to a py module and the GUI is called as an object.
MQTT is super simple. Install paho-mqtt and it hardly takes any code to send a message. A lot of MQTT examples I’ve seen don’t have the client.username_pw_set() command, I’ve had a lot less trouble using it. You can use your HA credentials but I created a seperate user/person.
import paho.mqtt.client as paho
client = paho.Client()
client.username_pw_set('mqtt-user','mqtt-password')
client.connect('homeassistant.local')
client.publish('topic', 'message')
PyInstaller converts python files to executables. I used the -w -F flags. The output is a single file that works on other computers on my network.