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.2.tar.gz
(5.3 kB
view details)
Built Distribution
File details
Details for the file nextion-1.1.2.tar.gz
.
File metadata
- Download URL: nextion-1.1.2.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 | d192f0a176c13a58031202cfe36f7a4dfe5b074b6d64bd763270a1402545b7d1 |
|
MD5 | 0df43014c6543e273013153d986112db |
|
BLAKE2b-256 | dabad7d2b86ce84e98c9266ecdecc179d0233042086d34b2e2ebeb7a98b2c706 |
File details
Details for the file nextion-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: nextion-1.1.2-py3-none-any.whl
- Upload date:
- Size: 8.8 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/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb4fdedeebeb731e3466d76a1b63c8aca70101314a2100c07a8d004baddd59a2 |
|
MD5 | c1e42d77a62a27eafab4bfe6a78b99b6 |
|
BLAKE2b-256 | e86c7f88aa0230595d5e23921ff8ed474e68c09446a8a327bf4d69ce80d295ca |