HomeyScript XML SOAP

Hi,
Is it possible to post XML SOAP from the HomeyScript app with JavaScript?
Just need it for a sending a “wake up” to my sat receiver.

Regards
Patrik

Or if there is someone how can make an app with this.

POST /upnpfun/ctrl/uuid_1586d400-1dd2-11b2-8862-e8f2e2b2314c/04 HTTP/1.1
Host: <ip_of_device>:8080
Content-Type: text/xml
SOAPACTION: “urn:adbglobal.com:service:X_ADB_RemoteControl:1#ProcessInputEvent”
Cache-Control: no-cache
Postman-Token: 72423203-45e2-4665-9173-44fc59179e5b

<s:Envelope s:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/” xmlns:s=“http://schemas.xmlsoap.org/soap/envelope/”>
<s:Body>
<u:ProcessInputEvent xmlns:u=“urn:adbglobal.com:service:X_ADB_RemoteControl:1”>
code=115
</u:ProcessInputEvent>
</s:Body>
</s:Envelope>

The different input code translation:
116 => “POWER”
, 174 => “HOME”
, 361 => “VOD”
, 365 => “EPG”
, 367 => “APP”
, 395 => “LIST”
, 114 => “VOL-”
, 113 => “MUTE”
, 115 => “VOL+”
, 103 => “UP”
, 108 => “DOWN”
, 105 => “LEFT”
, 352 => “OK”
, 106 => “RIGHT”
, 357 => “OPT”
, 358 => “INFO”
, 402 => “PROG+”
, 403 => “PROG-”
, 158 => “BACK”
, 385 => “RADIO”
, 102 => “PORTAL”
, 388 => “TEXT”
, 398 => “RED”
, 399 => “GREEN”
, 400 => “YELLOW”
, 401 => “BLUE”
, 128 => “STOP”
, 207 => “PLAY”
, 119 => “PAUSE”
, 167 => “REC”
, 168 => “<<”
, 159 => “>>”
, 2 => “[1]”
, 3 => “[2]”
, 4 => “[3]”
, 5 => “[4]”
, 6 => “[5]”
, 7 => “[6]”
, 8 => “[7]”
, 9 => “[8]”
, 10 => “[9]”
, 11 => “[0]”];

Hi Patrik, good question, I’m also looking for a way to send a GET or POST request from Homey to in my case an Ethernet Power Relay

Hope someone has an idea how to do this; I’m trying to write an app and will than try to use normal javascript, see if that works, will let you know

Chris

Here https://apps.athom.com/app/com.athom.homeyscript it says that HomeyScript supports fetch; with that you should be able to do a POST

Chris

Thanks Chris, will look in to that.
If you have made any script please share them so I can get an example.

Regards
Patrik

I use this in a HomeyScript to get some JSON-data from a rooted Eneco Toon, for use in a flow:

var url = "http://192.168.1.30/happ_thermstat?action=getThermostatInfo";
(async () => {
     const rawResponse = await fetch(url, {
    method: 'GET',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    },
  });
  const content = await rawResponse.json();
 //console.log(content);

  if (content.currentTemp !== null && content.currentTemp != '') {
    var currentTemp = content.currentTemp/100;
    var setTemp = content.currentSetpoint/100;
    var states = Array("Comfort", "Thuis", "Slapen", "Weg");
    var state = states[content.activeState];
    if (content.activeState == -1) {
      state = "Not Set";
    }
    await setTagValue("toon_current", {type: "number", title: "Temperatuur op Toon®"}, currentTemp);
    await setTagValue("toon_set", {type: "number", title: "Ingestelde temp. op Toon®"}, setTemp);
    await setTagValue("toon_status", {type: "string", title: "Status op Toon®"}, state);
  }
})();
return true;
2 Likes

Sorry I’ve been busy with other stuff; I just did this to control a LAN relay that will eventually control my ventilation valves and heating valves. Works fine from HomeyScript; I have not tried it from an compiled with the SDK.

var command = ‘http://192.168.2.50/FF0100’;

fetch(command)
.then(function(response) {
return response.text();
})
.then(function(data) {
console.log(data);
})