Smarthome: WeMo: Throws UnsupportedCharsetException during discovery

Created on 30 Aug 2016  路  17Comments  路  Source: eclipse-archived/smarthome

I have problems discovering WeMo LED bulbs. The insight-switch works fine!

Steps to reproduce

  • Add WeMo Binding
  • Install an WeMo Link Device
  • Apply the WeMo Link Device on inbox
  • Start discovery on WeMo Link

Error
No device (e.g. LED bulb) found.

Error-Log:

2016-08-30 12:44:44.795 [DEBUG] [nternal.DiscoveryServiceRegistryImpl] - Triggering scan for thing types '[wemo:lightswitch, wemo:Maker, wemo:bridge, wemo:socket, wemo:MZ100, wemo:motion, wemo:insight]' on 'UpnpDiscoveryService'...
2016-08-30 12:44:44.796 [DEBUG] [o.discovery.WemoDiscoveryParticipant] - Discovered a WeMo Bridge thing with UDN 'Bridge-1_0-231447B0100A09'
2016-08-30 12:44:44.796 [DEBUG] [o.discovery.WemoDiscoveryParticipant] - Created a DiscoveryResult for device 'WeMo Link' with UDN 'Bridge-1_0-231447B0100A09'
2016-08-30 12:44:44.797 [DEBUG] [g.discovery.internal.PersistentInbox] - Discovery result with thing 'wemo:bridge:Bridge-1_0-231447B0100A09' not added as inbox entry. It is already present as thing in the ThingRegistry.
2016-08-30 12:44:49.638 [DEBUG] [lipse.smarthome.io.net.http.HttpUtil] - About to execute http://10.20.31.155:49153/upnp/control/bridge1
2016-08-30 12:44:49.681 [ERROR] [lipse.smarthome.io.net.http.HttpUtil] - Fatal transport error: java.nio.charset.UnsupportedCharsetException: "utf-8"
2016-08-30 12:44:49.797 [DEBUG] [est.core.discovery.DiscoveryResource] - Scan for binding 'wemo' successfully finished.

The cause could be the replacement of Apache HTTP Client through Jetty client.
@hmerk: Do you get the same error?

Binding-Wemo

Most helpful comment

Yes, WeMo does not seem to be conform to HTTP specs (and neither to UPnP specs as we already know...)

I have improved the handling of such responses in HttpUtil with https://github.com/eclipse/smarthome/pull/2179, which should solve this issue.

All 17 comments

@chrisschauer I did not update to the latest snapshots, therefore did not see this.
I will check and try to fix asap.

@chrisschauer
I now can confirm that the Jetty client causes this issue. Unfortunately, there is no straight option to set a chartset for the contentype.
I will file an issue to address this in the right place.

@hmerk
Thanks for investigating this issue

@hmerk
I just saw, the content-type is defined as
static String contentHeader = "text/xml; charset=\"utf-8\"";
https://github.com/eclipse/smarthome/blob/master/extensions/binding/org.eclipse.smarthome.binding.wemo/src/main/java/org/eclipse/smarthome/binding/wemo/internal/http/WemoHttpCall.java#L25

The Charset is defined with double quotes. I think http content-types are defined without quotes? Could this be the cause?

Yes, WeMo does not seem to be conform to HTTP specs (and neither to UPnP specs as we already know...)

I have improved the handling of such responses in HttpUtil with https://github.com/eclipse/smarthome/pull/2179, which should solve this issue.

@chrisschauer #2179 has been merged 24 days ago. Is the problem solved now?

Hi @maggu2810
I will retest it today. Thanks for your ping. If it's solved i will close the ticket

Sorry @maggu2810 for keep this issue open for a long time.
I have retested the issue. The exception does not occur anymore. WeMo Link discovery does not work, but i'll create a ticket for that issue. thx

No problem, thank you for testing it again.

@chrisschauer I just checked the latest version in my IDE and can confirm that discovery is working as expected. My WeMo Link was dicovered and after adding it as a thing, all my WeMo LED bulbs appeard in inbox.

I just tested the snapshot version of the binding from yesterday's build. The WeMo Link can be successfully discovered and added. The discovery is started, but does not create an discoveryResult.

Here are the logs...

