So I searched quite a bit on it, and found out the following.
Set a fixed IP on the workstation
Created a HomeAssistant user on my PC (local user account with administrator privileges), and given it a password.
This is entered into the config for the addon like this:
computers:
alias: KennethsPC
address: 10.11.12.40
credentials: HomeAssistant%SecretPassword
delay: 30
message: >-
Computeren lukkes af Home Assistant, dette kan ikke afbrydes, gem dine
ting!
You have to open the Windows Defender Firewall for ‘Remote shutdown’ (it’s called Fjernlukning in danish, so I hope that’s what it says in english).
At first I saw this error: Could not initialise pipe winreg. Error was NT_STATUS_OBJECT_NAME_NOT_FOUND
To fix that, open the services.msc on you workstation, and set the service Remote Registry to Manual.
The next error I saw was WERR_CALL_NOT_IMPLEMENTED
To fix that, I logged in as that user, and opened the registry (regedit.exe).
In there I had to create a key under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
The key is a 32-bit DWORD that is called
LocalAccountTokenFilterPolicy
And set that to the value of 1.
Is there an option to force a restart like shutdown -f -r ?
I have a task scheduled for rebooting but was curious if this rpc addon can accept arguments like that.
I have tried all the steps above Including turning off the firewall completely on the PC and I still get this error message in the log for the addon:
[15:32:32] INFO: Read alias: mypc
[15:32:32] INFO: Shutdown mypc → ###.###.###.###
could not connect to server ###.###.###.###
connection failed: NT_STATUS_CONNECTION_REFUSED
could not connect to server ###.###.###.###
connection failed: NT_STATUS_CONNECTION_REFUSED
[15:32:32] ERROR: Shutdown failed:
Nothing else shows in the log for the addon after that, except when I try it again, the same exact 7 lines (except the time is different if course).
I am able to ping the PC from the RPI running HA directly when I at a command prompt on the RPI host command line.
It’s the RPC service that’s the hurdle (I think), I had to fiddle with local rights for it to work, on my machine it just worked, on my sons it took me a week.
I just changed all RPC (Remote Procedure Call) services on my machine to automatic and then staerted every single one, but I am still getting “NT_STATUS_CONNECTION_REFUSED”. Also I have checked from the RPI running HA and the PC in question - there are no firewall rules blocking connectivity between the two - and they are on the same vlan… What were the other things you tried on your son’s machine?
In order to run the installer that was downloaded, I had to go tinto properties and select “unblock” to unblock it from running. Then whenever I run the app, It instantly closes as soon as I run it - even if my firewall is completely turned off. Ideas?
I’ve never had any issues like that. What is your UAC level set to? Could be that you need to run the install as local admin (completely guessing here!).
But otherwise post it to the github: Issues · hass-agent/HASS.Agent · GitHub