Skip to content

Java 20 app that's open in tray and send's MQTT message to the server, so server can turn on or off pc light, with GUI interface done in swing

Notifications You must be signed in to change notification settings

xmarkurion/javaTrayMqtt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MQTT Java App for turning light on and off when needed

If you want to run it get yourself Full JDK Liberica 20

Why ?

This app was done for purpose to switch pc light on or off. App it's able to store configuration file where server config is kept, so you can modify and try on your own!

See some of my notes which i've made during the development.

How this app works.

  1. Open it enter your mqtt server credentials
  2. Press save ( app should create and modify config.properties files)
  3. Press Connect If connected you can close and reopen app.

After config file initialized

  1. Since initial config app by default's tries to connect to the known MQTT server
  2. App sends a topic ("java/light/status") with value of 1.
  3. App minimize itself to try
  4. When pc is shutting down there is hook added to the app, so it will send another mqtt message this time with value of 0

Gui preview

Main window:

GUI

Tray icon:

tray

Handle Node-red logic

Now you can handle the logic in Node-Red or somewhere where you like to. nodered

Bonus generated diagram

diagram

About

Java 20 app that's open in tray and send's MQTT message to the server, so server can turn on or off pc light, with GUI interface done in swing

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages