So I have been using a Vera hub to WoL and shutdown a media PC that runs a theater room. But I am striking Vera from the network so HA will do everything from now on. HA’s cloud services aren’t perfect since Alexa support is one-way, but it will have to do for now. One of the things I need to figure out is shutting down windows though. I have the WoL part down, but shutting down is a trick. I have something running on the machine (MCE Controller) that listens for the command to shut down via I believe TCP. Vera used the following command to trigger it. How would I interpret this in HA?
function shutDown(host)
local socket = require("socket")
c = assert(socket.connect(host, 5150))
c:send("shutdown\r")
c:close()
end
luup.call_delay("shutDown", 0, "192.168.20.13")
I have installed HASS.Agent on my Windows PC and it works quite well and I can setup buttons using its satellite service to restart or shutdown my PC from HA. I think it also works best if you have MQTT installed which I already had as I use Zigbee2MQTT, so it was a simple setup for me to get it up and running.
It looks like it hasn’t been updated since 2022 though:
Unfortunately, neither of these options work with the setup I have. I updated the main post to include what I am running (MCE Controller). I believe it receives its commands over TCP if I understand right.
I tried the RPC shutdown option but no-go. Logs say couldn’t connect to server.
I had said neither because neither accomplishes what I originally was seeking. Which was how to interact with MCE Controller to send that shutdown command that Vera is currently taking advantage of. I figured, why create a whole new process of doing something when the current method has been working all this time just fine. Just need to figure out how to do it with HA.
However, I can’t find anything about it anywhere (so much for the easy solution). So I am stuck with the RPC method that didn’t work since their documentation doesn’t mention anything needing to be done on the Windows PC side of things. I will try what francisp said to see if that changes anything.
You have to change HOW you do something enough when you migrate, you should ALWAYS stop and consider if the way you’re currently trying to do something on another platform is the RIGHT way to do it here. Migration is the right time for a ROT (redundant, outdated, trivial) analysis. Achieved by 'I want to do this thing, how would I do it if I started on HomeAssistant. Then, compare that process to how you did it before. Decide on best path forward. It rarely steers you wrong - and applies here.
RPC call is the way if you want JUST shutdown. WoL is the right way for just startup (And I have both enabled for my boxes)
I suspect however, if you want full control of that box - volume, on/off, media, etc. You will eventually want to look at HASS.Agent. (That’s what it does.) A little more complicated setup (client on the end box) but a more flexible endgame. (Nothing says you can’t have both, or neither)
@francisp 's steps should be good - takes care of user rights assignment, security policy, remote registry, etc. - but you may still have to allow RPC through the windows firewall depending on your config.
I found a need to implement this on my DVR running MCE Controller, and I realized it makes more sense as a Shell Command that can be called from an automation or script.
Obviously performing the shutdown is just one of many MCE Controller functions, but easy to leverage for my application coordinating a shutdown between my DVR and a APC UPS NMC via SNMP integration.