pywemo 0.6.5__tar.gz → 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pywemo might be problematic. Click here for more details.
- pywemo-2.0.0/PKG-INFO +276 -0
- pywemo-2.0.0/README.rst +250 -0
- pywemo-2.0.0/pyproject.toml +287 -0
- pywemo-2.0.0/pywemo/README.md +69 -0
- pywemo-2.0.0/pywemo/__init__.py +33 -0
- {pywemo-0.6.5 → pywemo-2.0.0}/pywemo/color.py +24 -17
- pywemo-2.0.0/pywemo/discovery.py +195 -0
- pywemo-2.0.0/pywemo/exceptions.py +95 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/__init__.py +806 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/api/attributes.py +132 -0
- {pywemo-0.6.5 → pywemo-2.0.0}/pywemo/ouimeaux_device/api/db_orm.py +13 -7
- {pywemo-0.6.5 → pywemo-2.0.0}/pywemo/ouimeaux_device/api/long_press.py +28 -13
- {pywemo-0.6.5 → pywemo-2.0.0}/pywemo/ouimeaux_device/api/rules_db.py +40 -25
- {pywemo-0.6.5 → pywemo-2.0.0}/pywemo/ouimeaux_device/api/service.py +147 -60
- pywemo-2.0.0/pywemo/ouimeaux_device/api/wemo_services.py +25 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/api/wemo_services.pyi +242 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/api/xsd/device.py +3887 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/api/xsd/service.py +3871 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/api/xsd_types.py +223 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/bridge.py +512 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/coffeemaker.py +93 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/crockpot.py +158 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/dimmer.py +71 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/humidifier.py +225 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/insight.py +192 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/lightswitch.py +12 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/maker.py +55 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/motion.py +7 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/outdoor_plug.py +7 -0
- pywemo-2.0.0/pywemo/ouimeaux_device/switch.py +33 -0
- pywemo-2.0.0/pywemo/py.typed +0 -0
- {pywemo-0.6.5 → pywemo-2.0.0}/pywemo/ssdp.py +121 -213
- {pywemo-0.6.5 → pywemo-2.0.0}/pywemo/subscribe.py +321 -132
- pywemo-2.0.0/pywemo/util.py +139 -0
- pywemo-0.6.5/PKG-INFO +0 -159
- pywemo-0.6.5/README.rst +0 -136
- pywemo-0.6.5/pyproject.toml +0 -167
- pywemo-0.6.5/pywemo/__init__.py +0 -16
- pywemo-0.6.5/pywemo/discovery.py +0 -146
- pywemo-0.6.5/pywemo/exceptions.py +0 -41
- pywemo-0.6.5/pywemo/ouimeaux_device/__init__.py +0 -703
- pywemo-0.6.5/pywemo/ouimeaux_device/api/xsd/device.py +0 -2441
- pywemo-0.6.5/pywemo/ouimeaux_device/api/xsd/service.py +0 -2463
- pywemo-0.6.5/pywemo/ouimeaux_device/bridge.py +0 -387
- pywemo-0.6.5/pywemo/ouimeaux_device/coffeemaker.py +0 -140
- pywemo-0.6.5/pywemo/ouimeaux_device/dimmer.py +0 -56
- pywemo-0.6.5/pywemo/ouimeaux_device/humidifier.py +0 -306
- pywemo-0.6.5/pywemo/ouimeaux_device/insight.py +0 -133
- pywemo-0.6.5/pywemo/ouimeaux_device/lightswitch.py +0 -16
- pywemo-0.6.5/pywemo/ouimeaux_device/maker.py +0 -77
- pywemo-0.6.5/pywemo/ouimeaux_device/motion.py +0 -15
- pywemo-0.6.5/pywemo/ouimeaux_device/outdoor_plug.py +0 -15
- pywemo-0.6.5/pywemo/ouimeaux_device/switch.py +0 -32
- pywemo-0.6.5/pywemo/util.py +0 -69
- pywemo-0.6.5/setup.py +0 -33
- {pywemo-0.6.5 → pywemo-2.0.0}/LICENSE +0 -0
- {pywemo-0.6.5 → pywemo-2.0.0}/pywemo/ouimeaux_device/LICENSE +0 -0
- {pywemo-0.6.5 → pywemo-2.0.0}/pywemo/ouimeaux_device/api/__init__.py +0 -0
- {pywemo-0.6.5 → pywemo-2.0.0}/pywemo/ouimeaux_device/api/xsd/__init__.py +0 -0
- {pywemo-0.6.5 → pywemo-2.0.0}/pywemo/ouimeaux_device/api/xsd/device.xsd +0 -0
- {pywemo-0.6.5 → pywemo-2.0.0}/pywemo/ouimeaux_device/api/xsd/service.xsd +0 -0
pywemo-2.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pywemo
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Lightweight Python module to discover and control WeMo devices
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: wemo,api
|
|
8
|
+
Author: Eric Severance
|
|
9
|
+
Author-email: pywemo@esev.com
|
|
10
|
+
Requires-Python: >=3.10.0
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Requires-Dist: ifaddr (>=0.1.0)
|
|
19
|
+
Requires-Dist: lxml (>=4.6)
|
|
20
|
+
Requires-Dist: requests (>=2.0)
|
|
21
|
+
Requires-Dist: urllib3 (>=2.0.2)
|
|
22
|
+
Project-URL: Homepage, https://github.com/pywemo/pywemo
|
|
23
|
+
Project-URL: Repository, https://github.com/pywemo/pywemo
|
|
24
|
+
Description-Content-Type: text/x-rst
|
|
25
|
+
|
|
26
|
+
pyWeMo |Build Badge| |PyPI Version Badge| |Coverage| |PyPI Downloads Badge| |Docs Badge| |Scorecard Badge| |Best Practices Badge| |SLSA 3 Badge|
|
|
27
|
+
================================================================================================================================================
|
|
28
|
+
Python 3 module to setup, discover and control WeMo devices.
|
|
29
|
+
|
|
30
|
+
Dependencies
|
|
31
|
+
------------
|
|
32
|
+
pyWeMo depends on Python packages: requests, ifaddr, lxml, urllib3
|
|
33
|
+
|
|
34
|
+
How to use
|
|
35
|
+
----------
|
|
36
|
+
|
|
37
|
+
.. code-block:: python
|
|
38
|
+
|
|
39
|
+
>>> import pywemo
|
|
40
|
+
>>> devices = pywemo.discover_devices()
|
|
41
|
+
>>> print(devices)
|
|
42
|
+
[<WeMo Insight "AC Insight">]
|
|
43
|
+
|
|
44
|
+
>>> devices[0].toggle()
|
|
45
|
+
|
|
46
|
+
For advanced usage, the ``device.explain()`` method will print all known actions that the device reports to PyWeMo.
|
|
47
|
+
|
|
48
|
+
If discovery doesn't work on your network
|
|
49
|
+
-----------------------------------------
|
|
50
|
+
Automatic discovery may not work reliably on some networks.
|
|
51
|
+
In that case, you can use the device with an IP or hostname:
|
|
52
|
+
|
|
53
|
+
.. code-block:: python
|
|
54
|
+
|
|
55
|
+
>>> import pywemo
|
|
56
|
+
>>> url = pywemo.setup_url_for_address("192.168.1.192")
|
|
57
|
+
>>> print(url)
|
|
58
|
+
http://192.168.1.192:49153/setup.xml
|
|
59
|
+
>>> device = pywemo.discovery.device_from_description(url)
|
|
60
|
+
>>> print(device)
|
|
61
|
+
<WeMo Maker "Hi Fi Systemline Sensor">
|
|
62
|
+
|
|
63
|
+
Please note that ``discovery.device_from_description`` requires a ``url`` with an IP address, rather than a hostname.
|
|
64
|
+
This is needed for the subscription update logic to work properly.
|
|
65
|
+
In addition, recent versions of the WeMo firmware may not accept connections from hostnames and will return a 500 error.
|
|
66
|
+
|
|
67
|
+
The ``setup_url_for_address`` function will lookup a hostname and provide a suitable ``url`` with an IP address.
|
|
68
|
+
|
|
69
|
+
If the WeMo device is not on your network, you can also connect to it directly.
|
|
70
|
+
After connecting, if the ``pywemo.discover_devices()`` doesn't work, you can get the IP Address by running an ``arp -a`` and use that in ``pywemo.setup_url_for_address``:
|
|
71
|
+
|
|
72
|
+
.. code-block::
|
|
73
|
+
|
|
74
|
+
$ arp -a
|
|
75
|
+
_gateway (10.22.22.1) at [MAC ADDRESS REMOVED] [ether]
|
|
76
|
+
|
|
77
|
+
.. code-block:: python
|
|
78
|
+
|
|
79
|
+
>>> import pywemo
|
|
80
|
+
>>> url = pywemo.setup_url_for_address("10.22.22.1")
|
|
81
|
+
>>> device = pywemo.discovery.device_from_description(url)
|
|
82
|
+
>>> print(device)
|
|
83
|
+
<WeMo Switch "Wemo Mini">
|
|
84
|
+
>>> device.setup(ssid='MY SSID', password='MY NETWORK PASSWORD')
|
|
85
|
+
('1', 'success')
|
|
86
|
+
|
|
87
|
+
Testing new products
|
|
88
|
+
--------------------
|
|
89
|
+
If both methods above are not successful, then ``pywemo`` may not support your WeMo product yet.
|
|
90
|
+
This may be particularly true if it is a new WeMo product.
|
|
91
|
+
To test this, you can use a debug flag, ``pywemo.discover_devices(debug=True)`` or ``pywemo.discovery.device_from_description(url, debug=True)``.
|
|
92
|
+
If an ``UnsupportedDevice`` is found, then it is highly likely that the product can be added to ``pywemo``.
|
|
93
|
+
This ``UnsupportedDevice`` will allow manual interaction, but please open an issue to get first class support for the device.
|
|
94
|
+
|
|
95
|
+
Device Reset and Setup
|
|
96
|
+
----------------------
|
|
97
|
+
PyWeMo includes the ability to reset and setup devices, without using the Belkin app or needing to create a Belkin account.
|
|
98
|
+
This can be particularly useful if the intended use is fully local control, such as using Home Assistant.
|
|
99
|
+
PyWeMo does not connect nor use the Belkin cloud for any functionality.
|
|
100
|
+
|
|
101
|
+
Reset
|
|
102
|
+
~~~~~
|
|
103
|
+
Reset can be performed with the ``reset`` method, which has 2 boolean input arguments, ``data`` and ``wifi``.
|
|
104
|
+
WeMo devices contain a hardware reset procedure as well, so use of ``pywemo`` is for convenience or if physical access is not available.
|
|
105
|
+
This ``reset`` method may not work on all devices.
|
|
106
|
+
|
|
107
|
+
======================================= ================= =======================
|
|
108
|
+
Method in ``pywemo`` Clears Name in WeMo App
|
|
109
|
+
======================================= ================= =======================
|
|
110
|
+
``device.reset(data=True, wifi=False)`` name, icon, rules Clear Personalized Info
|
|
111
|
+
``device.reset(data=False, wifi=True)`` wifi information Change Wi-Fi
|
|
112
|
+
``device.reset(data=True, wifi=True)`` everything Factory Restore
|
|
113
|
+
======================================= ================= =======================
|
|
114
|
+
|
|
115
|
+
Setup
|
|
116
|
+
~~~~~
|
|
117
|
+
|
|
118
|
+
Device setup is through the ``setup`` method, which has two required arguments: ``ssid`` and ``password``.
|
|
119
|
+
The user must first connect to the devices locally broadcast access point, which typically starts with "WeMo.", and then discover the device there.
|
|
120
|
+
Once done, pass the desired SSID and password (WPA2/AES encryption only) to the ``setup`` method to connect it to your Wi-Fi network.
|
|
121
|
+
|
|
122
|
+
``device.setup(ssid='wifi', password='secret')``
|
|
123
|
+
|
|
124
|
+
A few important notes:
|
|
125
|
+
|
|
126
|
+
- If connecting to an open network, the password argument is ignored and you can provide anything, e.g. ``password=None``.
|
|
127
|
+
- If connecting to a WPA2/AES/TKIPAES-encrypted network, OpenSSL is used to encrypt the password by the ``pywemo`` library.
|
|
128
|
+
It must be installed and available on your ``PATH`` via calling ``openssl`` from a terminal or command prompt.
|
|
129
|
+
- For a WeMo without internet access, see `this guide <https://github.com/pywemo/pywemo/wiki/WeMo-Cloud#disconnecting-from-the-cloud>`_ to stop any blinking lights.
|
|
130
|
+
|
|
131
|
+
If you have issues connecting, here are several things worth trying:
|
|
132
|
+
|
|
133
|
+
- Try again!
|
|
134
|
+
WeMo devices sometimes just fail to connect and repeating the exact same steps may subsequently work.
|
|
135
|
+
- Bring the WeMo as close to the access point as possible.
|
|
136
|
+
Some devices seem to require a very strong signal for setup, even if they will work normally with a weaker one.
|
|
137
|
+
- WeMo devices can only connect to 2.4GHz Wi-Fi and sometimes have trouble connecting if the 2.4Ghz and 5Ghz SSID are the same.
|
|
138
|
+
- If issues persist, consider performing a full factory reset and power cycle on the device before trying again.
|
|
139
|
+
- Enabled firewall rules may block the WeMo from connecting to the intended AP.
|
|
140
|
+
- Based on various differences in models and firmware, pywemo contains 3 different methods for encrypting the Wi-Fi password when sending it to the WeMo device.
|
|
141
|
+
In addition to the encryption, WeMo devices sometimes expect the get password lengths appended to the end of the password.
|
|
142
|
+
There is logic in pywemo that attempts to select the appropriate options for each device, but it maybe not be correct for all devices and firmware.
|
|
143
|
+
Thus, you may want to try forcing each of the 6 possible combinations as shown below.
|
|
144
|
+
If one of these other methods work, but not the automatic detection, then be sure to add a comment to `this pywemo issue`_.
|
|
145
|
+
|
|
146
|
+
.. code-block:: python
|
|
147
|
+
|
|
148
|
+
device.setup(ssid='wifi', password='secret', _encrypt_method=1, _add_password_lengths=True)
|
|
149
|
+
device.setup(ssid='wifi', password='secret', _encrypt_method=2, _add_password_lengths=False)
|
|
150
|
+
device.setup(ssid='wifi', password='secret', _encrypt_method=3, _add_password_lengths=True)
|
|
151
|
+
# only the top 3 should be valid, but go ahead and try these lower 3 too...
|
|
152
|
+
device.setup(ssid='wifi', password='secret', _encrypt_method=1, _add_password_lengths=False)
|
|
153
|
+
device.setup(ssid='wifi', password='secret', _encrypt_method=2, _add_password_lengths=True)
|
|
154
|
+
device.setup(ssid='wifi', password='secret', _encrypt_method=3, _add_password_lengths=False)
|
|
155
|
+
|
|
156
|
+
Search for your device on `this pywemo issue`_ before opening a new issue if setup does not work for your device.
|
|
157
|
+
|
|
158
|
+
Firmware Warning
|
|
159
|
+
----------------
|
|
160
|
+
Starting in May of 2020, Belkin started requiring users to create an account and login to the app (Android app version 1.25).
|
|
161
|
+
In addition to the account, most of the app functionality now requires a connection to the cloud (internet access), even for simple actions such as toggling a switch.
|
|
162
|
+
All of the commands that go through the cloud are encrypted and cannot be easily inspected.
|
|
163
|
+
This raises the possibility that Belkin could, in the future, update WeMo device firmware and make breaking API changes that can no longer be deciphered.
|
|
164
|
+
If this happens, ``pywemo`` may no longer function on that device.
|
|
165
|
+
Thus it would be prudent to upgrade firmware cautiously and preferably only after confirming that breaking API changes have not been introduced.
|
|
166
|
+
|
|
167
|
+
Belkin Ends Support for WeMo
|
|
168
|
+
----------------------------
|
|
169
|
+
Note that Belkin is officially ending WeMo support on January 31, 2026.
|
|
170
|
+
After this date, the Belkin app will no longer work, including the required cloud access to use the current products.
|
|
171
|
+
This also means that you cannot use the Belkin app to connect a device to your network after this date either.
|
|
172
|
+
See `this link <https://www.belkin.com/support-article/?articleNum=335419>`_ for more details from Belkin.
|
|
173
|
+
|
|
174
|
+
The good news is that this change will **not** affect pywemo, which will continue to work as it currently does;
|
|
175
|
+
pywemo does not rely on the cloud connection for anything, including setup.
|
|
176
|
+
Many products can be setup and reset with pywemo, as discussed above.
|
|
177
|
+
|
|
178
|
+
Please see `this pywemo issue`_ to document the status of the various products and to update the table below on product status.
|
|
179
|
+
|
|
180
|
+
Product Status
|
|
181
|
+
--------------
|
|
182
|
+
This is a list of known products and the pywemo status of each, including for setup.
|
|
183
|
+
This list was started in November of 2025 in response to Belkin ending WeMo support.
|
|
184
|
+
Any entry with N/A is unreported since this table was added.
|
|
185
|
+
If you have any of these decvices and use them with PyWeMo, please let us know in `this pywemo issue`_ so that we can complete this list.
|
|
186
|
+
|
|
187
|
+
This list is mostly from the Belkin article mentioned above, but it may not be a complete list of all products.
|
|
188
|
+
SKU's with an asterisk at the end, like F7C029V2*, are not listed in the article.
|
|
189
|
+
|
|
190
|
+
========= ======================================= ==================== =================== ========================================
|
|
191
|
+
SKU's Description PyWeMo Object PyWeMo Setup Status Known Working Firmware(s)
|
|
192
|
+
========= ======================================= ==================== =================== ========================================
|
|
193
|
+
F7C031 Wemo Link Bridge N/A N/A
|
|
194
|
+
F7C046 Wemo Humidifier Humidifier N/A N/A
|
|
195
|
+
F7C045 Wemo CrockPot CrockPot N/A N/A
|
|
196
|
+
F7C048 Wemo Heater B N/A N/A N/A
|
|
197
|
+
F7C049 Wemo Air Purifier N/A N/A N/A
|
|
198
|
+
F7C047 Wemo Heater A N/A N/A N/A
|
|
199
|
+
F7C050 Wemo Coffee Maker (Mr. Coffee) CoffeeMaker N/A N/A
|
|
200
|
+
F8J007 Wi-Fi Baby Monitor N/A N/A N/A
|
|
201
|
+
F5Z0489 Wemo LED Lighting Bundle N/A N/A N/A
|
|
202
|
+
F7C028 Wemo Motion Sensor Motion N/A N/A
|
|
203
|
+
F5Z0340 Wemo Switch + Motion Sensor N/A N/A N/A
|
|
204
|
+
F7C043 Wemo Maker Module Maker Works WeMo_WW_2.00.11423.PVT-OWRT-Maker
|
|
205
|
+
F7C033 Wemo Zigbee Bulb, E27 N/A N/A N/A
|
|
206
|
+
F7C061 Wemo Insight v2 N/A N/A N/A
|
|
207
|
+
F7C027 Wemo Switch Switch Works WeMo_WW_2.00.11851.PVT-OWRT-SNS
|
|
208
|
+
F7C062 Wemo Light Switch v2 N/A N/A N/A
|
|
209
|
+
F7C029 Wemo Insight Insight Works WeMo_WW_2.00.11483.PVT-OWRT-Insight
|
|
210
|
+
F7C029V2* Wemo Insight V2 Insight Works WeMo_WW_2.00.10062.PVT-OWRT-InsightV2
|
|
211
|
+
WLS0403 Wemo Smart Light Switch 3-Way LightSwitchLongPress N/A N/A
|
|
212
|
+
WSP070 Wemo Mini Smart Plug N/A N/A N/A
|
|
213
|
+
WDS060 Wemo Wi-Fi Smart Light Switch w/ Dimmer DimmerV2 N/A WEMO_WW_2.00.20110904.PVT-RTOS-DimmerV2
|
|
214
|
+
WLS040 Wemo Smart Light Switch LightSwitchLongPress N/A N/A
|
|
215
|
+
F7C064 Wemo HomeKit N/A N/A N/A
|
|
216
|
+
F7C059 Wemo Dimmer Light Switch DimmerLongPress Works WeMo_WW_2.00.11453.PVT-OWRT-Dimmer
|
|
217
|
+
F7C063 Wemo Mini Plugin Switch Switch Works WeMo_WW_2.00.11452.PVT-OWRT-SNSV2
|
|
218
|
+
F7C030 Wemo Light Switch LightSwitchLongPress Works WeMo_WW_2.00.11408.PVT-OWRT-LS
|
|
219
|
+
WSP090 Wemo Outdoor Plug OutdoorPlug Works WEMO_WW_1.00.20081401.PVT-RTOS-OutdoorV1
|
|
220
|
+
WSP080 Wemo Mini Smart Plug Switch Works WEMO_WW_4.00.20101902.PVT-RTOS-SNSV4
|
|
221
|
+
========= ======================================= ==================== =================== ========================================
|
|
222
|
+
|
|
223
|
+
Developing
|
|
224
|
+
----------
|
|
225
|
+
Setup and builds are fully automated.
|
|
226
|
+
You can run the build pipeline locally via:
|
|
227
|
+
|
|
228
|
+
.. code-block::
|
|
229
|
+
|
|
230
|
+
# setup, install, format, lint, test and build:
|
|
231
|
+
./scripts/build.sh
|
|
232
|
+
|
|
233
|
+
Note that this will install a git ``pre-commit`` hook.
|
|
234
|
+
For this hook to work correctly, ``poetry`` needs to be globally accessible on your ``PATH`` or the local virtual environment must be activated.
|
|
235
|
+
This virtual environment can be activated with:
|
|
236
|
+
|
|
237
|
+
.. code-block::
|
|
238
|
+
|
|
239
|
+
. .venv/bin/activate
|
|
240
|
+
|
|
241
|
+
History
|
|
242
|
+
-------
|
|
243
|
+
This started as a stripped down version of `ouimeaux <https://github.com/iancmcc/ouimeaux>`_, copyright Ian McCracken, but has since taken its own path.
|
|
244
|
+
|
|
245
|
+
License
|
|
246
|
+
-------
|
|
247
|
+
All contents of the pywemo/ouimeaux_device directory are licensed under a BSD 3-Clause license. The full text of that license is maintained within the pywemo/ouimeaux_device/LICENSE file.
|
|
248
|
+
The rest of pyWeMo is released under the MIT license. See the top-level LICENSE file for more details.
|
|
249
|
+
|
|
250
|
+
.. _this pywemo issue: https://github.com/pywemo/pywemo/issues/773
|
|
251
|
+
|
|
252
|
+
.. |Build Badge| image:: https://github.com/pywemo/pywemo/workflows/Build/badge.svg
|
|
253
|
+
:target: https://github.com/pywemo/pywemo/actions?query=workflow%3ABuild
|
|
254
|
+
:alt: GitHub build status
|
|
255
|
+
.. |PyPI Version Badge| image:: https://img.shields.io/pypi/v/pywemo
|
|
256
|
+
:target: https://pypi.org/project/pywemo/
|
|
257
|
+
:alt: Latest PyPI version
|
|
258
|
+
.. |Coverage| image:: https://coveralls.io/repos/github/pywemo/pywemo/badge.svg?branch=main
|
|
259
|
+
:target: https://coveralls.io/github/pywemo/pywemo?branch=main
|
|
260
|
+
:alt: Coveralls coverage
|
|
261
|
+
.. |PyPI Downloads Badge| image:: https://img.shields.io/pypi/dm/pywemo
|
|
262
|
+
:target: https://pypi.org/project/pywemo/
|
|
263
|
+
:alt: Number of PyPI downloads
|
|
264
|
+
.. |Docs Badge| image:: https://github.com/pywemo/pywemo/actions/workflows/docs.yml/badge.svg
|
|
265
|
+
:target: https://pywemo.github.io/pywemo/
|
|
266
|
+
:alt: API Documentation
|
|
267
|
+
.. |Scorecard Badge| image:: https://api.securityscorecards.dev/projects/github.com/pywemo/pywemo/badge
|
|
268
|
+
:target: https://securityscorecards.dev/viewer/?uri=github.com/pywemo/pywemo
|
|
269
|
+
:alt: OpenSSF Scorecard
|
|
270
|
+
.. |Best Practices Badge| image:: https://bestpractices.coreinfrastructure.org/projects/7467/badge
|
|
271
|
+
:target: https://bestpractices.coreinfrastructure.org/projects/7467
|
|
272
|
+
:alt: OpenSSF Best Practices
|
|
273
|
+
.. |SLSA 3 Badge| image:: https://slsa.dev/images/gh-badge-level3.svg
|
|
274
|
+
:target: https://github.com/pywemo/pywemo/releases/latest#user-content-SLSA
|
|
275
|
+
:alt: SLSA level 3
|
|
276
|
+
|
pywemo-2.0.0/README.rst
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
pyWeMo |Build Badge| |PyPI Version Badge| |Coverage| |PyPI Downloads Badge| |Docs Badge| |Scorecard Badge| |Best Practices Badge| |SLSA 3 Badge|
|
|
2
|
+
================================================================================================================================================
|
|
3
|
+
Python 3 module to setup, discover and control WeMo devices.
|
|
4
|
+
|
|
5
|
+
Dependencies
|
|
6
|
+
------------
|
|
7
|
+
pyWeMo depends on Python packages: requests, ifaddr, lxml, urllib3
|
|
8
|
+
|
|
9
|
+
How to use
|
|
10
|
+
----------
|
|
11
|
+
|
|
12
|
+
.. code-block:: python
|
|
13
|
+
|
|
14
|
+
>>> import pywemo
|
|
15
|
+
>>> devices = pywemo.discover_devices()
|
|
16
|
+
>>> print(devices)
|
|
17
|
+
[<WeMo Insight "AC Insight">]
|
|
18
|
+
|
|
19
|
+
>>> devices[0].toggle()
|
|
20
|
+
|
|
21
|
+
For advanced usage, the ``device.explain()`` method will print all known actions that the device reports to PyWeMo.
|
|
22
|
+
|
|
23
|
+
If discovery doesn't work on your network
|
|
24
|
+
-----------------------------------------
|
|
25
|
+
Automatic discovery may not work reliably on some networks.
|
|
26
|
+
In that case, you can use the device with an IP or hostname:
|
|
27
|
+
|
|
28
|
+
.. code-block:: python
|
|
29
|
+
|
|
30
|
+
>>> import pywemo
|
|
31
|
+
>>> url = pywemo.setup_url_for_address("192.168.1.192")
|
|
32
|
+
>>> print(url)
|
|
33
|
+
http://192.168.1.192:49153/setup.xml
|
|
34
|
+
>>> device = pywemo.discovery.device_from_description(url)
|
|
35
|
+
>>> print(device)
|
|
36
|
+
<WeMo Maker "Hi Fi Systemline Sensor">
|
|
37
|
+
|
|
38
|
+
Please note that ``discovery.device_from_description`` requires a ``url`` with an IP address, rather than a hostname.
|
|
39
|
+
This is needed for the subscription update logic to work properly.
|
|
40
|
+
In addition, recent versions of the WeMo firmware may not accept connections from hostnames and will return a 500 error.
|
|
41
|
+
|
|
42
|
+
The ``setup_url_for_address`` function will lookup a hostname and provide a suitable ``url`` with an IP address.
|
|
43
|
+
|
|
44
|
+
If the WeMo device is not on your network, you can also connect to it directly.
|
|
45
|
+
After connecting, if the ``pywemo.discover_devices()`` doesn't work, you can get the IP Address by running an ``arp -a`` and use that in ``pywemo.setup_url_for_address``:
|
|
46
|
+
|
|
47
|
+
.. code-block::
|
|
48
|
+
|
|
49
|
+
$ arp -a
|
|
50
|
+
_gateway (10.22.22.1) at [MAC ADDRESS REMOVED] [ether]
|
|
51
|
+
|
|
52
|
+
.. code-block:: python
|
|
53
|
+
|
|
54
|
+
>>> import pywemo
|
|
55
|
+
>>> url = pywemo.setup_url_for_address("10.22.22.1")
|
|
56
|
+
>>> device = pywemo.discovery.device_from_description(url)
|
|
57
|
+
>>> print(device)
|
|
58
|
+
<WeMo Switch "Wemo Mini">
|
|
59
|
+
>>> device.setup(ssid='MY SSID', password='MY NETWORK PASSWORD')
|
|
60
|
+
('1', 'success')
|
|
61
|
+
|
|
62
|
+
Testing new products
|
|
63
|
+
--------------------
|
|
64
|
+
If both methods above are not successful, then ``pywemo`` may not support your WeMo product yet.
|
|
65
|
+
This may be particularly true if it is a new WeMo product.
|
|
66
|
+
To test this, you can use a debug flag, ``pywemo.discover_devices(debug=True)`` or ``pywemo.discovery.device_from_description(url, debug=True)``.
|
|
67
|
+
If an ``UnsupportedDevice`` is found, then it is highly likely that the product can be added to ``pywemo``.
|
|
68
|
+
This ``UnsupportedDevice`` will allow manual interaction, but please open an issue to get first class support for the device.
|
|
69
|
+
|
|
70
|
+
Device Reset and Setup
|
|
71
|
+
----------------------
|
|
72
|
+
PyWeMo includes the ability to reset and setup devices, without using the Belkin app or needing to create a Belkin account.
|
|
73
|
+
This can be particularly useful if the intended use is fully local control, such as using Home Assistant.
|
|
74
|
+
PyWeMo does not connect nor use the Belkin cloud for any functionality.
|
|
75
|
+
|
|
76
|
+
Reset
|
|
77
|
+
~~~~~
|
|
78
|
+
Reset can be performed with the ``reset`` method, which has 2 boolean input arguments, ``data`` and ``wifi``.
|
|
79
|
+
WeMo devices contain a hardware reset procedure as well, so use of ``pywemo`` is for convenience or if physical access is not available.
|
|
80
|
+
This ``reset`` method may not work on all devices.
|
|
81
|
+
|
|
82
|
+
======================================= ================= =======================
|
|
83
|
+
Method in ``pywemo`` Clears Name in WeMo App
|
|
84
|
+
======================================= ================= =======================
|
|
85
|
+
``device.reset(data=True, wifi=False)`` name, icon, rules Clear Personalized Info
|
|
86
|
+
``device.reset(data=False, wifi=True)`` wifi information Change Wi-Fi
|
|
87
|
+
``device.reset(data=True, wifi=True)`` everything Factory Restore
|
|
88
|
+
======================================= ================= =======================
|
|
89
|
+
|
|
90
|
+
Setup
|
|
91
|
+
~~~~~
|
|
92
|
+
|
|
93
|
+
Device setup is through the ``setup`` method, which has two required arguments: ``ssid`` and ``password``.
|
|
94
|
+
The user must first connect to the devices locally broadcast access point, which typically starts with "WeMo.", and then discover the device there.
|
|
95
|
+
Once done, pass the desired SSID and password (WPA2/AES encryption only) to the ``setup`` method to connect it to your Wi-Fi network.
|
|
96
|
+
|
|
97
|
+
``device.setup(ssid='wifi', password='secret')``
|
|
98
|
+
|
|
99
|
+
A few important notes:
|
|
100
|
+
|
|
101
|
+
- If connecting to an open network, the password argument is ignored and you can provide anything, e.g. ``password=None``.
|
|
102
|
+
- If connecting to a WPA2/AES/TKIPAES-encrypted network, OpenSSL is used to encrypt the password by the ``pywemo`` library.
|
|
103
|
+
It must be installed and available on your ``PATH`` via calling ``openssl`` from a terminal or command prompt.
|
|
104
|
+
- For a WeMo without internet access, see `this guide <https://github.com/pywemo/pywemo/wiki/WeMo-Cloud#disconnecting-from-the-cloud>`_ to stop any blinking lights.
|
|
105
|
+
|
|
106
|
+
If you have issues connecting, here are several things worth trying:
|
|
107
|
+
|
|
108
|
+
- Try again!
|
|
109
|
+
WeMo devices sometimes just fail to connect and repeating the exact same steps may subsequently work.
|
|
110
|
+
- Bring the WeMo as close to the access point as possible.
|
|
111
|
+
Some devices seem to require a very strong signal for setup, even if they will work normally with a weaker one.
|
|
112
|
+
- WeMo devices can only connect to 2.4GHz Wi-Fi and sometimes have trouble connecting if the 2.4Ghz and 5Ghz SSID are the same.
|
|
113
|
+
- If issues persist, consider performing a full factory reset and power cycle on the device before trying again.
|
|
114
|
+
- Enabled firewall rules may block the WeMo from connecting to the intended AP.
|
|
115
|
+
- Based on various differences in models and firmware, pywemo contains 3 different methods for encrypting the Wi-Fi password when sending it to the WeMo device.
|
|
116
|
+
In addition to the encryption, WeMo devices sometimes expect the get password lengths appended to the end of the password.
|
|
117
|
+
There is logic in pywemo that attempts to select the appropriate options for each device, but it maybe not be correct for all devices and firmware.
|
|
118
|
+
Thus, you may want to try forcing each of the 6 possible combinations as shown below.
|
|
119
|
+
If one of these other methods work, but not the automatic detection, then be sure to add a comment to `this pywemo issue`_.
|
|
120
|
+
|
|
121
|
+
.. code-block:: python
|
|
122
|
+
|
|
123
|
+
device.setup(ssid='wifi', password='secret', _encrypt_method=1, _add_password_lengths=True)
|
|
124
|
+
device.setup(ssid='wifi', password='secret', _encrypt_method=2, _add_password_lengths=False)
|
|
125
|
+
device.setup(ssid='wifi', password='secret', _encrypt_method=3, _add_password_lengths=True)
|
|
126
|
+
# only the top 3 should be valid, but go ahead and try these lower 3 too...
|
|
127
|
+
device.setup(ssid='wifi', password='secret', _encrypt_method=1, _add_password_lengths=False)
|
|
128
|
+
device.setup(ssid='wifi', password='secret', _encrypt_method=2, _add_password_lengths=True)
|
|
129
|
+
device.setup(ssid='wifi', password='secret', _encrypt_method=3, _add_password_lengths=False)
|
|
130
|
+
|
|
131
|
+
Search for your device on `this pywemo issue`_ before opening a new issue if setup does not work for your device.
|
|
132
|
+
|
|
133
|
+
Firmware Warning
|
|
134
|
+
----------------
|
|
135
|
+
Starting in May of 2020, Belkin started requiring users to create an account and login to the app (Android app version 1.25).
|
|
136
|
+
In addition to the account, most of the app functionality now requires a connection to the cloud (internet access), even for simple actions such as toggling a switch.
|
|
137
|
+
All of the commands that go through the cloud are encrypted and cannot be easily inspected.
|
|
138
|
+
This raises the possibility that Belkin could, in the future, update WeMo device firmware and make breaking API changes that can no longer be deciphered.
|
|
139
|
+
If this happens, ``pywemo`` may no longer function on that device.
|
|
140
|
+
Thus it would be prudent to upgrade firmware cautiously and preferably only after confirming that breaking API changes have not been introduced.
|
|
141
|
+
|
|
142
|
+
Belkin Ends Support for WeMo
|
|
143
|
+
----------------------------
|
|
144
|
+
Note that Belkin is officially ending WeMo support on January 31, 2026.
|
|
145
|
+
After this date, the Belkin app will no longer work, including the required cloud access to use the current products.
|
|
146
|
+
This also means that you cannot use the Belkin app to connect a device to your network after this date either.
|
|
147
|
+
See `this link <https://www.belkin.com/support-article/?articleNum=335419>`_ for more details from Belkin.
|
|
148
|
+
|
|
149
|
+
The good news is that this change will **not** affect pywemo, which will continue to work as it currently does;
|
|
150
|
+
pywemo does not rely on the cloud connection for anything, including setup.
|
|
151
|
+
Many products can be setup and reset with pywemo, as discussed above.
|
|
152
|
+
|
|
153
|
+
Please see `this pywemo issue`_ to document the status of the various products and to update the table below on product status.
|
|
154
|
+
|
|
155
|
+
Product Status
|
|
156
|
+
--------------
|
|
157
|
+
This is a list of known products and the pywemo status of each, including for setup.
|
|
158
|
+
This list was started in November of 2025 in response to Belkin ending WeMo support.
|
|
159
|
+
Any entry with N/A is unreported since this table was added.
|
|
160
|
+
If you have any of these decvices and use them with PyWeMo, please let us know in `this pywemo issue`_ so that we can complete this list.
|
|
161
|
+
|
|
162
|
+
This list is mostly from the Belkin article mentioned above, but it may not be a complete list of all products.
|
|
163
|
+
SKU's with an asterisk at the end, like F7C029V2*, are not listed in the article.
|
|
164
|
+
|
|
165
|
+
========= ======================================= ==================== =================== ========================================
|
|
166
|
+
SKU's Description PyWeMo Object PyWeMo Setup Status Known Working Firmware(s)
|
|
167
|
+
========= ======================================= ==================== =================== ========================================
|
|
168
|
+
F7C031 Wemo Link Bridge N/A N/A
|
|
169
|
+
F7C046 Wemo Humidifier Humidifier N/A N/A
|
|
170
|
+
F7C045 Wemo CrockPot CrockPot N/A N/A
|
|
171
|
+
F7C048 Wemo Heater B N/A N/A N/A
|
|
172
|
+
F7C049 Wemo Air Purifier N/A N/A N/A
|
|
173
|
+
F7C047 Wemo Heater A N/A N/A N/A
|
|
174
|
+
F7C050 Wemo Coffee Maker (Mr. Coffee) CoffeeMaker N/A N/A
|
|
175
|
+
F8J007 Wi-Fi Baby Monitor N/A N/A N/A
|
|
176
|
+
F5Z0489 Wemo LED Lighting Bundle N/A N/A N/A
|
|
177
|
+
F7C028 Wemo Motion Sensor Motion N/A N/A
|
|
178
|
+
F5Z0340 Wemo Switch + Motion Sensor N/A N/A N/A
|
|
179
|
+
F7C043 Wemo Maker Module Maker Works WeMo_WW_2.00.11423.PVT-OWRT-Maker
|
|
180
|
+
F7C033 Wemo Zigbee Bulb, E27 N/A N/A N/A
|
|
181
|
+
F7C061 Wemo Insight v2 N/A N/A N/A
|
|
182
|
+
F7C027 Wemo Switch Switch Works WeMo_WW_2.00.11851.PVT-OWRT-SNS
|
|
183
|
+
F7C062 Wemo Light Switch v2 N/A N/A N/A
|
|
184
|
+
F7C029 Wemo Insight Insight Works WeMo_WW_2.00.11483.PVT-OWRT-Insight
|
|
185
|
+
F7C029V2* Wemo Insight V2 Insight Works WeMo_WW_2.00.10062.PVT-OWRT-InsightV2
|
|
186
|
+
WLS0403 Wemo Smart Light Switch 3-Way LightSwitchLongPress N/A N/A
|
|
187
|
+
WSP070 Wemo Mini Smart Plug N/A N/A N/A
|
|
188
|
+
WDS060 Wemo Wi-Fi Smart Light Switch w/ Dimmer DimmerV2 N/A WEMO_WW_2.00.20110904.PVT-RTOS-DimmerV2
|
|
189
|
+
WLS040 Wemo Smart Light Switch LightSwitchLongPress N/A N/A
|
|
190
|
+
F7C064 Wemo HomeKit N/A N/A N/A
|
|
191
|
+
F7C059 Wemo Dimmer Light Switch DimmerLongPress Works WeMo_WW_2.00.11453.PVT-OWRT-Dimmer
|
|
192
|
+
F7C063 Wemo Mini Plugin Switch Switch Works WeMo_WW_2.00.11452.PVT-OWRT-SNSV2
|
|
193
|
+
F7C030 Wemo Light Switch LightSwitchLongPress Works WeMo_WW_2.00.11408.PVT-OWRT-LS
|
|
194
|
+
WSP090 Wemo Outdoor Plug OutdoorPlug Works WEMO_WW_1.00.20081401.PVT-RTOS-OutdoorV1
|
|
195
|
+
WSP080 Wemo Mini Smart Plug Switch Works WEMO_WW_4.00.20101902.PVT-RTOS-SNSV4
|
|
196
|
+
========= ======================================= ==================== =================== ========================================
|
|
197
|
+
|
|
198
|
+
Developing
|
|
199
|
+
----------
|
|
200
|
+
Setup and builds are fully automated.
|
|
201
|
+
You can run the build pipeline locally via:
|
|
202
|
+
|
|
203
|
+
.. code-block::
|
|
204
|
+
|
|
205
|
+
# setup, install, format, lint, test and build:
|
|
206
|
+
./scripts/build.sh
|
|
207
|
+
|
|
208
|
+
Note that this will install a git ``pre-commit`` hook.
|
|
209
|
+
For this hook to work correctly, ``poetry`` needs to be globally accessible on your ``PATH`` or the local virtual environment must be activated.
|
|
210
|
+
This virtual environment can be activated with:
|
|
211
|
+
|
|
212
|
+
.. code-block::
|
|
213
|
+
|
|
214
|
+
. .venv/bin/activate
|
|
215
|
+
|
|
216
|
+
History
|
|
217
|
+
-------
|
|
218
|
+
This started as a stripped down version of `ouimeaux <https://github.com/iancmcc/ouimeaux>`_, copyright Ian McCracken, but has since taken its own path.
|
|
219
|
+
|
|
220
|
+
License
|
|
221
|
+
-------
|
|
222
|
+
All contents of the pywemo/ouimeaux_device directory are licensed under a BSD 3-Clause license. The full text of that license is maintained within the pywemo/ouimeaux_device/LICENSE file.
|
|
223
|
+
The rest of pyWeMo is released under the MIT license. See the top-level LICENSE file for more details.
|
|
224
|
+
|
|
225
|
+
.. _this pywemo issue: https://github.com/pywemo/pywemo/issues/773
|
|
226
|
+
|
|
227
|
+
.. |Build Badge| image:: https://github.com/pywemo/pywemo/workflows/Build/badge.svg
|
|
228
|
+
:target: https://github.com/pywemo/pywemo/actions?query=workflow%3ABuild
|
|
229
|
+
:alt: GitHub build status
|
|
230
|
+
.. |PyPI Version Badge| image:: https://img.shields.io/pypi/v/pywemo
|
|
231
|
+
:target: https://pypi.org/project/pywemo/
|
|
232
|
+
:alt: Latest PyPI version
|
|
233
|
+
.. |Coverage| image:: https://coveralls.io/repos/github/pywemo/pywemo/badge.svg?branch=main
|
|
234
|
+
:target: https://coveralls.io/github/pywemo/pywemo?branch=main
|
|
235
|
+
:alt: Coveralls coverage
|
|
236
|
+
.. |PyPI Downloads Badge| image:: https://img.shields.io/pypi/dm/pywemo
|
|
237
|
+
:target: https://pypi.org/project/pywemo/
|
|
238
|
+
:alt: Number of PyPI downloads
|
|
239
|
+
.. |Docs Badge| image:: https://github.com/pywemo/pywemo/actions/workflows/docs.yml/badge.svg
|
|
240
|
+
:target: https://pywemo.github.io/pywemo/
|
|
241
|
+
:alt: API Documentation
|
|
242
|
+
.. |Scorecard Badge| image:: https://api.securityscorecards.dev/projects/github.com/pywemo/pywemo/badge
|
|
243
|
+
:target: https://securityscorecards.dev/viewer/?uri=github.com/pywemo/pywemo
|
|
244
|
+
:alt: OpenSSF Scorecard
|
|
245
|
+
.. |Best Practices Badge| image:: https://bestpractices.coreinfrastructure.org/projects/7467/badge
|
|
246
|
+
:target: https://bestpractices.coreinfrastructure.org/projects/7467
|
|
247
|
+
:alt: OpenSSF Best Practices
|
|
248
|
+
.. |SLSA 3 Badge| image:: https://slsa.dev/images/gh-badge-level3.svg
|
|
249
|
+
:target: https://github.com/pywemo/pywemo/releases/latest#user-content-SLSA
|
|
250
|
+
:alt: SLSA level 3
|