Python Lovense API client
Project description
LovensePy
LovensePy is a Python client for the Lovense developer APIs: Standard API over LAN (Game Mode) and cloud, Socket API (WebSocket, optional LAN command path), and Toy Events. Optional pieces include a Home Assistant MQTT bridge and direct BLE control.
Who it is for: developers building scripts, bots, dashboards, Home Assistant integrations, or experiments. Lovense’s official docs remain the source of truth for protocol behavior; this library wraps those flows in typed, tested Python.
Install
pip install lovensepy
Optional extras:
pip install 'lovensepy[mqtt]' # Home Assistant MQTT bridge service + paho-mqtt; run: lovensepy-mqtt
pip install 'lovensepy[ble]' # Direct BLE (bleak, pick for examples)
Docker Compose: Mosquitto + Home Assistant
The root docker-compose.yml starts Mosquitto and Home Assistant only. The LovensePy MQTT bridge runs on the host (BLE needs Bluetooth; LAN is simpler that way too). See compose/README.md and Home Assistant MQTT.
Minimal example (Game Mode)
from lovensepy import LANClient, Actions
client = LANClient("MyApp", "192.168.1.100", port=20011)
client.function_request({Actions.VIBRATE: 10}, time=3)
Enable Game Mode in Lovense Remote, use the app host’s IP, and pick the right port (e.g. 20011 for Remote, 34567 for Connect). Full setup, tutorials, and API tables are on GitHub Pages (or browse the docs folder in the repository).
For async/await code, AsyncLANClient, AsyncServerClient, BleDirectHub, and BleDirectClient all subclass LovenseAsyncControlClient: same control methods so you can switch transport by changing only construction. See Connection methods and the API reference.
How clients reach the toy
flowchart TB
subgraph yourCode [Your app]
LANClient
AsyncLANClient
ServerClient
AsyncServerClient
SocketAPIClient
ToyEventsClient
BleDirect[BleDirectClient / BleDirectHub]
HAMqttBridge
end
subgraph localNet [Local network]
RemoteApp[Lovense app]
Toy[Lovense toy]
MQTTBroker[MQTT broker]
end
subgraph cloudLayer [Lovense cloud]
LovenseServer[Lovense server]
end
LANClient -->|"HTTP/HTTPS"| RemoteApp
AsyncLANClient -->|"HTTP/HTTPS"| RemoteApp
RemoteApp --> Toy
ServerClient -->|"HTTPS"| LovenseServer
AsyncServerClient -->|"HTTPS"| LovenseServer
LovenseServer --> RemoteApp
SocketAPIClient -->|"WebSocket"| LovenseServer
SocketAPIClient -->|"HTTPS when use_local_commands"| RemoteApp
ToyEventsClient -->|"WebSocket"| RemoteApp
HAMqttBridge -->|"LAN: HTTP + Toy Events WS"| RemoteApp
HAMqttBridge -.->|"BLE mode: direct"| Toy
HAMqttBridge <-->|"MQTT"| MQTTBroker
BleDirect -.->|"BLE"| Toy
Documentation and official APIs
- Project docs (site): lovensepy.koval-dev.org — source: docs/index.en.md (Russian: index.ru.md)
- Lovense Standard API
- Lovense Socket API
- Toy Events API
Changelog
See CHANGELOG.md.
License
Apache License 2.0 — see LICENSE for full text.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lovensepy-1.1.4.tar.gz.
File metadata
- Download URL: lovensepy-1.1.4.tar.gz
- Upload date:
- Size: 140.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba6221487e7313b4b1c78e04af3f38c1bb17f8199bdaeae150006fbbc9065147
|
|
| MD5 |
5616fa98fb5b6949ad53e20a18b20f20
|
|
| BLAKE2b-256 |
2231306a4249898faa35f9396b040984d323ba6f1e0fb8ddb47f3524c8019528
|
Provenance
The following attestation bundles were made for lovensepy-1.1.4.tar.gz:
Publisher:
publish-pypi.yml on koval01/lovensepy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lovensepy-1.1.4.tar.gz -
Subject digest:
ba6221487e7313b4b1c78e04af3f38c1bb17f8199bdaeae150006fbbc9065147 - Sigstore transparency entry: 1201123642
- Sigstore integration time:
-
Permalink:
koval01/lovensepy@b559160af2ea86f8a1d23bb02e4618444b6c7ca5 -
Branch / Tag:
refs/tags/v1.1.4 - Owner: https://github.com/koval01
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@b559160af2ea86f8a1d23bb02e4618444b6c7ca5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lovensepy-1.1.4-py3-none-any.whl.
File metadata
- Download URL: lovensepy-1.1.4-py3-none-any.whl
- Upload date:
- Size: 144.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc5c10daafc3804905291af911d49f00425c5ee18b6bf040b97fea7e167d1403
|
|
| MD5 |
34d2435db179da6063dfe7ccac28552e
|
|
| BLAKE2b-256 |
8131b45efdde0185c6dd613e991dbd6369b22ffc45e01831923ff440bbd03ed2
|
Provenance
The following attestation bundles were made for lovensepy-1.1.4-py3-none-any.whl:
Publisher:
publish-pypi.yml on koval01/lovensepy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lovensepy-1.1.4-py3-none-any.whl -
Subject digest:
dc5c10daafc3804905291af911d49f00425c5ee18b6bf040b97fea7e167d1403 - Sigstore transparency entry: 1201123653
- Sigstore integration time:
-
Permalink:
koval01/lovensepy@b559160af2ea86f8a1d23bb02e4618444b6c7ca5 -
Branch / Tag:
refs/tags/v1.1.4 - Owner: https://github.com/koval01
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@b559160af2ea86f8a1d23bb02e4618444b6c7ca5 -
Trigger Event:
release
-
Statement type: