Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

WeMo LED Light / WeMo Link #51

Closed
fritz-fritz opened this issue Oct 22, 2014 · 24 comments
Closed

WeMo LED Light / WeMo Link #51

fritz-fritz opened this issue Oct 22, 2014 · 24 comments
Milestone

Comments

@fritz-fritz
Copy link
Contributor

Unfortunately it seems these (and other new wemo devices) are not yet supported.

It would be great to have ouimeaux be able to interact with the new WeMo LED Lights by using the Link much as I assume the wemo app communicates to them.

@iancmcc
Copy link
Owner

iancmcc commented Oct 22, 2014

Just ordered a set. Guess my weekend is now spoken for. 

— Ian

On Tue, Oct 21, 2014 at 10:20 PM, FRITZ|FRITZ notifications@github.com
wrote:

Unfortunately it seems these (and other new wemo devices) are not yet supported.

It would be great to have ouimeaux be able to interact with the new WeMo LED Lights by using the Link much as I assume the wemo app communicates to them.

Reply to this email directly or view it on GitHub:
#51

@fritz-fritz
Copy link
Contributor Author

awesome can't wait to have that up and running!

@jescarri
Copy link

jescarri commented Dec 5, 2014

Does anyone had a chance to integrate the WeMo Link to ouimeaux?
I'm new to its code base, buy I can help to implement it.
Any ideas where to start?

@iancmcc
Copy link
Owner

iancmcc commented Dec 5, 2014

I have a start, but the API isn't responding to requests, so my next step is to fire up wireshark and watch requests to figure out what's missing.

On Thu, Dec 4, 2014 at 10:53 PM, Jesus Rafael Carrillo
notifications@github.com wrote:

Does anyone had a chance to integrate the WeMo Link to ouimeaux?
I'm new to its code base, buy I can help to implement it.

Any ideas where to start?

Reply to this email directly or view it on GitHub:
#51 (comment)

@jescarri
Copy link

jescarri commented Dec 5, 2014

Yes I have some stuff also.
I have been able to create a class called bridge and access some parameters.

from ouimeaux.environment import Environment
env = Environment()
env.start()
env.discover(seconds=3)
env.list_switches()
['arbolito', 'WeMo Bridge', 'Lampara_Escritorio']
switch = env.get_switch('WeMo Bridge')
switch.explain()

manufacture

GetManufactureData(ManufactureData)

bridge

CloseNetwork(DevUDN)
UpgradeSubDeviceFirmware(DeviceList, Status, FirmwareLink, UpgradePolicy)
GetGroups(DevUDN, RespGetGroups)
SetDeviceName(FriendlyName, Status, DeviceID)
GetEndDevices(ReqListType, DeviceLists, DevUDN)
AddDevice(ErrorDeviceIDs, DeviceIDs)
GetDeviceCapabilities(DeviceIDs, DeviceCapabilities)
DeleteGroup(GroupID, ResponseStatus)
QAControl(Status, Parameter, Command)
OpenNetwork(DevUDN)
SetDeviceStatus(ErrorDeviceIDs, DeviceStatusList)
IdentifyDevice(Status, DeviceID)
CreateGroup(ReqCreateGroup, RespCreateGroup)
GetDeviceStatus(DeviceStatusList, DeviceIDs)
GetCapabilityProfileIDList(CapabilityProfileIDList, DevUDN)
RemoveDevice(ErrorDeviceIDs, DeviceIDs)
AddDeviceName(ErrorDeviceIDs, FriendlyNames, DeviceIDs)
GetCapabilityProfileList(CapabilityProfileList, CapabilityIDs)

rules

SetRulesDBVersion(RulesDBVersion)
GetRulesDBVersion(RulesDBVersion)
GetRulesDBPath(RulesDBPath)
SimulatedRuleData(DeviceList)
UpdateWeeklyCalendar(CalendarList)
DeleteWeeklyCalendar(CalendarList)

remoteaccess

RemoteAccess(DeviceName, smartprivateKey, MacAddr, dst, smartUniqueId, numSmartDev, DeviceId, pluginprivateKey, HomeId)

deviceinfo

GetDeviceInformation(DeviceInformation)

metainfo

GetMetaInfo()

WiFiSetup

GetNetworkStatus(NetworkStatus)
CloseSetup()
ConnectHomeNetwork(password, encrypt, ssid, auth, channel)
GetApList(ApList)
GetNetworkList(NetworkList)
StopPair()

