Skip to main content

Nextion display serial client

Project description

Nextion serial client Build Status

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


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.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

nextion-1.2.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file nextion-1.2.0.tar.gz.

File metadata

  • Download URL: nextion-1.2.0.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/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.7

File hashes

Hashes for nextion-1.2.0.tar.gz
Algorithm Hash digest
SHA256 1898ce7e50ab531a5d83faa495253c45557021c31e28df127f678ce6989b918b
MD5 537f4ec21c3546ebe6d374167bf2b80a
BLAKE2b-256 a76458956b9e62579bf1d8acc6e7ff9aead782a671ab289421d24935eb7a194e

See more details on using hashes here.

File details

Details for the file nextion-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: nextion-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 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.6.7

File hashes

Hashes for nextion-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2af8b92d79d3633ce6eac4337f1d7386c4d962e2a4746e617f20921b3db3be10
MD5 e6d9e4bccb7e732e4766314dfcb95451
BLAKE2b-256 011dd9e72ad76b32dde046c2dd6be8d3dcdb24a0284e4a75ca2f6c212f499e15

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