@Crille said in Reactor: How to call Hass service for noob:
cmd: page home
@Crille said in Reactor: How to call Hass service for noob:
cmd: page home
Reactor 23063 running on Windows Bare Metal.
Home assistant 2023.3.1
ESPHome 2023.2.4
I've been trying a few ways using some results from search to call a Hass service as a reaction in a Reactor rule.
Specifically, when the PIR in the room senses motion, wake the NsPanel screen.
My Reactions otherwise so far are basic If this then that so I'm way behind what others are doing.
What I want to call as a Reaction:
What I've tried (a few variations on):
What happens:
[latest-23063]2023-03-07T07:45:21.688Z <wsapi:ERR> wsapi: error thrown handling client message [Object]{ "command": "perform", "entity": "WOKHASS1>system", "action": "x_hass_system.call_service", "parameters": { "service": "ESPHome: nspensuite_send_command_printf", "data": "page home" }, "qid": 75 }
[latest-23063]2023-03-07T07:45:21.688Z <wsapi:CRIT> TypeError: Cannot read properties of null (reading '1') [-]
TypeError: Cannot read properties of null (reading '1')
at HassController.performOnEntity (C:\reactor\reactor\server\lib\HassController.js:584:108)
at System.perform (C:\reactor\reactor\server\lib\Entity.js:707:56)
at WSAPI.clientMessage (C:\reactor\reactor\server\wsapi\wsapi.js:499:48)
at WebSocket.<anonymous> (C:\reactor\reactor\server\wsapi\wsapi.js:290:158)
at WebSocket.emit (node:events:520:28)
at WebSocket.emit (node:domain:475:12)
at Receiver.receiverOnMessage (C:\reactor\reactor\node_modules\ws\lib\websocket.js:1059:20)
at Receiver.emit (node:events:520:28)
at Receiver.emit (node:domain:475:12)
at Receiver.dataMessage (C:\reactor\reactor\node_modules\ws\lib\receiver.js:517:14)
If someone can convert the 'call service' to a 'reaction' for me, or share their own similar thing I think that's what I need to achieve this goal.
I suspect if I'm even close to being on the right track, my problems are probably formatting like curly braces etc and lack thereof.
Thanks in advance.
So, following:
cd \path\to\reactor
node tools\install_reactor_windows_service.js -u .
del /s /f node_modules
npm rm -g node-windows
npm uninstall node-windows
npm uninstall -g node-windows
npm install -g node-windows@1.0.0-beta.6
npm link node-windows
...extract the Reactor.zip over the old directory...
node tools\install_reactor_windows_service.js -i .
I'm now running fine with Reactor (Multi-hub) stable-22136.
Thank you @toggledbits for your support and amazing product.
Bonus is the SSL now works too (CertifytheWeb with LetsEncrypt will renew it and drop the key files in the correct location). That means I can have Reactor as a tab in the Hass sidebar (previously https Hass --> http reactor would not work).
@toggledbits Thank you for the info and I'll try this later on and report back.
Note this is in the 'rolled back' state, not the 'wont start' state:
PS C:\reactor\reactor> npm ls
reactor-multi-system@1.0.3-22041 C:\reactor\reactor
+-- @influxdata/influxdb-client@1.23.0
+-- @mdi/font@5.9.55
+-- @popperjs/core@2.11.2
+-- body-parser@1.19.2
+-- bootstrap-icons@1.5.0
+-- bootstrap@4.6.1
+-- cookie@0.4.2
+-- digest-fetch@1.2.1
+-- diskusage-ng@1.0.2
+-- express@4.17.3
+-- feather-icons@4.28.0
+-- font-awesome@4.7.0
+-- gridstack@5.0.0
+-- jquery-ui-dist@1.13.1
+-- jquery@3.6.0
+-- js-yaml@3.14.1
+-- minimist@0.0.10 extraneous
+-- node-fetch@2.6.7
+-- node-stream-zip@1.15.0 extraneous
+-- node-windows@1.0.0-beta.6 extraneous
+-- nodemailer@6.7.2
+-- optimist@0.6.1 extraneous
+-- qs@6.10.3
+-- serve-static@1.14.2
+-- uuid@8.3.2
+-- wordwrap@0.0.3 extraneous
+-- ws@7.5.7
`-- xml@0.0.12 extraneous
PS C:\reactor\reactor>
Windows Server 2022 Build 20348
Nodejs v16.14.0
Currently running Reactor (Multi-hub) stable-22119-ae7212f
Linked to Hass 2022.0.5.4 (on a different box)
Windows server is dedicated to MSR and doesn't do anything else.
I'd like to upgrade to 22136 to take advantage of the SSL feature added recently, and also to bring my current version of Hass into the 'supported' column with MSR.
Following the instructions here: link text, section "Upgrade Windows Bare Metal"
Next step is to start the service. I start the service and it immediately stops. "Windows could not start the Reactor service on Local Computer. Error 1067: The process terminated unexpectedly".
Tried rebooting, service won't stay running.
I suspect I'm missing something, it's probably obvious but I've not been able to figure it out.
I rolled back the reactor folder version (Windows Shadow copies) and then the service starts fine.
Anyone else running Windows and know what I'm missing?
[stable-22119]2022-06-01T22:20:19.081Z <Rule:INFO> Lounge Billy Ambient Lighting - Turn On (Rule#rule-l0ki453b) evaluation complete
[stable-22119]2022-06-01T22:20:19.082Z <httpapi:NOTICE> HTTP API v1 22021 base URL http://172.16.128.6:8111; listening
[stable-22119]2022-06-01T22:20:19.228Z <app:NOTICE> HTTP server running; registering proxy endpoints.
[stable-22119]2022-06-01T22:20:19.228Z <app:NOTICE> Starting WSAPI...
[stable-22119]2022-06-01T22:20:19.229Z <wsapi:NOTICE> wsapi: starting version 21334
[stable-22119]2022-06-01T22:20:19.656Z <Engine:INFO> [Engine]Engine#1 master timer tick, local time "6/2/2022, 8:20:19 AM" (TZ offset 600 mins from UTC)
[stable-22119]2022-06-01T22:27:54.788Z <wsapi:INFO> wsapi: connection from ::ffff:172.16.128.5
[stable-22119]2022-06-01T22:20:19.081Z <Rule:INFO> Lounge Billy Ambient Lighting - Turn On (Rule#rule-l0ki453b) evaluation complete
[stable-22119]2022-06-01T22:20:19.082Z <httpapi:NOTICE> HTTP API v1 22021 base URL http://172.16.128.6:8111; listening
[stable-22119]2022-06-01T22:20:19.228Z <app:NOTICE> HTTP server running; registering proxy endpoints.
[stable-22119]2022-06-01T22:20:19.228Z <app:NOTICE> Starting WSAPI...
[stable-22119]2022-06-01T22:20:19.229Z <wsapi:NOTICE> wsapi: starting version 21334
[stable-22119]2022-06-01T22:20:19.656Z <Engine:INFO> [Engine]Engine#1 master timer tick, local time "6/2/2022, 8:20:19 AM" (TZ offset 600 mins from UTC)
[stable-22119]2022-06-01T22:27:54.788Z <wsapi:INFO> wsapi: connection from ::ffff:172.16.128.5
2022-06-02 08:19:23 - Stopping reactor.exe
2022-06-02 08:19:23 - ProcessKill 3628
2022-06-02 08:19:25 - Shutdown exception
Message:A system shutdown is in progress.
Stacktrace: at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Management.ManagementScope.InitializeGuts(Object o)
at System.Management.ManagementScope.Initialize()
at System.Management.ManagementObjectSearcher.Initialize()
at System.Management.ManagementObjectSearcher.Get()
at winsw.WrapperService.GetChildPids(Int32 pid)
at winsw.WrapperService.StopProcessAndChildren(Int32 pid)
at winsw.WrapperService.StopIt()
at winsw.WrapperService.OnShutdown()
2022-06-02 08:20:11 - Starting C:\Program Files\nodejs\node.exe C:\reactor\reactor\node_modules\node-windows\lib\wrapper.js --file C:\reactor\reactor\app.js --scriptoptions= --log "Reactor wrapper" --grow 0.25 --wait 1 --maxrestarts 3 --abortonerror n --stopparentfirst undefined
2022-06-02 08:20:11 - Started 3272
2022-06-02 08:30:54 - Stopping reactor.exe
2022-06-02 08:30:54 - ProcessKill 3272
2022-06-02 08:30:54 - Found child process: 3280 Name: conhost.exe
2022-06-02 08:30:54 - Found child process: 3504 Name: node.exe
2022-06-02 08:30:54 - Stopping process 3280
2022-06-02 08:30:54 - Send SIGINT 3280
2022-06-02 08:30:54 - SIGINT to 3280 failed - Killing as fallback
2022-06-02 08:30:54 - Stopping process 3504
2022-06-02 08:30:54 - Send SIGINT 3504
2022-06-02 08:30:54 - SIGINT to 3504 failed - Killing as fallback
2022-06-02 08:30:54 - Stopping process 3272
2022-06-02 08:30:54 - Send SIGINT 3272
2022-06-02 08:30:54 - SIGINT to 3272 failed - Killing as fallback
2022-06-02 08:30:54 - Finished reactor.exe
2022-06-02 08:33:41 - Starting C:\Program Files\nodejs\node.exe C:\reactor\reactor\node_modules\node-windows\lib\wrapper.js --file C:\reactor\reactor\app.js --scriptoptions= --log "Reactor wrapper" --grow 0.25 --wait 1 --maxrestarts 3 --abortonerror n --stopparentfirst undefined
2022-06-02 08:33:41 - Started 4184
2022-06-02 08:36:57 - Starting C:\Program Files\nodejs\node.exe C:\reactor\reactor\node_modules\node-windows\lib\wrapper.js --file C:\reactor\reactor\app.js --scriptoptions= --log "Reactor wrapper" --grow 0.25 --wait 1 --maxrestarts 3 --abortonerror n --stopparentfirst undefined
2022-06-02 08:36:57 - Started 3100
Child process [4184 - C:\Program Files\nodejs\node.exe C:\reactor\reactor\node_modules\node-windows\lib\wrapper.js --file C:\reactor\reactor\app.js --scriptoptions= --log "Reactor wrapper" --grow 0.25 --wait 1 --maxrestarts 3 --abortonerror n --stopparentfirst undefined] finished with 1
Details of runtime environment:
A complete description of your objective:
A description of your approach/solution/implementation so far:
Actual Question:
The reason I want to achieve this, other than the general goodness of having everything I can in TLS is that I have Reactor as an IFRAME in my HASS console and as HASS is HTTPS and Reactor is HTTP then the iframe refuses to open.
Search for "certificate" or "ssl" did not reveal anything relevant in this forum.