firmwareupdate

UpdateFirmware(WithUnsignedImage, URL, ReleaseDate, Signature, NewFirmwareVersion, DownloadStartTime)
GetFirmwareVersion(FirmwareVersion)

timesync

GetTime()
TimeSync(UTC, dst, DstSupported, TimeZone)

basicevent

GetCrockpotState(mode, time)
SetSmartDevInfo(SmartDevURL)
SetServerEnvironment(ServerEnvironmentType, TurnServerEnvironment, ServerEnvironment)
GetDeviceId()
GetRuleOverrideStatus(RuleOverrideStatus)
NotifyManualToggle(UDN, ManualToggle)
GetIconURL(URL)
SetBinaryState(Duration, BinaryState, UDN, EndAction)
SetLogLevelOption(Option, Level)
GetHomeInfo()
GetMacAddr()
ChangeFriendlyName(FriendlyName)
ReSetup(Reset)
GetDeviceIcon(DeviceIcon)
ShareHWInfo(RestoreState, PluginKey, Mac, HomeId, Serial, Udn)
SetCrockpotState(mode, time)
GetSmartDevInfo()
GetBinaryState(BinaryState)
GetSimulatedRuleData(RuleData, UDN)
ChangeDeviceIcon(PictureSize, PictureColorDeep, PictureHeight)
SetDeviceId(SetDeviceId)
GetHomeId()
GetServerEnvironment(ServerEnvironmentType, TurnServerEnvironment, ServerEnvironment)
GetLogFileURL(LOGURL)
GetFriendlyName(FriendlyName)
GetWatchdogFile(WDFile)
GetSignalStrength(SignalStrength)
SetMultiState(state)
SetHomeId(HomeId)
GetIconVersion(IconVersion)
GetPluginUDN()
GetSerialNo()

switch.basicevent.GetSignalStrength()
{'SignalStrength': '78'}
switch.basicevent.GetLogFileURL()
{'LOGURL': 'http://192.168.1.8:49153/PluginLogs.txt'}

Tomorrow I will do a pcap to see if I can reverse engineer what's going on.
I made a fork of your repo, and I just pushed my code, so you can take a look.

Thanks for sharing this code :)

@jescarri
Copy link

jescarri commented Dec 5, 2014

https://github.com/jescarri/ouimeaux

By the way the Bridge class is just a copy of one of the existing ones.

@hardillb
Copy link

@jescarri Are you getting anywhere with this? If you have the pcap file I'd be interested in looking at it as well.

@jescarri
Copy link

@hardillb
Here is what I have:

POST /upnp/control/bridge1 HTTP/1.0
Content-Type: text/xml; charset="utf-8"
HOST: 192.168.1.8
Content-Length: 395
SOAPACTION: "urn:Belkin:service:bridge:1#GetEndDevices"
Connection: close

<?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:GetEndDevices xmlns:u="urn:Belkin:service:bridge:1">
         <DevUDN>uuid:Bridge-1_0-231437B01003FC</DevUDN>
         <ReqListType>PAIRED_LIST</ReqListType>
      </u:GetEndDevices>
   </s:Body>
</s:Envelope>

HTTP/1.0 200 OK
CONTENT-LENGTH: 1031
CONTENT-TYPE: text/xml; charset="utf-8"
DATE: Sun, 07 Dec 2014 00:08:31 GMT
EXT:
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: redsonic

<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>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;DeviceLists&gt;&lt;DeviceList&gt;&lt;DeviceListType&gt;Paired&lt;/DeviceListType&gt;&lt;DeviceInfos&gt;&lt;DeviceInfo&gt;&lt;DeviceIndex&gt;0&lt;/DeviceIndex&gt;&lt;DeviceID&gt;94103EA2B277D34D&lt;/DeviceID&gt;&lt;FriendlyName&gt;Lightbulb 01&lt;/FriendlyName&gt;&lt;IconVersion&gt;1&lt;/IconVersion&gt;&lt;FirmwareVersion&gt;7E&lt;/FirmwareVersion&gt;&lt;CapabilityIDs&gt;10006,10008,30008,30009,3000A&lt;/CapabilityIDs&gt;&lt;CurrentState&gt;1,255:0,,,&lt;/CurrentState&gt;&lt;Manufacturer&gt;MRVL&lt;/Manufacturer&gt;&lt;ModelCode&gt;MZ100&lt;/ModelCode&gt;&lt;WeMoCertified&gt;YES&lt;/WeMoCertified&gt;&lt;/DeviceInfo&gt;&lt;/DeviceInfos&gt;&lt;/DeviceList&gt;&lt;/DeviceLists&gt;
</DeviceLists>
</u:GetEndDevicesResponse>
</s:Body> </s:Envelope>




