dhleong / wemore

A more awesome library for Belkin WeMo interactions
37 stars 12 forks source link

emulated device not controllable #6

Closed stfnhmplr closed 6 years ago

stfnhmplr commented 6 years ago

Hi! First of all thank you for this great library. The control of an emulated device works great with alexa. However, the device is shown as not controllable in the Control+ App (iOS). Any idea why?

dhleong commented 6 years ago

Not familiar with that app, but possibly it works like Google Home and only recognizes those devices which can be controlled through Wemo's cloud service. I'd be very interested in supporting that, but I'm not sure where to begin.

Do the emulated devices even show up in the Control+ app?

stfnhmplr commented 6 years ago

Yes, they show up. It might be due to a missing XML node. I mailed the developer of the app already, but didn't get any response yet. Can you send me a complete XML from a switch as example? So I could test wether it's a missing node.

fullsizeoutput_99f9

dhleong commented 6 years ago

The XML is built from JSON here:

https://github.com/dhleong/wemore/blob/master/lib/emulate.js#L146

dhleong commented 6 years ago

And here's some XML I generated just now:

<?xml version="1.0"?>
<root xmlns="urn:Belkin:device-1-0">
    <specVersion>
        <major>1</major>
        <minor>0</minor>
    </specVersion>
    <device>
        <deviceType>urn:Belkin:device:controllee:1</deviceType>
        <binaryState>0</binaryState>
        <friendlyName>Test</friendlyName>
        <manufacturer>Belkin International Inc.</manufacturer>
        <manufacturerURL>http://github.com/dhleong</manufacturerURL>
        <modelDescription>Wemore Emulated Socket</modelDescription>
        <modelName>Socket</modelName>
        <modelNumber>1</modelNumber>
        <modelURL>http://github.com/dhleong/wemore</modelURL>
        <serialNumber>000001F0101C00</serialNumber>
        <UDN>000001F0101C00</UDN>
        <UPC>123456789</UPC>
        <serviceList>
            <service>
                <serviceType>urn:Belkin:service:basicevent:1</serviceType>
                <serviceId>urn:Belkin:serviceId:basicevent1</serviceId>
                <controlURL>/upnp/control/basicevent1</controlURL>
                <eventSubURL>/upnp/event/basicevent1</eventSubURL>
                <SCPDURL>/eventservice.xml</SCPDURL>
            </service>
        </serviceList>
    </device>
</root>
stfnhmplr commented 6 years ago

I know the XML which is generated. But I have none of an original Wemo Switch.

dhleong commented 6 years ago

Ah, okay. I was able to SSH into my home box and come up with this:

<?xml version="1.0"?>
<root xmlns="urn:Belkin:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <device>
<deviceType>urn:Belkin:device:controllee:1</deviceType>
<friendlyName>Lights </friendlyName>
    <manufacturer>Belkin International Inc.</manufacturer>
    <manufacturerURL>http://www.belkin.com</manufacturerURL>
    <modelDescription>Belkin Plugin Socket 1.0</modelDescription>
<modelName>Socket</modelName>
    <modelNumber>1.0</modelNumber>
    <modelURL>http://www.belkin.com/plugin/</modelURL>
<serialNumber>redacted</serialNumber>
<UDN>uuid:Socket-1_0-221332K0101C68</UDN>
    <UPC>123456789</UPC>
