The first step was figuring out how to control the boiler via the Wemo socket. Communication between the phone and the Wemo uses XML over HTTP (SOAP) on two possible ports: 49153 and 49154.
La première étape était de comprendre comment contrôler la chaudière via la prise Wemo. La communication entre le téléphone et la Wemo utilise du XML sur HTTP (SOAP) sur deux ports possibles : 49153 et 49154.
Switch the Wemo on/off
Allumer/éteindre la Wemo
Send this SOAP payload with action header Belkin:service:basicevent:1#SetBinaryState (use 0 to switch off):
Envoyer ce corps SOAP avec l'en-tête d'action Belkin:service:basicevent:1#SetBinaryState (mettre 0 pour éteindre) :
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1">
<BinaryState>1</BinaryState>
</u:SetBinaryState>
</s:Body>
</s:Envelope>In PHP via cURL:
En PHP via cURL :
$server = "http://192.168.0.35";
$ports = [49153, 49154];
$headers = [
"Content-type: text/xml;charset=\"utf-8\"",
"SOAPACTION: \"urn:Belkin:service:basicevent:1#SetBinaryState\""
];
$post = '<?xml ...><BinaryState>1</BinaryState>...';
// Send via cURL to $server:$port/upnp/control/basicevent1Read current state
Lire l'état actuel
Use action Belkin:service:basicevent:1#GetBinaryState, probe both ports, parse the BinaryState byte: 0 = off, 1 = on.
Utiliser l'action Belkin:service:basicevent:1#GetBinaryState, tester les deux ports, parser l'octet BinaryState : 0 = éteint, 1 = allumé.