Thursday 1 June 2017

Automating Windows 10 with MQTT

I have developed a application for windows 10(some of the things should work on older versions).
The application is now avalible at https://github.com/KjetilSv/Win10As/


This application does
- Mute/unmute sound
- Set the volume(1-100)
- Power modes - Suspend/Shutdown/Reboot/Hibernate
- Custom commands ( everything that can be scripted should work)
- TTS( default language on default speaker)
- Toast message(link)
- Make screenshot(of primary monitor) to file(local or UNC) or MQTT
- Publishes cpu time, free memory, volume and mute(true/false)


Sample uses:


Girlfrind Nagging

In Home assistant a script I have a script my girl friend calls from Alexa, that triggers a toast and TTS message.

Home Assistant script:
(instead of mqtt switches it was easiest to just make a simple .sh script)
mosquitto_pub -t kjetilsv/toast -m "Home Assistant,kom ned!,,c:\temp\iselin.jpg"
mosquitto_pub -t kjetilsv/tts -m "NAG NAG NAG"




Easy remote monitoring

Often I'm waiting on download or stuff to compile I use the mqtt camera i Home Assistant.
With this I now can follow the process on my tablet relaxing in the couch.


HA implementation:
camera:
  - platform: mqtt
    topic: kjetilsv/mqttcamera
    name: kjetilsv


Alexa trigger work script
Mqtt scene that triggers a new RDP connection on my windows machine(the scene does some radio and light settings as well)



HA implementation:
- platform: mqtt
  name: "OfficeComputerWorkConnection"
  command_topic: "kjetilsv/jobb"
  payload_on: "1"
  optimistic: false
  qos: 0
  retain: false

15 comments:

  1. hey nice work!
    would you share it with us?
    thanks

    ReplyDelete
  2. Love this idea. Was looking for a good windows MQTT Based launcher. Can't wait see it.

    ReplyDelete
    Replies
    1. thanks :)
      If you have some special features you want, let me know :)

      Delete
  3. https://github.com/KjetilSv/Win10As/blob/master/mqtt.zip
    Early release so no installer, just unzip and run the .exe
    And I know the design sucks, I'm a backend coder :)
    Let me know if it works fine for you.

    ReplyDelete
  4. thank you!
    you are the best

    ReplyDelete
    Replies
    1. thanks :)
      Let me know if things are working.

      Delete
  5. Download link https://github.com/KjetilSv/Win10As/

    ReplyDelete
  6. HA implementation:
    - platform: mqtt
    name: "OfficeComputerWorkConnection"
    command_topic: "kjetilsv/jobb"
    payload_on: "1"
    optimistic: false
    qos: 0
    retain: false

    pops an error. can you share your configuration yaml file please?
    thank you!

    ReplyDelete
    Replies
    1. Will post sample HA config sometime the next days https://github.com/KjetilSv/Win10As together with a new and improved version :)

      Delete
  7. my anti virus says its a key logger is it and should i be worried

    ReplyDelete
  8. Hi, sorry for the late reply. It don't log anything. I will soon upload the source so if you are worried wait a few weeks/days :)

    ReplyDelete
  9. HI!
    (sorry for my english)
    I Love your APP!
    Only one problem, i've checked start minimized but don't work.
    Always open GUI on windows start.
    Can you help me?
    Win 10 64bit 1083 (build SO 17134.345)

    ReplyDelete
  10. Hi :)
    Is there a way to create a custom command that receives an input param from the MQTT message?
    i.e. I would like to replace the toast with a message box. There's a simple powershell command for that, but I need a way to add the payload of the MQTT message as an input param for the command.

    Thank you very much :)

    Asaf

    ReplyDelete