POST /upnp/control/bridge1 HTTP/1.0
Content-Type: text/xml; charset="utf-8"
HOST: 192.168.1.8
Content-Length: 660
SOAPACTION: "urn:Belkin:service:bridge:1#SetDeviceStatus"
Connection: close

<?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:SetDeviceStatus xmlns:u="urn:Belkin:service:bridge:1">
         <DeviceStatusList>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;DeviceStatus&gt;&lt;IsGroupAction&gt;NO&lt;/IsGroupAction&gt;&lt;DeviceID available=&quot;YES&quot;&gt;94103EA2B277D34D&lt;/DeviceID&gt;&lt;CapabilityID&gt;10006&lt;/CapabilityID&gt;&lt;CapabilityValue&gt;0&lt;/CapabilityValue&gt;&lt;/DeviceStatus&gt;</DeviceStatusList>
      </u:SetDeviceStatus>
   </s:Body>
</s:Envelope>
HTTP/1.0 200 OK
CONTENT-LENGTH: 288
CONTENT-TYPE: text/xml; charset="utf-8"
DATE: Sat, 06 Dec 2014 23:58:19 GMT
EXT:
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: redsonic

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:SetDeviceStatusResponse xmlns:u="urn:Belkin:service:bridge:1">
<ErrorDeviceIDs></ErrorDeviceIDs>
</u:SetDeviceStatusResponse>
</s:Body> </s:Envelope>



from ouimeaux.environment import Environment
env = Environment()
env.start()
env.discover(seconds=10)
env.list_switches()
switch = env.get_switch('WeMo Bridge')


switch.basicevent.GetMacAddr()
{'SerialNo': 'XXXXXXXXX', 'MacAddr': 'XXXXXXXXXXXXXXXXXXXXX', 'PluginUDN': 'uuid:Bridge-DDDDDDDDDD'}
There Is a getUDN method

switch.bridge.GetEndDevices(DevUDN='uuid:Bridge-XXXXXXXXXXXXXXXX',ReqListType='PAIRED_LIST')
switch.bridge.GetEndDevices(DevUDN='uuid:Bridge-XXXXXXXXXXXXXXXX',ReqListType='PAIRED_LIST')
{'DeviceLists': '<?xml version="1.0" encoding="utf-8"?><DeviceLists><DeviceList><DeviceListType>Paired</DeviceListType><DeviceInfos><DeviceInfo><DeviceIndex>0</DeviceIndex><DeviceID>94103EA2B277D34D</DeviceID><FriendlyName>Lightbulb 01</FriendlyName><IconVersion>1</IconVersion><FirmwareVersion>7E</FirmwareVersion><CapabilityIDs>10006,10008,30008,30009,3000A</CapabilityIDs><CurrentState>1,252:0,,,</CurrentState><Manufacturer>MRVL</Manufacturer><ModelCode>MZ100</ModelCode><WeMoCertified>YES</WeMoCertified></DeviceInfo></DeviceInfos></DeviceList></DeviceLists>\n'}

Capacity 1006 1 o 0 On or Off --> This Capacity turns on and off the Lightbulb
10008 --> Dimmer 0 - 254 --> This capacity dimms the intensity of the light. 0 to 254


switch.bridge.GetDeviceCapabilities(DeviceIDs='94103EA2B277D34D')
{'DeviceCapabilities': '<?xml version="1.0" encoding="utf-8"?><DeviceCapabilities><DeviceCapability><DeviceID>94103EA2B277D34D</DeviceID><CapabilityIDs>10006,10008,30008,30009,3000A</CapabilityIDs></DeviceCapability></DeviceCapabilities>\n'}


