IoT Link - restart windows app

Hi,

I am using MQTT with IoT Link, installed on a windows machine.

I want to run a script that restarts Blue Iris - here is the script to start Chrome - i cannot for the life of me figure out how to restart a program:

  my_computer_run_chrome:
    alias: "My Computer - Run Chrome"
    sequence:
      - service: mqtt.publish
        data:
          topic: "iotlink/workgroup/my-computer/commands/run"
          payload: '{ "command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "args": "https://iotlink.gitlab.io", "path": "C:\\Program Files (x86)\\Google\\Chrome\\Application", "user": "", "visible": true, "fallback": true }'

Any ideas?

Thanks.

You might have to kill the program first.
Windows 10 have a command called tskill.exe in Windows\system32 that can do that.

Isn’t blueiris a service? If not I’d look into making it one. Look up the sc command. Then iotlink should just be able to restart the service.

I thought I was the only person that used iotlink. I made some changes to it for a more openHAB based mqtt experience

1 Like

Thanks, that worked!

Yeah I use it and only just started. Pretty neat solution.

Can you share your script’s final version ? Thank you in advance.

Here you go

alias: Server Reboot
sequence:
  - service: mqtt.publish
    data:
      topic: iotlink/workgroup/server-xyz/commands/reboot
      payload: ''
mode: single

And to reboot a virtualbox machine

alias: Server pfsense Reboot
sequence:
  - service: mqtt.publish
    data:
      topic: iotlink/workgroup/server-xyz/commands/run
      payload: >-
        { "command": "C:\\users\\admin\\virtualbox
        vms\\pfsense-firewall-restart.bat", "path":
        "C:\\users\\admin\\virtualbox vms", "user": "", "visible": true,
        "fallback": true }
mode: single