Skip to main content

Client for Mewa server

Project description

# pymewa

## About
This is Python library which simplifies connection to the [Channel Server](https://github.com/AnthillTech/mewa).

## Requirements

* [WebSocket client](https://github.com/liris/websocket-client)


## Instalation

```bash
pip install mewa
```


## Sample usage pattern

List all devices connected to the channel

```python
connection = Connection("ws://mewa.cc/ws")

def onConnected():
connection.getDevices()
connection.sendEvent("serviceA.event2", "78")
connection.sendMessage("device66", "serviceA.level", "34")

def onEvent(fromDevice, eventId, params):
print("received event %s from %s with params %s" % (fromDevice, eventId, params))

def onMessage(fromDevice, eventId, params):
print("received message %s from %s with params %s" % (fromDevice, eventId, params))

def onDevicesEvent(devices):
print("Found devices:")
print(devices)


def onPropertyChanged(device, propertyName, value):
print("Property %s on device %s was changed to %s" % (device, propertyName, value))


if __name__ == "__main__":
connection.onConnected = onConnected
connection.onEvent = onEvent
connection.onMessage = onMessage
connection.onDevicesEvent = onDevicesEvent
connection.connect("test", "python", "pass")



```

## Redistributing
This code is distributed under BSD3 License. It may be freely redistributed, subject to the provisions of this license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mewa-0.3-dev.tar.gz (2.2 kB view details)

Uploaded Source

File details

Details for the file mewa-0.3-dev.tar.gz.

File metadata

  • Download URL: mewa-0.3-dev.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mewa-0.3-dev.tar.gz
Algorithm Hash digest
SHA256 9ae9c8fc7bdd779cad396774ce86a41f958409b757ab6c4488f39c5ee85cae9f
MD5 80d6147fcb8259ca05454d91372fa68c
BLAKE2b-256 44c7ff924c10ce44de14b0ed74e5b50aaa944ad82f9379ea1820a3f7bce35d6c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page