2016-10-11 16:50:37.123 [DEBUG] [b.w.d.WemoDiscoveryParticipant:103  ] - Discovered a WeMo Bridge thing with UDN 'Bridge-1_0-231447B0100A09'
2016-10-11 16:50:37.123 [DEBUG] [b.w.d.WemoDiscoveryParticipant:59   ] - Created a DiscoveryResult for device 'WeMo Link' with UDN 'Bridge-1_0-231447B0100A09'
2016-10-11 16:50:37.124 [INFO ] [rthome.event.InboxUpdatedEvent:43   ] - Discovery Result with UID 'wemo:socket:Socket-1_0-221605K110034A' has been updated.
2016-10-11 16:50:37.124 [DEBUG] [s.c.d.internal.PersistentInbox:194  ] - Discovery result with thing 'wemo:bridge:Bridge-1_0-231447B0100A09' not added as inbox entry. It is already present as thing in the ThingRegistry.
2016-10-11 16:50:41.845 [TRACE] [b.w.d.WemoLinkDiscoveryService:116  ] - Starting WeMoEndDevice discovery on WeMo Link wemo:bridge:Bridge-1_0-231447B0100A09
2016-10-11 16:50:41.845 [TRACE] [b.w.d.WemoLinkDiscoveryService:120  ] - devUDN = 'uuid:Bridge-1_0-231447B0100A09'
2016-10-11 16:50:41.874 [DEBUG] [smarthome.io.net.http.HttpUtil:215  ] - About to execute http://10.20.31.162:49153/upnp/control/bridge1
2016-10-11 16:50:41.926 [TRACE] [smarthome.io.net.http.HttpUtil:231  ] - 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <s:Body>
    <u:GetEndDevicesResponse xmlns:u="urn:Belkin:service:bridge:1"><DeviceLists><?xml version="1.0" encoding="utf-8"?>
    <DeviceLists>
        <DeviceList>
            <DeviceListType>Paired</DeviceListType>
            <DeviceInfos>
                <DeviceInfo>
                    <DeviceIndex>0</DeviceIndex>
                    <DeviceID>94103EA2B2789877</DeviceID
                    ><FriendlyName>Lightbulb 01</FriendlyName>
                    <IconVersion>1</IconVersion>
                    <FirmwareVersion>83</FirmwareVersion>
                    <CapabilityIDs>10006,10008,30008,30009,3000A</CapabilityIDs>
                    <CurrentState>1,255:0,,,</CurrentState>
                    <Manufacturer>Unknown</Manufacturer>
                    <ModelCode>MZ100</ModelCode>
                    <productName>Lighting</productName>
                    <WeMoCertified>YES</WeMoCertified>
                </DeviceInfo>
            </DeviceInfos>
        </DeviceList>
    </DeviceLists>
    </DeviceLists></u:GetEndDevicesResponse></s:Body> 
</s:Envelope>
2016-10-11 16:50:41.926 [TRACE] [b.w.d.WemoLinkDiscoveryService:138  ] - endDeviceRequest answered '
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:GetEndDevicesResponse xmlns:u="urn:Belkin:service:bridge:1"><DeviceLists><?xml version="1.0" encoding="utf-8"?>
    <DeviceLists>
        <DeviceList>
            <DeviceListType>Paired</DeviceListType>
            <DeviceInfos>
                <DeviceInfo>
                    <DeviceIndex>0</DeviceIndex>
                    <DeviceID>94103EA2B2789877</DeviceID>
                    <FriendlyName>Lightbulb 01</FriendlyName>
                    <IconVersion>1</IconVersion>
                    <FirmwareVersion>83</FirmwareVersion>
                    <CapabilityIDs>10006,10008,30008,30009,3000A</CapabilityIDs>
                    <CurrentState>1,255:0,,,</CurrentState>
                    <Manufacturer>Unknown</Manufacturer>
                    <ModelCode>MZ100</ModelCode>
                    <productName>Lighting</productName>
                    <WeMoCertified>YES</WeMoCertified>
                </DeviceInfo>
            </DeviceInfos>
        </DeviceList>
    </DeviceLists>
</DeviceLists></u:GetEndDevicesResponse></s:Body> </s:Envelope>'
2016-10-11 17:29:21.069 [TRACE] [e.s.storage.mapdb.MapDbStorage:154  ] - deserialized value 'DiscoveryResult [thingUID=wemo:socket:Socket-1_0-221605K110034A, properties={udn=Socket-1_0-221605K110034A}, flag=NEW, label=WeMo Switch, bridgeUID=null, ttl=-1, timestamp=1476199756069]' from MapDB
2016-10-11 17:29:21.069 [DEBUG] [.e.s.i.r.c.d.DiscoveryResource:90   ] - Scan for binding 'wemo' successfully finished

Strange, i will give it a try as well to see the diference between snapshot and my ide.

@chrisschauer
I just downloaded Offline Snapshot 527 and can not reproduce your error on my Windows10 machine. Lightbulbs are discovered as expected.

@hmerk
Thanks for trying to reproduce the issue. I'll do a debugging session during the next days with latest sources in eclipse IDE.

@chrisschauer Please feel free to ping me directly if you find any problem.

@hmerk Sorry. Now all works without issues. All LED bulbs are discovered. I don't know why it was not working the last time... :-) Thx

馃憤

Was this page helpful?
0 / 5 - 0 ratings