This method sets the value to a device capability.
switch.bridge.SetDeviceStatus(DeviceStatusList='&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;DeviceStatus&gt;&lt;IsGroupAction&gt;NO&lt;/IsGroupAction&gt;&lt;DeviceID available=&quot;YES&quot;&gt;94103EA2B277D34D&lt;/DeviceID&gt;&lt;CapabilityID&gt;10006&lt;/CapabilityID&gt;&lt;CapabilityValue&gt;1&lt;/CapabilityValue&gt;&lt;/DeviceStatus&gt;')
switch.bridge.SetDeviceStatus(DeviceStatusList='&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;DeviceStatus&gt;&lt;IsGroupAction&gt;NO&lt;/IsGroupAction&gt;&lt;DeviceID available=&quot;YES&quot;&gt;94103EA2B277D34D&lt;/DeviceID&gt;&lt;CapabilityID&gt;10006&lt;/CapabilityID&gt;&lt;CapabilityValue&gt;0&lt;/CapabilityValue&gt;&lt;/DeviceStatus&gt;')

@jescarri
Copy link

from ouimeaux.environment import Environment
env = Environment()
env.start()
env.discover(seconds=10)
env.list_switches()
switch = env.get_switch('WeMo Bridge')

manufacture
-----------
  GetManufactureData(ManufactureData)

bridge
------
  CloseNetwork(DevUDN)
  UpgradeSubDeviceFirmware(DeviceList, Status, FirmwareLink, UpgradePolicy)
  GetGroups(DevUDN, RespGetGroups)
  SetDeviceName(FriendlyName, Status, DeviceID)
  GetEndDevices(ReqListType, DeviceLists, DevUDN)
  AddDevice(ErrorDeviceIDs, DeviceIDs)
  GetDeviceCapabilities(DeviceIDs, DeviceCapabilities)
  DeleteGroup(GroupID, ResponseStatus)
  QAControl(Status, Parameter, Command)
  OpenNetwork(DevUDN)
  SetDeviceStatus(ErrorDeviceIDs, DeviceStatusList)
  IdentifyDevice(Status, DeviceID)
  CreateGroup(ReqCreateGroup, RespCreateGroup)
  GetDeviceStatus(DeviceStatusList, DeviceIDs)
  GetCapabilityProfileIDList(CapabilityProfileIDList, DevUDN)
  RemoveDevice(ErrorDeviceIDs, DeviceIDs)
  AddDeviceName(ErrorDeviceIDs, FriendlyNames, DeviceIDs)
  GetCapabilityProfileList(CapabilityProfileList, CapabilityIDs)

rules
-----
  SetRulesDBVersion(RulesDBVersion)
  GetRulesDBVersion(RulesDBVersion)
  GetRulesDBPath(RulesDBPath)
  SimulatedRuleData(DeviceList)
  UpdateWeeklyCalendar(CalendarList)
  DeleteWeeklyCalendar(CalendarList)

remoteaccess
------------
  RemoteAccess(DeviceName, smartprivateKey, MacAddr, dst, smartUniqueId, numSmartDev, DeviceId, pluginprivateKey, HomeId)

deviceinfo
----------
  GetDeviceInformation(DeviceInformation)

metainfo
--------
  GetMetaInfo()

WiFiSetup
---------
  GetNetworkStatus(NetworkStatus)
  CloseSetup()
  ConnectHomeNetwork(password, encrypt, ssid, auth, channel)
  GetApList(ApList)
  GetNetworkList(NetworkList)
  StopPair()

firmwareupdate
--------------
  UpdateFirmware(WithUnsignedImage, URL, ReleaseDate, Signature, NewFirmwareVersion, DownloadStartTime)
  GetFirmwareVersion(FirmwareVersion)

timesync
--------
  GetTime()
  TimeSync(UTC, dst, DstSupported, TimeZone)

