jimmywarting / wemo-client

JavaScript client library for controlling and subscribing to Wemo Devices
MIT License
132 stars 40 forks source link

Setting binary state to on/off when already on/off #28

Closed InsidersByte closed 8 years ago

InsidersByte commented 8 years ago

when calling to set a wemo switch to on/off when it is already on/off this is returned in the response

{  
   '$':{  
      'xmlns:u':'urn:Belkin:service:basicevent:1'
   },
   BinaryState:'Error'
}

I was expecting something like

{  
   '$':{  
      'xmlns:u':'urn:Belkin:service:basicevent:1'
   },
   BinaryState:'1',
   CountdownEndTime:'0',
   deviceCurrentTime:'1456524582'
}

shouldn't this be handled as an error and as such passed back in the error callback?

timonreinhard commented 8 years ago

This is not an error from the perspective of this client library: The setBinaryState action has been sent and a valid response was received from the device, which means the method was successful. If you need to further work with the result of the request you would do so in your application or in some device abstraction layer.

InsidersByte commented 8 years ago

If this is not an error in terms of this library, wouldn't it be useful to people using this library if it was documented that this could response could be returned?

timonreinhard commented 8 years ago

You're invited to add some notes about this to the wiki page which already states some known Wemo oddities: https://github.com/timonreinhard/wemo-client/wiki

I'm also happy to add this to the README, just file a pull request in that case.