Easy MQTT Handler - An MQTT client to connect your PC to Home Assistant

Dear Home Assistant Community,

this is my first post, as I’ve used to be a lurker on this community usually, only. Today I want to share my pet project with you. It’s called Easy MQTT Handler and it’s a labour of love and a desktop application developed in python3 using the Qt5 GUI Framework.

Easy MQTT Handler was mainly developed to provide an easy way to integrate any sort Personal Computers into Home Automation. The tool offers a simple, but functional, GUI to connect to an MQTT Broker and listen to a topic. The user is able to define commands and parameters that should be part of the payload of the MQTT messages received from the broker. For each command/parameter combination the user can then define an executable that should be launched once a certain command/parameter combination is received.

The tool is neatly integrating into the users’ environment by sitting in the tray area as a tray icon.

I’ve created a Git repository on GitHub for Easy MQTT Handler: https://github.com/andzeil/easy-mqtt-handler

Just to give you an idea about the tool, here’s a screenshot which shows the main dialog:

Initially I’ve developed this tool for my own usage: I use it to control my Desktop PC from Home Assistant. It controls the RGB lights of my hardware, it starts Steam in Big Picture mode after activating my secondary screen (a TV) and many other different things. It can do the same for you, now!

This is my first program in python, ever. I used it as a sample project to get a grip on the development environment and python eco system.

I just felt like giving back to this great community after everything this community has given to me over the years and I do hope that you can put it to use in your daily Automation life.

The tool should work without issues on Linux, Windows and MacOS. Should you have troubles getting it to run on any of this OSes, please open a GitHub issue (Issues · andzeil/easy-mqtt-handler · GitHub) any time and I will try to help you getting started with it.

I’ve spent a good amount of time on writing a rather extensive documentation for this tool. The docs should be able to answer most of your questions and will even help you to set up mosquitto MQTT broker on Home Assistant and connecting to it via SSL/TLS using either CA-generated certificates, or your own self-signed certificates. If you choose the later the docs will walk you through the process of using openSSL to generate your own CA and use it to sign your own certificates.

For the time being I will try to provide packages / installer for Linux and Windows, as I was facing some problems to get my build environment (briefcase) to build packages for MacOS (and I don’t even own any sort of Apple equipment). However, you surely can use the tool without getting it via packages any time, as it’s just a simple python program. Look into the documentation for hints about how to set it up on your machine and again: let me know if you are facing any problems in the process.

See you around.

– A. Zeil

[EDIT]
For your convenience, I’ve just added a few pre-compiled packages to the release:

Linux AppImage: Easy_MQTT_Handler-0.1.0-x86_64.AppImage
Debian Lunar Lobster .deb package: easy-mqtt-handler_0.1.0-1.ubuntu-lunar_amd64.deb
Windows Installer: Easy.MQTT.Handler-0.1.0-win.msi
Windows Portable: Easy.MQTT.Handler-portable-0.1.0-win.zip

3 Likes

Yo :D,

thanks for the tool. This is exactly the missing part to control my home entertainment center in my living room. I have two Windows PCs there and can now not only control the sockets via Zigbee, with a Zigbee IR Blaster the TV, sound system but also now what is running on the PC. For this I have created several modes: Watching Film, Playing VR, Playing Steam, etc… Very nice!

Send commands to my PCs via Home Assistant and easymqtt handler will receive it and run batch files for these profiles directly on the computers. In this case watching movies:

service: mqtt.publish
data:
  qos: 0
  retain: false
  topic: DESKTOP-QSFJAA9
  payload: "{\"command\":\"kodi\", \"args\":\"start\"}"

I also use home assistant web hooks to let HA know that the PCs are powered up. A batch script on login/logoff will trigger this HA hook:

alias: "Remote Sensor: Entertainment > living room > PC2 > isOnOff"
description: ""
trigger:
  - platform: webhook
    allowed_methods:
      - GET
    local_only: true
    webhook_id: living-room-pc2-setOnOffStatus
    alias: >-
      http://homeassistant.local:8123/api/webhook/living-room-pc2-setOnOffStatus?status=on
condition: []
action:
  - if:
      - condition: template
        value_template: "{{ trigger.query.status == \"on\"}}"
    then:
      - service: input_boolean.turn_on
        data: {}
        target:
          entity_id:
            - input_boolean.entertainment_living_room_pc2_ison
    else:
      - service: input_boolean.turn_off
        data: {}
        target:
          entity_id:
            - input_boolean.entertainment_living_room_pc2_ison
mode: single

If i then start the sockets and wake on LAN for the PC, then i can wait until the boolean for the PC is true and then send the commands for the easymqtt handler in the scripts for the buttons (Film, VR, Steam). This makes the timing perfect :slight_smile: If someone needs all full scripts or more info details let me know.

Simple and effective tool :smiley:

This might sound silly but how do you run this program? There is no .exe file or do I need to use the command prompt to run it?

There are msi installers and portable (non installed exe) versions listed on the releases page for download:

https://github.com/andzeil/easy-mqtt-handler/releases/tag/v0.1.1