Nextion display serial client
Project description
Nextion serial client 
Lightweight Python 3.5+ async library to control Nextion displays.
Installation
Pypi
pip install nextion
Simple usage:
import asyncio
import logging
import random
from nextion import Nextion, EventType
def event_handler(type_, data):
if type_ == EventType.STARTUP:
print('We have booted up!')
logging.info('Event %s data: %s' % type, str(data))
async def run():
client = Nextion('/dev/ttyS1', 9600, event_handler)
await client.connect()
# await client.sleep()
# await client.wakeup()
# await client.command('sendxy=0')
print(await client.get('sleep'))
print(await client.get('field1.txt'))
await client.set('field1.txt', "%.1f" % (random.randint(0, 1000) / 10))
await client.set('field2.txt', "%.1f" % (random.randint(0, 1000) / 10))
await client.set('field3.txt', random.randint(0, 100))
print('finished')
if __name__ == '__main__':
logging.basicConfig(
format='%(asctime)s - %(levelname)s - %(message)s',
level=logging.DEBUG,
handlers=[
logging.StreamHandler()
])
loop = asyncio.get_event_loop()
asyncio.ensure_future(run())
loop.run_forever()
Additional resources:
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
nextion-1.1.1.tar.gz
(5.3 kB
view details)
File details
Details for the file nextion-1.1.1.tar.gz.
File metadata
- Download URL: nextion-1.1.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6833220a52dfa5c896c3008ba96a5725a4ec19a020d195b073f976f800e85db
|
|
| MD5 |
c3120a8256d453ff88b7a4dfcd59211d
|
|
| BLAKE2b-256 |
42ece79d3681d95853b160187e462094fe287b97b749299aa05a86fe3551768a
|