Emulated Wemo Switch Flakey, Alexa communicates perfectly

I have a NodeMCU running 4 emulated Wemo switches (on separate ports) that was working fine for the longest time with Hassio 88.1. I’ve always had to reboot Hassio several times for it to discover all 4 devices, but it recently stopped finding them. When I pot the NodeMCU on the serial monitor after adding debug print lines, I can see that the 4 devices each respond to Alexa fine. But although Home Assistant gets through setup.xml fine (no errors in the log), it goes back to query the state of the first device and simply repeats the query every 10 seconds to the same device. So none of the devices are listed in the states or entity list.

With the debug println statements, I see a difference in the request structure for getbinarystate. on the Alexa requests I see:

<?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:GetBinaryState xmlns:u=“urn:Belkin:service:basicevent:1”>1</u:GetBinaryState></s:Body></s:Envelope>

From Home Assistant I see:

<s:Envelope xmlns:s=“http://schemas.xmlsoap.org/soap/envelope/” s:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”>
<u:GetBinaryState xmlns:u=“urn:Belkin:service:basicevent:1”>


I see that many people have issues with flakey Wemo performance and I’m wondering how to go about fixing this to see of that’s the problem (or part of it anyway). I can’t find any of the python scripts on my RasPi version of Hassio and was planning to look at the wemo.py script.

Has anyone noticed this problem before? Can someone tell me how to find the python scripts on the Raspi? I use Putty and login as root but I cant seem to find the python3.7 directory.

Help with this (either the emulated wemo switch or the Hassio wemo integration) problem is very much appreciated. Why it even stopped working while Alexa runs fine is beyond me and so far this is the only difference I see. My configuration file has not changed - I use static ip addresses for the wemo switches. I even reloaded my last working snapshot of Hassio but nothing changes.

Also, the response is exactly the same to Alexa and Hassio:

<s:Envelope xmlns:s=“http://schemas.xmlsoap.org/soap/envelope/” s:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”><s:Body><u:GetBinaryStateResponse xmlns:u=“urn:Belkin:service:basicevent:1”>1</u:GetBinaryStateResponse></s:Body></s:Envelope>

But Hassio keeps sending the getbinarystate command repeatedly and never registers the devices.

Thanks Very much.