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.2.1.tar.gz
(8.0 kB
view details)
Built Distribution
File details
Details for the file nextion-1.2.1.tar.gz
.
File metadata
- Download URL: nextion-1.2.1.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bf3f42728595e0011571e16529d5b90cb4c3da552b3dbd1dcaf029db40b354a |
|
MD5 | dbcee9be774a010285564e27d29d870e |
|
BLAKE2b-256 | 535311f32a28d090c2231f723e135c510afc57ccdcc2472e3aec3b14790ca089 |
File details
Details for the file nextion-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: nextion-1.2.1-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d90d239f8d0ad9c46b1d989d7741db19ce3d88a01d2f1b4706b9597596ab69e0 |
|
MD5 | 232b92d96773050352a64630943a170b |
|
BLAKE2b-256 | de8a7f5110c1abb1e73069f2ada80c6c50c7c4b0d4e01d37df40376b99ca094c |