<macAddress>EC1A59EC025C</macAddress>
<firmwareVersion>WeMo_WW_2.00.9896.PVT-OWRT-SNS</firmwareVersion>
<iconVersion>0|49154</iconVersion>
<binaryState>0</binaryState>
    <iconList>
      <icon>
        <mimetype>jpg</mimetype>
        <width>100</width>
        <height>100</height>
        <depth>100</depth>
         <url>icon.jpg</url>
      </icon>
    </iconList>
    <serviceList>
      <service>
        <serviceType>urn:Belkin:service:WiFiSetup:1</serviceType>
        <serviceId>urn:Belkin:serviceId:WiFiSetup1</serviceId>
        <controlURL>/upnp/control/WiFiSetup1</controlURL>
        <eventSubURL>/upnp/event/WiFiSetup1</eventSubURL>
        <SCPDURL>/setupservice.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:Belkin:service:timesync:1</serviceType>
        <serviceId>urn:Belkin:serviceId:timesync1</serviceId>
        <controlURL>/upnp/control/timesync1</controlURL>
        <eventSubURL>/upnp/event/timesync1</eventSubURL>
        <SCPDURL>/timesyncservice.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:Belkin:service:basicevent:1</serviceType>
        <serviceId>urn:Belkin:serviceId:basicevent1</serviceId>
        <controlURL>/upnp/control/basicevent1</controlURL>
        <eventSubURL>/upnp/event/basicevent1</eventSubURL>
        <SCPDURL>/eventservice.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:Belkin:service:firmwareupdate:1</serviceType>
        <serviceId>urn:Belkin:serviceId:firmwareupdate1</serviceId>
        <controlURL>/upnp/control/firmwareupdate1</controlURL>
        <eventSubURL>/upnp/event/firmwareupdate1</eventSubURL>
        <SCPDURL>/firmwareupdate.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:Belkin:service:rules:1</serviceType>
        <serviceId>urn:Belkin:serviceId:rules1</serviceId>
        <controlURL>/upnp/control/rules1</controlURL>
        <eventSubURL>/upnp/event/rules1</eventSubURL>
        <SCPDURL>/rulesservice.xml</SCPDURL>
      </service>

      <service>
        <serviceType>urn:Belkin:service:metainfo:1</serviceType>
        <serviceId>urn:Belkin:serviceId:metainfo1</serviceId>
        <controlURL>/upnp/control/metainfo1</controlURL>
        <eventSubURL>/upnp/event/metainfo1</eventSubURL>
        <SCPDURL>/metainfoservice.xml</SCPDURL>
      </service>

      <service>
        <serviceType>urn:Belkin:service:remoteaccess:1</serviceType>
        <serviceId>urn:Belkin:serviceId:remoteaccess1</serviceId>
        <controlURL>/upnp/control/remoteaccess1</controlURL>
        <eventSubURL>/upnp/event/remoteaccess1</eventSubURL>
        <SCPDURL>/remoteaccess.xml</SCPDURL>
      </service>

      <service>
        <serviceType>urn:Belkin:service:deviceinfo:1</serviceType>
        <serviceId>urn:Belkin:serviceId:deviceinfo1</serviceId>
        <controlURL>/upnp/control/deviceinfo1</controlURL>
        <eventSubURL>/upnp/event/deviceinfo1</eventSubURL>
        <SCPDURL>/deviceinfoservice.xml</SCPDURL>
      </service>

      <service>
        <serviceType>urn:Belkin:service:smartsetup:1</serviceType>
        <serviceId>urn:Belkin:serviceId:smartsetup1</serviceId>
        <controlURL>/upnp/control/smartsetup1</controlURL>
        <eventSubURL>/upnp/event/smartsetup1</eventSubURL>
        <SCPDURL>/smartsetup.xml</SCPDURL>
      </service>

      <service>
        <serviceType>urn:Belkin:service:manufacture:1</serviceType>
        <serviceId>urn:Belkin:serviceId:manufacture1</serviceId>
        <controlURL>/upnp/control/manufacture1</controlURL>
        <eventSubURL>/upnp/event/manufacture1</eventSubURL>
        <SCPDURL>/manufacture.xml</SCPDURL>
      </service>

    </serviceList>
   <presentationURL>/pluginpres.html</presentationURL>
</device>
</root>
dhleong commented 6 years ago

@stfnhmplr I just released v0.4.0 with PR #7. That seems to improve compatibility with another smart home system, so it might fix things for you as well.

stfnhmplr commented 6 years ago

Device is now controllable with homee. That's even better than the control+ app. So i'll close this. Thanks.