Issue with HTTP API
-
Hello @toggledbits I have a strange issue with the HTTP request that i send to Reactor.
I have two reactors one on a Unraid server and one on Ubuntu server installed as a docker, when i send http get request to the Unraid server to control home assistant entity everything is going ok, but when i send the same request to the ubuntu modified accordingly it says "Request failed" but when i try to run reaction via http request it works.When i go to entities and try to control the entity manually its working.
Any idea's?
Best regards
-
First, you need to show your work (per the posting guidelines). That means showing the reactions, and the requests, and the responses to the requests, and describe how you are making the requests (
curl
, etc.-- what is the "it" that is giving you "Request failed"). If the requests are being made in Reactor, what is being logged?Second, I find this statement contradictory, and it needs clarification:
when i send the same request to the ubuntu modified accordingly it says "Request failed" but when i try to run reaction via http request it works.
Please update your original post.
-
Hello @toggledbits im trying to control reactor from external source, for this example i'm using web browser.
(this is example for the docker installation on ubuntu server)
When i hit a web page http://192.168.0.39:8111/api/v1/entity/hass_container>climate_vivax/perform/hvac_heating_unit.set_setpoint?setpoint=26
i get a response
'Request failed'
and the action is not executedWhen i hit a web page http://192.168.0.39:8111/api/v1/reaction/re-lb1bejbo/run
i get response
{"status":true,"message":"Vivax Off started"}
and the action is executedOn the unraid server docker installation when i hit http://192.168.0.81:8111/api/v1/entity/hass>climate_vivax/perform/hvac_heating_unit.set_setpoint?setpoint=26
i recieve a response
{"status":true,"message":"Performed hvac_heating_unit.set_setpoint on Thermostat#hass>climate_vivax"}
and the action is executedwhen i hit http://eonnet.duckdns.org:8112/api/v1/entity/hass>climate_vivax/perform/hvac_control.set_mode?mode=off
i recieve a response
{"status":true,"message":"Performed hvac_control.set_mode on Thermostat#hass>climate_vivax"}
and the action is executed.Best regards
-
I tried tonight with curl and postman i get the same response
request failed
no further info.... this is only happening when i try to make a request to entity.I also tried to make a reaction with the http request to reactor and the response is:
Reaction "re-lb2sork5" (re-lb2sork5) step 1 http request failed
Error: HTTP request failed: 400 Bad RequestI hope this gives you more info
-
What did you find in the reactor.log file?
-
What did you find in the reactor.log file?
@toggledbits here is the log
[latest-22328]2022-11-30T19:58:30.832Z httpapi:ERR httpapi: perform hvac_heating_unit.set_setpoint on Thermostat#hass>climate_vivax failed: [TypeError]Typ>
[latest-22328]2022-11-30T19:58:30.834Z httpapi:CRIT TypeError: Type mismatch on config reactor.engine.monitored_entities, expecting array, got object
TypeError: Type mismatch on config reactor.engine.monitored_entities, expecting array, got object
at Configuration.getConfig (/opt/reactor/server/lib/Configuration.js:163:23)
at Function.getConfig (/opt/reactor/server/lib/Configuration.js:151:82)
at HTTPAPI._handlePerformRequest (/opt/reactor/server/lib/httpapi.js:834:56)
at /opt/reactor/server/lib/httpapi.js:396:61
at Layer.handle [as handle_request] (/opt/reactor/node_modules/express/lib/router/layer.js:95:5)
at next (/opt/reactor/node_modules/express/lib/router/route.js:144:13)
at Route.dispatch (/opt/reactor/node_modules/express/lib/router/route.js:114:3)
at Layer.handle [as handle_request] (/opt/reactor/node_modules/express/lib/router/layer.js:95:5)
at /opt/reactor/node_modules/express/lib/router/index.js:284:15
at param (/opt/reactor/node_modules/express/lib/router/index.js:365:14)and another on with different request
[latest-22328]2022-11-30T20:02:22.335Z httpapi:ERR httpapi: perform hvac_control.set_mode on Thermostat#hass>climate_vivax failed: [TypeError]TypeError: T>
[latest-22328]2022-11-30T20:02:22.336Z httpapi:CRIT TypeError: Type mismatch on config reactor.engine.monitored_entities, expecting array, got object
TypeError: Type mismatch on config reactor.engine.monitored_entities, expecting array, got object
at Configuration.getConfig (/opt/reactor/server/lib/Configuration.js:163:23)
at Function.getConfig (/opt/reactor/server/lib/Configuration.js:151:82)
at HTTPAPI._handlePerformRequest (/opt/reactor/server/lib/httpapi.js:834:56)
at /opt/reactor/server/lib/httpapi.js:396:61
at Layer.handle [as handle_request] (/opt/reactor/node_modules/express/lib/router/layer.js:95:5)
at next (/opt/reactor/node_modules/express/lib/router/route.js:144:13)
at Route.dispatch (/opt/reactor/node_modules/express/lib/router/route.js:114:3)
at Layer.handle [as handle_request] (/opt/reactor/node_modules/express/lib/router/layer.js:95:5)
at /opt/reactor/node_modules/express/lib/router/index.js:284:15
at param (/opt/reactor/node_modules/express/lib/router/index.js:365:14) -
OK. It looks like you've formatted your
monitored_entities
configuration incorrectly on that Reactor install. That seems to be the error. Either remove that section, or review the documentation and get it fixed. -
@toggledbits yes that was the problem, thanks on the fix.
Best regards
-
T toggledbits locked this topic on