basicevent
----------
  GetCrockpotState(mode, time)
  SetSmartDevInfo(SmartDevURL)
  SetServerEnvironment(ServerEnvironmentType, TurnServerEnvironment, ServerEnvironment)
  GetDeviceId()
  GetRuleOverrideStatus(RuleOverrideStatus)
  NotifyManualToggle(UDN, ManualToggle)
  GetIconURL(URL)
  SetBinaryState(Duration, BinaryState, UDN, EndAction)
  SetLogLevelOption(Option, Level)
  GetHomeInfo()
  GetMacAddr()
  ChangeFriendlyName(FriendlyName)
  ReSetup(Reset)
  GetDeviceIcon(DeviceIcon)
  ShareHWInfo(RestoreState, PluginKey, Mac, HomeId, Serial, Udn)
  SetCrockpotState(mode, time)
  GetSmartDevInfo()
  GetBinaryState(BinaryState)
  GetSimulatedRuleData(RuleData, UDN)
  ChangeDeviceIcon(PictureSize, PictureColorDeep, PictureHeight)
  SetDeviceId(SetDeviceId)
  GetHomeId()
  GetServerEnvironment(ServerEnvironmentType, TurnServerEnvironment, ServerEnvironment)
  GetLogFileURL(LOGURL)
  GetFriendlyName(FriendlyName)
  GetWatchdogFile(WDFile)
  GetSignalStrength(SignalStrength)
  SetMultiState(state)
  SetHomeId(HomeId)
  GetIconVersion(IconVersion)
  GetPluginUDN()
  GetSerialNo()


------

@jescarri
Copy link

@hardillb
I haven't had time to implement the classes and put all the logic in code.
basically:

  1. Scan for devices
  2. If Device type is Bridge
    Scan for GetEndDevices
  3. Build a list of Bridge -> EndDevices

@hardillb
Copy link

@jescarri Thanks for that, you've helped me make a big jump forward (I was missing the PAIRED_LIST bit for getdeviceslist)

@jescarri
Copy link

@hardillb You are welcome!.

@hardillb
Copy link

@mrose17
Copy link

mrose17 commented Dec 20, 2014

+1 ... many thanks for looking into this!

@iancmcc iancmcc added this to the 0.7.4 milestone Jan 13, 2015
@ghctim
Copy link

ghctim commented Jan 25, 2015

Any closer to making this work?

@fritz-fritz
Copy link
Contributor Author

Yes. I am close. Hopefully will submit a pull request soon.

@fritz-fritz
Copy link
Contributor Author

@iancmcc , @ghctim , @mrose17 ,

Thanks to the documentation of @jescarri and @hardillb , I have gotten basic support implemented on my fork... Next I need to work on adding support for the web server, testing, and docs before submitting a pull request. Feel free to check it out and make suggestions etc... I'm sure there is a better way this could have been done but I'm just happy I finally have Python API and CLI support!

@afm497
Copy link

afm497 commented Feb 12, 2015

@fritz-fritz

The fork you mentioned above should be able to control the wemo bridge with led bulbs on it? I think that's what you are saying you are working on, but wanting to confirm. I've played around a bit with your fork and can't seem to get my wemo bulb bridge detected. Any pointers you might have for me looking to play around with controlling these led bulbs?

@fritz-fritz
Copy link
Contributor Author

@afm497

Yes my fork should currently work for controlling Wemo LED bulbs through the bridge. At least for command line and Python usage. The REST API and web app are not yet supported.

I have yet to add documentation and other features. I have not tested or planned for bulbs that are grouped so that may be part of the problem you are having? Also try clearing your cache and then scanning again to see if it picks them up. Good luck!

@afm497
Copy link

afm497 commented Feb 13, 2015

@fritz-fritz

works perfect. thanks very much for that, very useful. If it's of interest, the bridge/bulbs combo that I have locally had differrent light attributes that what was defined in ouimeaux.device.bridge
Spefically, there was no information in my setup for "manufacturer', 'model', and 'certified'

@fritz-fritz
Copy link
Contributor Author

Support added with #75

@iancmcc
Copy link
Owner

iancmcc commented Mar 19, 2015

This is in release 0.7.9 pretty much as-is. Thanks for all your work. Plan is to add server support and device events similar to switches in 0.8.

@hardillb
Copy link

I've been adding some Osram lightify bulbs to my Wemo Link. They work well but the WeMo Android app doesn't support Colours or Colour Temperature changes (despite showing it in the screen shots). I've been poking round to find the capabilities used to set these values and I've found that you can get the WeMo link to give you a list of all the ones it knows about and a description of the fields.

I've dumped the list here: https://gist.github.com/hardillb/ec88e86597d65584b1ba

Hope that helps you guys, My Node.js module is coming along nicely and I should have a nice Node-RED module based on it as well.

@fritz-fritz
Copy link
Contributor Author

@hardillb Thanks so much for all the work you do! I definitely was using your previous gists as a starting point. Currently I'm working on adding Link/LED support to homebridge. If I had color bulbs I would definitely take a look. I'm sure it will be helpful to others!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants