Async UPnP Client
Project description
Async UPnP Client
=================
Asyncio UPnP Client library for Python/asyncio.
Written initially for use in `Home Assistant <https://github.com/home-assistant/home-assistant>`_ to drive `DLNA DMR`-capable devices, but useful for other projects as well.
Usage
-----
See `examples/` for examples on how to use async_upnp_client.
upnp-client
-----------
A command line interface is provided via the `upnp-client` script. This script can be used to:
- call an action
- subscribe to services and listen for events
- show UPnP traffic (--debug-traffic) from and to the device
- show pretty printed JSON (--pprint) for human readability
The output of the script is a single line of JSON for each action-call or subscription-event. See the programs help for more information.
An example of calling an action:
```
$ upnp-client --device http://192.168.178.10:49152/description.xml --pprint call-action RC/GetVolume InstanceID=0 Channel=Master
{
"timestamp": 1531482271.5603056,
"service_id": "urn:upnp-org:serviceId:RenderingControl",
"service_type": "urn:schemas-upnp-org:service:RenderingControl:1",
"action": "GetVolume",
"in_parameters": {
"InstanceID": 0,
"Channel": "Master"
},
"out_parameters": {
"CurrentVolume": 70
}
}
```
An example of subscribing to a service, note that the program stays running until you stop it (ctrl-c):
```
$ upnp-client --device http://192.168.178.10:49152/description.xml --pprint subscribe --bind 192.168.178.72 RC
{
"timestamp": 1531482518.3663802,
"service_id": "urn:upnp-org:serviceId:RenderingControl",
"service_type": "urn:schemas-upnp-org:service:RenderingControl:1",
"state_variables": {
"LastChange": "<Event xmlns=\"urn:schemas-upnp-org:metadata-1-0/AVT_RCS\">\n<InstanceID val=\"0\">\n<Mute channel=\"Master\" val=\"0\"/>\n<Volume channel=\"Master\" val=\"70\"/>\n</InstanceID>\n</Event>\n"
}
}
{
"timestamp": 1531482518.366804,
"service_id": "urn:upnp-org:serviceId:RenderingControl",
"service_type": "urn:schemas-upnp-org:service:RenderingControl:1",
"state_variables": {
"Mute": false,
"Volume": 70
}
}
...
```
DLNA
----
An abstraction has been added for `DLNA Digital Media Renderer` devices. Primarily built for use with `Home Assistant <https://github.com/home-assistant/home-assistant>`, but might be useful in other projects too.
=================
Asyncio UPnP Client library for Python/asyncio.
Written initially for use in `Home Assistant <https://github.com/home-assistant/home-assistant>`_ to drive `DLNA DMR`-capable devices, but useful for other projects as well.
Usage
-----
See `examples/` for examples on how to use async_upnp_client.
upnp-client
-----------
A command line interface is provided via the `upnp-client` script. This script can be used to:
- call an action
- subscribe to services and listen for events
- show UPnP traffic (--debug-traffic) from and to the device
- show pretty printed JSON (--pprint) for human readability
The output of the script is a single line of JSON for each action-call or subscription-event. See the programs help for more information.
An example of calling an action:
```
$ upnp-client --device http://192.168.178.10:49152/description.xml --pprint call-action RC/GetVolume InstanceID=0 Channel=Master
{
"timestamp": 1531482271.5603056,
"service_id": "urn:upnp-org:serviceId:RenderingControl",
"service_type": "urn:schemas-upnp-org:service:RenderingControl:1",
"action": "GetVolume",
"in_parameters": {
"InstanceID": 0,
"Channel": "Master"
},
"out_parameters": {
"CurrentVolume": 70
}
}
```
An example of subscribing to a service, note that the program stays running until you stop it (ctrl-c):
```
$ upnp-client --device http://192.168.178.10:49152/description.xml --pprint subscribe --bind 192.168.178.72 RC
{
"timestamp": 1531482518.3663802,
"service_id": "urn:upnp-org:serviceId:RenderingControl",
"service_type": "urn:schemas-upnp-org:service:RenderingControl:1",
"state_variables": {
"LastChange": "<Event xmlns=\"urn:schemas-upnp-org:metadata-1-0/AVT_RCS\">\n<InstanceID val=\"0\">\n<Mute channel=\"Master\" val=\"0\"/>\n<Volume channel=\"Master\" val=\"70\"/>\n</InstanceID>\n</Event>\n"
}
}
{
"timestamp": 1531482518.366804,
"service_id": "urn:upnp-org:serviceId:RenderingControl",
"service_type": "urn:schemas-upnp-org:service:RenderingControl:1",
"state_variables": {
"Mute": false,
"Volume": 70
}
}
...
```
DLNA
----
An abstraction has been added for `DLNA Digital Media Renderer` devices. Primarily built for use with `Home Assistant <https://github.com/home-assistant/home-assistant>`, but might be useful in other projects too.
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
async_upnp_client-0.12.0.tar.gz
(17.1 kB
view hashes)
Built Distribution
Close
Hashes for async_upnp_client-0.12.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f4567b92b925f94b7ca10386b08cf005a0424d9dfadee5bb24c25708944e0f4 |
|
MD5 | ffdbafbbe005da7548f48d05b192b46e |
|
BLAKE2b-256 | c971e500b9890ebec65d8d7e5dee9d9be2f2252edcf85dbabcf13a3b74ad1dcd |