Hi,
I have a ethernet webrelay (WebRelay | Ethernet Relay | Remote Relay Control) that opens my front door.
To open the door I simply have to open a browser and type in:
http://192.168.10.224:10359/state.xml?relayState=2&pulseTime=5
After filling-in the credentials the door opens.
I try to do the same from node-red.
I have 4 nodes:
- 1 injector
- 1 change node
- 1 http request node
- 1 HA node to check the status of my door.
Here is the code:
[{"id":"994311c7.7445d8","type":"inject","z":"2e0bd4f.934d72c","name":"Unlock door","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":210,"y":240,"wires":[["49d1e033.fff5f8"]]},{"id":"430d6a4c.b6affc","type":"http request","z":"2e0bd4f.934d72c","name":"Query","method":"GET","ret":"txt","paytoqs":"body","url":"","tls":"","persist":false,"proxy":"","authType":"","x":730,"y":240,"wires":[["702c1d7b.69dbd4"]]},{"id":"49d1e033.fff5f8","type":"change","z":"2e0bd4f.934d72c","name":"Prep login","rules":[{"t":"set","p":"headers.content-type","pt":"msg","to":"text/html; charset=UTF-8","tot":"str"},{"t":"set","p":"queryDate","pt":"msg","to":"$now()","tot":"jsonata"},{"t":"set","p":"headers.authorization","pt":"msg","to":"Basic ThisIsMyBase64String","tot":"str"},{"t":"set","p":"url","pt":"msg","to":"http://192.168.10.224:10359/state.xml?relayState=2&pulseTime=5","tot":"str"},{"t":"set","p":"headers.content-length","pt":"msg","to":"3495","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":240,"wires":[["430d6a4c.b6affc"]]},{"id":"702c1d7b.69dbd4","type":"api-current-state","z":"2e0bd4f.934d72c","name":"Door Open?","server":"52cfa5eb.37210c","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.alarm_contact_entree","state_type":"str","state_location":"doorOpen","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":950,"y":220,"wires":[[],[]]},{"id":"52cfa5eb.37210c","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
As such, the flow opens the door but I get an error and the flow stops just after the http request.
I tried unsuccessfully all sort of combinations in order to remove this error message.
Now I am stuck and would appreciate some help.
Thanks.
Sined