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