Code Monkey home page Code Monkey logo

nextion's People

Contributors

sputnik-dancarroll avatar yozik04 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nextion's Issues

Firmware upload and flashing

When yesterday I mentioned errors trying to flash the firmware, I tried the function upload_firmware of client.py: there, the error was about the wrong type of model selected (at least, that's what the screen itself was displaying).

I tried the script that you suggested last night:
python3 -m nextion.console_scripts.upload_firmware /dev/ttyAMA0 115200 test.tft

But this is what I'm getting:

2020-04-24 11:58:47,403 INFO nextion.nextion.client Connecting: /dev/ttyAMA0, baud: 115200
2020-04-24 11:58:47,405 INFO nextion.nextion.protocol Connected to serial
2020-04-24 11:58:47,406 DEBUG nextion.nextion.protocol sent: b'DRAKJHSUYDGBNCJHGJKSHBDN'
2020-04-24 11:58:47,409 DEBUG nextion.nextion.protocol received: b'1a'
2020-04-24 11:58:47,450 DEBUG nextion.nextion.protocol sent: b'connect'
2020-04-24 11:58:47,459 DEBUG nextion.nextion.protocol received: b'636f6d6f6b20312c33303631342d302c4e58343833324b3033355f303131522c3134322c36313639392c444236393043313544333232333932442c3333353534343332'
2020-04-24 11:58:47,461 INFO nextion.nextion.client Address: 30614-0
2020-04-24 11:58:47,462 INFO nextion.nextion.client Detected model: NX4832K035_011R
2020-04-24 11:58:47,463 INFO nextion.nextion.client Firmware version: 142
2020-04-24 11:58:47,463 INFO nextion.nextion.client Serial number: DB690C15D322392D
2020-04-24 11:58:47,464 DEBUG nextion.nextion.client Flash size: 33554432
2020-04-24 11:58:47,464 DEBUG nextion.nextion.protocol sent: b'bkcmd=3'
2020-04-24 11:58:47,466 DEBUG nextion.nextion.protocol received: b'01'
2020-04-24 11:58:47,468 DEBUG nextion.nextion.protocol sent: b'get sleep'
2020-04-24 11:58:47,470 DEBUG nextion.nextion.protocol received: b'7100000000'
2020-04-24 11:58:47,471 DEBUG nextion.nextion.protocol received: b'01'
2020-04-24 11:58:47,472 INFO nextion.nextion.client Successfully connected to the device
2020-04-24 11:58:47,473 INFO nextion.nextion.client About to upload ./screen/test.tft(2206552 bytes)
2020-04-24 11:58:47,473 DEBUG nextion.nextion.protocol sent: b'sleep=0'
2020-04-24 11:58:47,475 DEBUG nextion.nextion.protocol received: b'01'
2020-04-24 11:58:47,627 DEBUG nextion.nextion.protocol sent: b'usup=1'
2020-04-24 11:58:47,629 DEBUG nextion.nextion.protocol received: b'01'
2020-04-24 11:58:47,630 DEBUG nextion.nextion.protocol sent: b'ussp=0'
2020-04-24 11:58:47,632 DEBUG nextion.nextion.protocol received: b'01'
2020-04-24 11:58:47,633 DEBUG nextion.nextion.protocol sent: b'whmi-wri 2206552,115200,0'
2020-04-24 11:58:47,980 DEBUG nextion.nextion.protocol received in upload mode: b'05'
2020-04-24 11:58:47,981 DEBUG nextion.nextion.protocol sent: b"\x00\x01<N2E\x01\x00\x00\x00\x00\x00\xe0\x01@\x01@\x01\xe0\x01\x01\x01\x00\x02\xc6\x00\x03\x00\x00\x00\xc6\x00\x03\x00\xdcO\x00\x002E\x01\x00\x94\xbb\x01\x00\xbe$\xd3\x1b!\x00\x00\x00\x01\x00\x0c\x00\x00\x00X\xab!\x00\x00\x00\x1d\x00~\xddML\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x94\x04\xc2\xdf\xea~\xfe\x95\xea~\xfe\x95\xd4\xbe\xfe\x95\xb6~\xfe\x95\xd7\xbe\xff\x95\xd7\xbe\xe0\x95\xdeE\xde\x95VE\xde\x95;5\xfd\x95\xd7\xbe\xfe\x95\xd7\xbe\xfe\x95\xd7\xbe\xfe\x95\xf7\xa2\xe2\x95\x83\xbe\xfe\x95\xdd\xbe<\x95\xef\xbe\xfe\x95\xd7\xbe\xfe\x95\xd2\xbe\xfe\x95\xd4\xbe\xfe\x95\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'\xba\xee\x87\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
2020-04-24 11:58:49,413 ERROR root Failed to upload firmware
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/nextion/console_scripts/upload_firmware.py", line 13, in upload
await nextion.upload_firmware(args.file)
File "/usr/local/lib/python3.5/dist-packages/nextion/client.py", line 349, in upload_firmware
res = await self._read(timeout=timeout)
File "/usr/local/lib/python3.5/dist-packages/nextion/client.py", line 201, in _read
return await asyncio.wait_for(self._connection.read(), timeout=timeout)
File "/usr/lib/python3.5/asyncio/tasks.py", line 404, in wait_for
raise futures.TimeoutError()
concurrent.futures._base.TimeoutError

The screen doesn't display any error, it enters the flashing mode correctly and it is stuck in "writing DATA..."

No response from async event handler

Hi, im using the exact same script like here and also get no response. But when run

import serial
    s = serial.Serial('/dev/ttyS1', 115200)
    while(True):
        res = s.read()
        print(res)

in the main function instead of the loop I'm getting this response:

b'\x01'
b'\x03'
b'\xff'
b'\xff'
b'\xff'

Switching the event_handler to sync (without await) won't work either. Any idea why the event handler don't work?

Baud issues

Hi, I am currently trying to upload .tft file to nextion display using raspberrypi zero through serial. But I get an error:

Any help will be appreciated, thanks!

pi@raspberrypi:~ $ nextion-fw-upload /dev/ttyS0 hello.tft
2022-02-11 14:29:31,833 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 2400
2022-02-11 14:29:31,841 INFO nextion.nextion.protocol.base Connected to serial
2022-02-11 14:29:33,646 WARNING nextion.nextion.client No valid reply on 2400 baud. Closing connection
2022-02-11 14:29:33,651 ERROR nextion.nextion.protocol.base Connection lost
2022-02-11 14:29:33,656 WARNING nextion.nextion.client Baud 2400 did not work
2022-02-11 14:29:33,660 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 4800
2022-02-11 14:29:33,667 INFO nextion.nextion.protocol.base Connected to serial
2022-02-11 14:29:34,645 WARNING nextion.nextion.client No valid reply on 4800 baud. Closing connection
2022-02-11 14:29:34,649 ERROR nextion.nextion.protocol.base Connection lost
2022-02-11 14:29:34,654 WARNING nextion.nextion.client Baud 4800 did not work
2022-02-11 14:29:34,657 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 9600
2022-02-11 14:29:34,664 INFO nextion.nextion.protocol.base Connected to serial
2022-02-11 14:29:34,933 INFO nextion.nextion.client Address: 30611
2022-02-11 14:29:34,936 INFO nextion.nextion.client Detected model: NX4024T032_011R
2022-02-11 14:29:34,939 INFO nextion.nextion.client Firmware version: 78
2022-02-11 14:29:34,942 INFO nextion.nextion.client Serial number: DE602478A74A6831
2022-02-11 14:29:34,945 INFO nextion.nextion.client Flash size: 4194304
2022-02-11 14:29:34,999 INFO nextion.nextion.client Successfully connected to the device
2022-02-11 14:29:35,001 INFO nextion.nextion.client About to upload 168299 bytes
2022-02-11 14:29:35,193 WARNING nextion.nextion.client Additional sleep configuration failed: Variable name invalid for command: usup=1
2022-02-11 14:29:35,197 INFO nextion.nextion.client Reconnecting at new baud rate: 115200
2022-02-11 14:29:35,251 ERROR nextion.nextion.protocol.base Connection lost
2022-02-11 14:29:35,259 INFO nextion.nextion.protocol.base Connected to serial
2022-02-11 14:29:35,631 INFO nextion.nextion.client Device is ready to accept upload
2022-02-11 14:29:41,764 ERROR root Failed to upload firmware
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.9/site-packages/nextion/protocol/base.py", line 37, in read
return await self.queue.get()
File "/usr/lib/python3.9/asyncio/queues.py", line 166, in get
await getter
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for
fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/pi/.local/lib/python3.9/site-packages/nextion/console_scripts/upload_firmware.py", line 14, in upload
await nextion.upload_firmware(args.file, args.upload_baud)
File "/home/pi/.local/lib/python3.9/site-packages/nextion/client.py", line 394, in upload_firmware
res = await self.read_packet(timeout=timeout)
File "/home/pi/.local/lib/python3.9/site-packages/nextion/client.py", line 221, in read_packet
return await asyncio.wait_for(self._connection.read(), timeout=timeout)
File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for
raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

Upgrade Failed for Nextion 10" Intelligent Series Display

Hi Jevgeni Kiski,

I have installed the package using 'pip3 install nextion' as described in the https://pypi.org/project/nextion/ page.

I am getting the following error during the upgrade.
Can you suggest how to resolve the below error?

Let me know if you need more details logs.

Regards,
Karthik

=========
Detailed Log

karthik@karthik:~/nextion_hmi$ nextion-fw-upload -b 9600 -ub 115200 /dev/ttyUSB0 ./Display.tft
2020-12-26 18:13:04,846 INFO nextion.nextion.client Connecting: /dev/ttyUSB0, baud: 9600
2020-12-26 18:13:05,396 INFO nextion.nextion.protocol.base Connected to serial
2020-12-26 18:13:05,764 INFO nextion.nextion.client Address: 4113-0
2020-12-26 18:13:05,766 INFO nextion.nextion.client Detected model: NX1060P101_011R
2020-12-26 18:13:05,767 INFO nextion.nextion.client Firmware version: 132
2020-12-26 18:13:05,768 INFO nextion.nextion.client Serial number: 55163401B399E55C
2020-12-26 18:13:05,768 INFO nextion.nextion.client Flash size: 131072000-0
2020-12-26 18:13:05,871 ERROR nextion.nextion.client Unknown data received: b'636f6d6f6b20312c343131332d302c4e5831303630503130315f303131522c3133322c31303530312c353531363334303142333939453535432c3133313037323030302d30'
2020-12-26 18:13:05,932 INFO nextion.nextion.client Successfully connected to the device
2020-12-26 18:13:05,933 INFO nextion.nextion.client About to upload 1550856 bytes
2020-12-26 18:13:06,268 INFO nextion.nextion.client Reconnecting at new baud rate: 115200
2020-12-26 18:13:06,371 ERROR nextion.nextion.protocol.base Connection lost
2020-12-26 18:13:07,308 INFO nextion.nextion.protocol.base Connected to serial
2020-12-26 18:13:08,311 ERROR root Failed to upload firmware
Traceback (most recent call last):
File "/home/karthik/.local/lib/python3.8/site-packages/nextion/console_scripts/upload_firmware.py", line 14, in upload
await nextion.upload_firmware(args.file, args.upload_baud)
File "/home/karthik/.local/lib/python3.8/site-packages/nextion/client.py", line 371, in upload_firmware
res = await self.read_packet(timeout=1)
File "/home/karthik/.local/lib/python3.8/site-packages/nextion/client.py", line 215, in read_packet
return await asyncio.wait_for(self._connection.read(), timeout=timeout)
File "/usr/lib/python3.8/asyncio/tasks.py", line 490, in wait_for
raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError

======================
Detailed Log with Verbose Option

karthik@karthik:~/nextion_hmi$ nextion-fw-upload -b 9600 -ub 115200 -v /dev/ttyUSB0 ./Display.tft
2020-12-26 18:21:51,117 INFO nextion.nextion.client Connecting: /dev/ttyUSB0, baud: 9600
2020-12-26 18:21:51,657 INFO nextion.nextion.protocol.base Connected to serial
2020-12-26 18:21:51,659 DEBUG nextion.nextion.protocol.nextion sent: b'DRAKJHSUYDGBNCJHGJKSHBDN'
2020-12-26 18:21:51,735 DEBUG nextion.nextion.protocol.nextion received: b'1a'
2020-12-26 18:21:51,876 DEBUG nextion.nextion.protocol.nextion sent: b'connect'
2020-12-26 18:21:52,013 DEBUG nextion.nextion.protocol.nextion sent: b'\xff\xffconnect'
2020-12-26 18:21:52,025 DEBUG nextion.nextion.protocol.nextion received: b'636f6d6f6b20312c343131332d302c4e5831303630503130315f303131522c3133322c31303530312c353531363334303142333939453535432c3133313037323030302d30'
2020-12-26 18:21:52,026 INFO nextion.nextion.client Address: 4113-0
2020-12-26 18:21:52,027 INFO nextion.nextion.client Detected model: NX1060P101_011R
2020-12-26 18:21:52,028 INFO nextion.nextion.client Firmware version: 132
2020-12-26 18:21:52,028 INFO nextion.nextion.client Serial number: 55163401B399E55C
2020-12-26 18:21:52,029 INFO nextion.nextion.client Flash size: 131072000-0
2020-12-26 18:21:52,029 DEBUG nextion.nextion.protocol.nextion sent: b'bkcmd=3'
2020-12-26 18:21:52,132 DEBUG nextion.nextion.protocol.nextion received: b'636f6d6f6b20312c343131332d302c4e5831303630503130315f303131522c3133322c31303530312c353531363334303142333939453535432c3133313037323030302d30'
2020-12-26 18:21:52,133 DEBUG nextion.nextion.protocol.nextion received: b'01'
2020-12-26 18:21:52,134 ERROR nextion.nextion.client Unknown data received: b'636f6d6f6b20312c343131332d302c4e5831303630503130315f303131522c3133322c31303530312c353531363334303142333939453535432c3133313037323030302d30'
2020-12-26 18:21:52,135 DEBUG nextion.nextion.protocol.nextion sent: b'get sleep'
2020-12-26 18:21:52,191 DEBUG nextion.nextion.protocol.nextion received: b'7100000000'
2020-12-26 18:21:52,192 INFO nextion.nextion.client Successfully connected to the device
2020-12-26 18:21:52,192 INFO nextion.nextion.client About to upload 1550856 bytes
2020-12-26 18:21:52,192 DEBUG nextion.nextion.protocol.nextion sent: b'sleep=0'
2020-12-26 18:21:52,270 DEBUG nextion.nextion.protocol.nextion received: b'01'
2020-12-26 18:21:52,422 DEBUG nextion.nextion.protocol.nextion sent: b'usup=1'
2020-12-26 18:21:52,466 DEBUG nextion.nextion.protocol.nextion received: b'01'
2020-12-26 18:21:52,468 DEBUG nextion.nextion.protocol.nextion sent: b'ussp=0'
2020-12-26 18:21:52,548 DEBUG nextion.nextion.protocol.nextion received: b'01'
2020-12-26 18:21:52,549 DEBUG nextion.nextion.protocol.nextion sent: b'whmi-wri 1550856,115200,0'
2020-12-26 18:21:52,550 INFO nextion.nextion.client Reconnecting at new baud rate: 115200
2020-12-26 18:21:52,671 ERROR nextion.nextion.protocol.base Connection lost
2020-12-26 18:21:53,546 INFO nextion.nextion.protocol.base Connected to serial
2020-12-26 18:21:54,548 ERROR root Failed to upload firmware
Traceback (most recent call last):
File "/home/karthik/.local/lib/python3.8/site-packages/nextion/console_scripts/upload_firmware.py", line 14, in upload
await nextion.upload_firmware(args.file, args.upload_baud)
File "/home/karthik/.local/lib/python3.8/site-packages/nextion/client.py", line 371, in upload_firmware
res = await self.read_packet(timeout=1)
File "/home/karthik/.local/lib/python3.8/site-packages/nextion/client.py", line 215, in read_packet
return await asyncio.wait_for(self._connection.read(), timeout=timeout)
File "/usr/lib/python3.8/asyncio/tasks.py", line 490, in wait_for
raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError

===========
Package Version

karthik@karthik:~/nextion_hmi$ pip3 list | grep nextion
nextion 1.7.1

setting numeric values in Nextion with .set

When setting values to xx.val objects in Nextion an error " 1C" occurs.

In .set routine in client.py the value is converted to a string format.
Could it be that .val objects in Nextion need a number format ?

And how do i change it in the class client.py in my program then?

async def set(self, key, value, timeout=IO_TIMEOUT):
if isinstance(value, str):
out_value = '"%s"' % value
elif isinstance(value, float):
logger.warning("Float is not supported. Converting to string")
out_value = '"%s"' % str(value)
elif isinstance(value, int):
out_value = str(value)

Device never fully connects

It looks like, in client.py, there is a missing case to break out of the loop to receive a response. After sending "get sleep," a NUMERIC result is received but "finished" is never set to True. This means that it will ignore the result and go back to waiting for a reply and eventually time out.

I think "finished=True" is needed around line 283

Stylistically, this may not be the best solution though, so I have left it to you, rather than submit a merge request.

-rob


                res_len = len(response)
                if res_len == 0:
                    finished = True
                elif res_len == 1:  # is response code
                    response_code = response[0]
                    if response_code == 0x01:  # success
                        result = True
                        finished = True
                    else:
                        raise CommandFailed(command, response_code)
                else:
####  NEED TO BREAK OUT OF LOOP
finished = True  # <-------------------
                    type_ = response[0]
                    raw = response[1:]
                    if type_ == ResponseType.PAGE:  # Page ID
                        data = raw[1]
                    elif type_ == ResponseType.STRING:  # string
                        data = raw.decode(self._encoding)
                    elif type_ == ResponseType.NUMBER:  # number
                        data = struct.unpack("i", raw)[0]
                    else:
                        logger.error(
                            "Unknown data received: %s" % binascii.hexlify(response)
                        )

[Question] Read response from Nextion

Hi,
thank you for this library, it's nice to have a lightweight one to push data to Nextion screens.
I would like to know how it would possible to read the response back from a screen, like a touch event, or a custom string pushed back in certain occasions.
What is the function to read? Thanks!

Can not load firmware

I have a program running successfully using the Nextion on /dev/ttyS0 and baud rate 9600. It does not use your software but uses pyserial.

I installed this software, version 1.6.1, and am trying to use it to upload firmware. But when I run nextion-fw-upload -b 9600 /dev/ttyS0 homedata.tft I always get nextion.exceptions.ConnectionFailed: No baud rate suited after it runs through the available choices. I terminate the other program before I run this program.

Am I doing something wrong?

Thanks

Degree symbol

I cannot get a degree symbol to pass to the Nextion from Raspberry Pi Zero Python

output = Fahrenheit ,(degree_sign,'utf-8')
await client.set('InTemp.txt', str(output))

UnicodeEncodeError: 'ascii' codec can't encode character '\xb0' in position 19: ordinal not in range(128)

Mike

Installation failed

Like to explore and use this library but can get it installed.
Any idea what is going wrong?

KR.

pi@raspberrypi:~ $ pip install nextion==1.6.1
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting nextion==1.6.1
Could not find a version that satisfies the requirement nextion==1.6.1 (from versions: )
No matching distribution found for nextion==1.6.1

Variable name invalid for command: usup=1

Nextion editor
1.61.1

Display: Nextion enhanced NX3224K024

After using pip to install the library I got some errors regarding the "sleep" command. This was resolved after updating: #10

Now I am getting a different error when uploading. Please see the log below:

pi@raspberrypi:~/nextion $ nextion-fw-upload -v /dev/ttyS0 first.tft
2020-08-08 10:24:15,113 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 2400
2020-08-08 10:24:15,114 INFO nextion.nextion.protocol Connected to serial
2020-08-08 10:24:15,115 DEBUG nextion.nextion.protocol sent: b'DRAKJHSUYDGBNCJHGJKSHBDN'
2020-08-08 10:24:16,011 DEBUG nextion.nextion.protocol sent: b'connect'
2020-08-08 10:24:16,460 DEBUG nextion.nextion.protocol sent: b'\xff\xffconnect'
2020-08-08 10:24:16,908 WARNING nextion.nextion.client No valid reply on 2400 baud. Closing connection
2020-08-08 10:24:16,909 ERROR nextion.nextion.protocol Connection lost
2020-08-08 10:24:16,910 WARNING nextion.nextion.client Baud 2400 did not work
2020-08-08 10:24:16,910 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 4800
2020-08-08 10:24:16,912 INFO nextion.nextion.protocol Connected to serial
2020-08-08 10:24:16,913 DEBUG nextion.nextion.protocol sent: b'DRAKJHSUYDGBNCJHGJKSHBDN'
2020-08-08 10:24:17,395 DEBUG nextion.nextion.protocol sent: b'connect'
2020-08-08 10:24:17,636 DEBUG nextion.nextion.protocol sent: b'\xff\xffconnect'
2020-08-08 10:24:17,878 WARNING nextion.nextion.client No valid reply on 4800 baud. Closing connection
2020-08-08 10:24:17,878 ERROR nextion.nextion.protocol Connection lost
2020-08-08 10:24:17,879 WARNING nextion.nextion.client Baud 4800 did not work
2020-08-08 10:24:17,879 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 9600
2020-08-08 10:24:17,881 INFO nextion.nextion.protocol Connected to serial
2020-08-08 10:24:17,882 DEBUG nextion.nextion.protocol sent: b'DRAKJHSUYDGBNCJHGJKSHBDN'
2020-08-08 10:24:17,915 DEBUG nextion.nextion.protocol received: b'1a'
2020-08-08 10:24:18,051 DEBUG nextion.nextion.protocol sent: b'connect'
2020-08-08 10:24:18,132 DEBUG nextion.nextion.protocol received: b'636f6d6f6b20312c33303630312c4e58333232344b3032345f303131522c37382c36313438392c453436393938443139463131323433312c3136373737323136'
2020-08-08 10:24:18,133 INFO nextion.nextion.client Address: 30601
2020-08-08 10:24:18,134 INFO nextion.nextion.client Detected model: NX3224K024_011R
2020-08-08 10:24:18,134 INFO nextion.nextion.client Firmware version: 78
2020-08-08 10:24:18,134 INFO nextion.nextion.client Serial number: E46998D19F112431
2020-08-08 10:24:18,134 INFO nextion.nextion.client Flash size: 16777216
2020-08-08 10:24:18,135 DEBUG nextion.nextion.protocol sent: b'bkcmd=3'
2020-08-08 10:24:18,150 DEBUG nextion.nextion.protocol received: b'01'
2020-08-08 10:24:18,151 DEBUG nextion.nextion.protocol sent: b'get sleep'
2020-08-08 10:24:18,172 DEBUG nextion.nextion.protocol received: b'7100000000'
2020-08-08 10:24:18,172 INFO nextion.nextion.client Successfully connected to the device
2020-08-08 10:24:18,173 INFO nextion.nextion.client About to upload 265960 bytes
2020-08-08 10:24:18,173 DEBUG nextion.nextion.protocol sent: b'sleep=0'
2020-08-08 10:24:18,188 DEBUG nextion.nextion.protocol received: b'01'
2020-08-08 10:24:18,339 DEBUG nextion.nextion.protocol sent: b'usup=1'
2020-08-08 10:24:18,353 DEBUG nextion.nextion.protocol received: b'1a'
2020-08-08 10:24:18,354 ERROR root Failed to upload firmware
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/nextion/console_scripts/upload_firmware.py", line 14, in upload
await nextion.upload_firmware(args.file, args.upload_baud)
File "/home/pi/.local/lib/python3.7/site-packages/nextion/client.py", line 358, in upload_firmware
await self.set("usup", 1)
File "/home/pi/.local/lib/python3.7/site-packages/nextion/client.py", line 239, in set
return await self.command("%s=%s" % (key, out_value), timeout=timeout)
File "/home/pi/.local/lib/python3.7/site-packages/nextion/client.py", line 325, in command
return await self._command(command, timeout=timeout, attempts=attempts)
File "/home/pi/.local/lib/python3.7/site-packages/nextion/client.py", line 288, in _command
raise CommandFailed(command, response_code)
nextion.exceptions.CommandFailed: Variable name invalid for command: usup=1

Different character encodings

Well, it's me again, your nightmare!

This time I would like to discuss with you about the possibility to add support for multiple character encodings.

Serial connection to Nextion only supports ASCII, and so all UTF-8 characters that use 2 bytes for encoding are "lost in translation" (like é, ç, ä, etc.).
From the Nextion Editor it is possible to set a different encoding for the screen, like the ISO-8859-x Single Byte Character Set (SBCS) encoding (this PDF was enlightening to grasp the issue).

From the Python endpoint, it is necessary that the encoding is set on the same type of the screen.
In protocol.py, in the write function, if you change data = data.encode() to, for example, data = data.encode(iso-8859-1'), "special" characters are properly displayed on the screen (of course it has to be set on the same encoding from the Nextion Editor, as previously specified).

I tried to modify your library so that it is possible to specify a different encoding, in a fashion similar to what you did for the timeout with the IO_TIMEOUT global variable in client.py.
The result probably isn't in line with your coding style (or coding best practices), but I'll soon propose it as a commit to protocol.py and client.py for you to review.

Nextion Baud Problem

First of all, thank you for the library. I downloaded and installed the library and first I wanted to run the sample code you posted, but I can't run it because I got the baud error I shared below.

2021-06-04 16:09:25,938 - INFO - Connecting: COM4, baud: 9600
2021-06-04 16:09:25,950 - INFO - Connected to serial
2021-06-04 16:09:25,951 - DEBUG - sent: b'DRAKJHSUYDGBNCJHGJKSHBDN'
2021-06-04 16:09:26,198 - DEBUG - sent: b'connect'
2021-06-04 16:09:26,332 - DEBUG - sent: b'\xff\xffconnect'
2021-06-04 16:09:26,456 - WARNING - No valid reply on 9600 baud. Closing connection

What should i do to solve this error? Thank you for everything.

ModuleNotFoundError: No module named 'nextion'

Hi there, I have no circular import, and there are no files with the same names in the directory. I have successfully installed the extension library.
I'm running your examples on raspi 4

Привет, у меня нет циклического импорта, и в каталоге нет файлов с одинаковыми именами. Я успешно установил библиотеку...
Код запускаю с четвёртой распберри

How to send nextion command in event_handler function?

Hello

I'm using nextion display to make some projects.
I'm trying so much to find out about library nextion for python then I found your library.

It easy to understand for me. but have some functions that I don't know how to use.

A simple code is I want to go to the next page when I press a button.
This I trying.

async def event_handler(type_, data):
    if type_ == EventType.TOUCH:
        await client.command('page 1')

and I add global to run()

async def run():
    global client
    client = Nextion('/dev/ttyAMA0', 9600, event_handler)
    await client.connect()
    await client.wakeup()

It dosen't work and I don't any have idea.

Error encountered when negative integer is received by Python

Hi Jevgeni,
First of congratulations on creating such a nice and easy library to use with Nextion HMI. I have been using it, and very pleased to find it.

Recently, encountered an issue when receiving negative value from the HMI. Below is the stack trace of the error. Hopefully the fix will be the part of the next release.

Once again thanks for such a nice library.

Best Regards,
Ashish

2020-12-18 20:07:37,983 - DEBUG - sent: b'get device_page.val'
2020-12-18 20:07:37,994 - DEBUG - received: b'71a5'
2020-12-18 20:07:37,995 - DEBUG - received: b''
2020-12-18 20:07:37,996 - ERROR - Task exception was never retrieved
future: <Task finished coro=<device() done, defined at next.py:114> exception=error('unpack requires a buffer of 4 bytes')>
Traceback (most recent call last):
File "next.py", line 159, in device
page = await nex.get("device_page.val")
File "/home/pi/aros_py/nextion/client.py", line 227, in get
return await self.command("get %s" % key, timeout=timeout)
File "/home/pi/aros_py/nextion/client.py", line 351, in command
return await self._command(command, timeout=timeout, attempts=attempts)
File "/home/pi/aros_py/nextion/client.py", line 323, in _command
data = struct.unpack("i", raw)[0]
struct.error: unpack requires a buffer of 4 bytes

Reading negative integer value from variable

Hi, it's me again :)
I'm having some troubles reading a negative integer from a variable: if it's ≥0, I can get its value no problem, but with, for example, -1, this is what I get:

(<class 'nextion.exceptions.CommandFailed'>, CommandFailed("Unknown response code 0x71 for command: 'get varUTC.val'",), <traceback object at 0x75684a30>)
Unknown data received: b'ff7102000000'
(<class 'TypeError'>, TypeError("int() argument must be a string, a bytes-like object or a number, not 'NoneType'",), <traceback object at 0x756864e0>)

Any clue?
Thanks!

Reading with python, username and password text data from Nextion

Hello!
I am trying to read in python, text data from nextion for validate user and password information.
Pressing button b0.txt, send from t0.txt “hello”

Captura

In raspberry pi can see two messages:

  1. Touch event
  2. Message of data text from Nextion

How I can retrieve data text message in a variable with your python client?
Thanks
Javier

HelloWorld with the library

I need to use this for a project. I'm only now learning a little Python. I know nothing about asyncio, but i have been reading a lot.
I am unable to make sense of it yet. My project is with a nextion 2.4" display. I have only four controls (2 buttons, a slider and a text field).
I need to be able to see which of the two buttons has been touched and take appropriate action. for the slider i only need to read and set it's value and for the text field i need only set it's text based on one of the buttons being touched. I have been struggling with this for a couple of days but cannot get it to work. I would be extremely grateful, if you could you send me a simple example of both sending and receiving using this library?
I thank you in advance for any help offered.

Touch events

I'm trying to monitor a particular touch button event & am not sure how to do that from the examplar code:

def event_handler(type_, data):
    if type_ == EventType.STARTUP:
        print('We have booted up!')
    elif type_ == EventType.TOUCH:
        print('A button (id: %d) was touched on page %d' % (data.component_id, data.page_id))

    logging.info('Event %s data: %s', type, str(data))

Any ideas on how to go about this?

Compatibility problems with Nextion Editor 1.61.1

Dear Jevgeni,
hope you're enjoying summer, even in this difficult times given the COVID-19.

I'm here to bother you again because I noticed that your library appears to have some problems with the latest release of the Nextion Editor, version 1.61.1, whose changelog reads:

  1. New Audio* component (use internal resource or microSD)
  2. Add delimiter based split string instruction spstr
  3. Optimized Editor baudrate recognition
  4. Optimized escape character conflict in big5 encoding
  5. Optimizations for models T24, T28, T32 flash endurance
  6. Enhanced error checking for assignments where resource ID is invalid
  7. Optimized page swipe when changing pages
  8. Optimized get, print, prints and printh to single reply
  9. Optimized bkcmd handling

(Items marked with * are for Intelligent Series only)

I think the problem lies in point 8; I noticed it when I compiled my project with this latest version of the editor, and I got these errors upon connecting:

Command "get sleep" timeout.
Connection lost

I tried reverting back to version 1.60.1, recompile, and everything worked as before.

What do you think?

Async event handler function not executed

Hey there!

I'm using your example code with my Nextion NX4024T032_011R, and sending data to the device works fine. It seems that the connection works properly:

2022-10-14 20:31:38,590 - INFO - Connecting: COM4, baud: 115200
2022-10-14 20:31:38,601 - INFO - Connected to serial
2022-10-14 20:31:38,601 - DEBUG - sent: b'DRAKJHSUYDGBNCJHGJKSHBDN'
2022-10-14 20:31:38,608 - DEBUG - received: b'1a'
2022-10-14 20:31:38,638 - DEBUG - sent: b'connect'
2022-10-14 20:31:38,654 - DEBUG - received: b'636f6d6f6b20312c33373637332d302c4e5834303234543033325f303131522c3136332c36313438382c444536373730353534373241343032452c34313934333034'
2022-10-14 20:31:38,655 - INFO - Address: 37673-0
2022-10-14 20:31:38,655 - INFO - Detected model: NX4024T032_011R
2022-10-14 20:31:38,655 - INFO - Firmware version: 163
2022-10-14 20:31:38,655 - INFO - Serial number: DE677055472A402E
2022-10-14 20:31:38,655 - INFO - Flash size: 4194304
2022-10-14 20:31:38,655 - DEBUG - sent: b'bkcmd=3'
2022-10-14 20:31:38,669 - DEBUG - received: b'01'
2022-10-14 20:31:38,671 - DEBUG - sent: b'get sleep'
2022-10-14 20:31:38,685 - DEBUG - received: b'7100000000'
2022-10-14 20:31:38,686 - INFO - Successfully connected to the device

However, when I click on a button, the event_handler method is not executed at all. This button would change the page, so the 'Send Component ID' checkbox is ticked and also a sendme instruction is issued when the page is initialized.

The device sends back both information, I tried with the Nextion Editor application:
image

I'm not sure what am I missing. Tested both on Linux and Windows.

Python 3.10, package versions:
image

Async event handler is not working

Hi. This library looks really promising. And everything works for me but one thing: the events.

So, I just create a Minimum non-Working Example from your instructional script ans saved it as nextionTutorial.py:

import asyncio
import logging

from nextion import Nextion, EventType

class App:
    def __init__(self):
        self.client = Nextion('/dev/ttyS0', 115200, self.event_handler)

    # Note: async event_handler can be used only in versions 1.8.0+ (versions 1.8.0+ supports both sync and async versions)
    async def event_handler(self, type_, data):
        print('EVENT!', type_, data)
        if type_ == EventType.STARTUP:
            print('We have booted up!')
        elif type_ == EventType.TOUCH:
            print('A button (id: %d) was touched on page %d' % (data.component_id, data.page_id))

        logging.info('Event %s data: %s', type, str(data))

        print(await self.client.get('b_about.txt'))

    async def run(self):
        await self.client.connect()

        print(await self.client.get('b_about.txt'))

        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()
    app = App()
    asyncio.ensure_future(app.run())
    loop.run_forever()

Then I ran python nextionTutorial.py which yields the following output:

2022-03-17 10:28:46,618 - INFO - Connecting: /dev/ttyS0, baud: 115200
2022-03-17 10:28:46,619 - INFO - Connected to serial
2022-03-17 10:28:46,620 - DEBUG - sent: b'DRAKJHSUYDGBNCJHGJKSHBDN'
2022-03-17 10:28:46,623 - DEBUG - received: b'1a'
2022-03-17 10:28:46,663 - DEBUG - sent: b'connect'
2022-03-17 10:28:46,671 - DEBUG - received: b'636f6d6f6b20332c313739332d302c4e5838303438503037305f303131432c3136332c31303530312c393636323334303143374332334435352c3133313037323030302d30'
2022-03-17 10:28:46,672 - INFO - Address: 1793-0
2022-03-17 10:28:46,672 - INFO - Detected model: NX8048P070_011C
2022-03-17 10:28:46,673 - INFO - Firmware version: 163
2022-03-17 10:28:46,673 - INFO - Serial number: 96623401C7C23D55
2022-03-17 10:28:46,673 - INFO - Flash size: 131072000-0
2022-03-17 10:28:46,674 - DEBUG - sent: b'bkcmd=3'
2022-03-17 10:28:46,676 - DEBUG - received: b'01'
2022-03-17 10:28:46,676 - DEBUG - sent: b'get sleep'
2022-03-17 10:28:46,679 - DEBUG - received: b'7100000000'
2022-03-17 10:28:46,680 - INFO - Successfully connected to the device
2022-03-17 10:28:46,680 - DEBUG - sent: b'get b_about.txt'
2022-03-17 10:28:46,684 - DEBUG - received: b'7041626f7574'
About
finished

You can see here, that eveything works fine - for example it could read the string About from b_about.txt.

But no events whatsoever get registered. I do not get a printout of the STARTUP event and neither do I when I press buttons on the screen.

Thanks in advance for any help!

My System:

OS: Raspbian GNU/Linux 11 (bullseye) armv7l
Host: Raspberry Pi 4 Model B Rev 1.2
Kernel: 5.10.92-v7l+
Shell: bash 5.1.4
Python 3.9.2
nextion==1.8.1
nest-asyncio==1.5.4
pyserial-asyncio==0.6
Nextion Display: NX8048P070-011C

Trouble getting values from RTC variables

Hi yozik,
it's me again: sorry to bother you!

I'm using a Nextion Enhanced screen, with embedded RTC: in the Nextion Instruction Set, it is reported that it is possible to set and read time and date from certain variables (rtc0, rtc1, etc.).

Once set from a custom screen UI, I'm trying to read these variables values over serial with your library. With this code:

print(await client.get('rtc3'))
print(await client.get('rtc4'))
print(await client.get('rtc2'))
print(await client.get('rtc1'))
print(await client.get('rtc0'))

in the async def run() function of your example code, I get this error:

2020-03-30 16:03:44,531 - INFO - Successfully connected to the device
2020-03-30 16:03:44,532 - DEBUG - sent: b'get rtc3'
2020-03-30 16:03:44,537 - DEBUG - received: b'01'
2020-03-30 16:03:44,537 - DEBUG - received: b''
True
2020-03-30 16:03:44,540 - DEBUG - sent: b'get rtc4'
2020-03-30 16:03:44,553 - DEBUG - received: b'7107000000'
2020-03-30 16:03:44,553 - DEBUG - received: b''
7
2020-03-30 16:03:44,555 - DEBUG - sent: b'get rtc2'
2020-03-30 16:03:44,562 - DEBUG - received: b'01'
2020-03-30 16:03:44,564 - DEBUG - received: b'71260000'
2020-03-30 16:03:44,568 - ERROR - Task exception was never retrieved
future: <Task finished coro=<run() done, defined at nextion_time.py:15> exception=error('unpack requires a bytes object of length 4',)>
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "nextion_time.py", line 64, in run
print(await client.get('rtc2'))
File "/usr/local/lib/python3.5/dist-packages/nextion/client.py", line 136, in get
return await self.command('get %s' % key)
File "/usr/local/lib/python3.5/dist-packages/nextion/client.py", line 192, in command
data = struct.unpack('i', raw)[0]
struct.error: unpack requires a bytes object of length 4
2020-03-30 16:03:44,576 - DEBUG - received: b'7126000000'
2020-03-30 16:03:44,577 - DEBUG - received: b'01'
2020-03-30 16:03:44,578 - DEBUG - received: b''
2020-03-30 16:03:44,580 - DEBUG - received: b'7103000000'
2020-03-30 16:03:44,581 - DEBUG - received: b''
2020-03-30 16:03:44,588 - DEBUG - received: b'01'
2020-03-30 16:03:44,590 - DEBUG - received: b''

If I add a delay between requests:

print(await client.get('rtc3'))
time.sleep(1)
print(await client.get('rtc4'))
time.sleep(1)
print(await client.get('rtc2'))
time.sleep(1)
print(await client.get('rtc1'))
time.sleep(1)
print(await client.get('rtc0'))

The error is gone, but the data received is not what I'm expecting (as in the previous log, the value for the first value is reported as "True", and the following values seems to be suffering some kind of offset, as 7 is what I'm expecting for rtc3, and so on):

2020-03-30 16:14:26,144 - INFO - Successfully connected to the device
2020-03-30 16:14:27,146 - DEBUG - sent: b'get rtc3'
2020-03-30 16:14:27,148 - DEBUG - received: b'01'
2020-03-30 16:14:27,149 - DEBUG - received: b''
True
2020-03-30 16:14:28,153 - DEBUG - sent: b'get rtc4'
2020-03-30 16:14:28,155 - DEBUG - received: b'7107000000'
2020-03-30 16:14:28,156 - DEBUG - received: b'01'
2020-03-30 16:14:28,157 - DEBUG - received: b''
7
2020-03-30 16:14:29,163 - DEBUG - sent: b'get rtc2'
2020-03-30 16:14:29,165 - DEBUG - received: b'7130000000'
2020-03-30 16:14:29,166 - DEBUG - received: b'01'
2020-03-30 16:14:29,167 - DEBUG - received: b''
48
2020-03-30 16:14:30,172 - DEBUG - sent: b'get rtc1'
2020-03-30 16:14:30,175 - DEBUG - received: b'7103000000'
2020-03-30 16:14:30,176 - DEBUG - received: b'01'
2020-03-30 16:14:30,176 - DEBUG - received: b''
3
2020-03-30 16:14:31,182 - DEBUG - sent: b'get rtc0'
2020-03-30 16:14:31,184 - DEBUG - received: b'7102000000'
2020-03-30 16:14:31,185 - DEBUG - received: b'01'
2020-03-30 16:14:31,186 - DEBUG - received: b''
2

Any idea on how I can solve this "offset" problem that starts with the "True" (I tried requesting other values before the rtc variables, like txts form labels, and the first returned value is always "True"), and the first error, avoiding to add delays?

Thanks in advance!

nextion-fw-upload with NX1060P101-011C-I and NX3224T024_011

Hello,

I succesfully updated the Nextion display NX3224T024_011 with "nextion-fw-upload". Now I want to use the bigger NX1060P101-011C-I. I can not establish an update with "nextion-fw-upload". I checked the communication from the display to the RaspberryPi. There is one short answer from the display during the initial baudrate finding procedure. I even implemented a hardware levelshifter to ensure the right logic voltages 3V3 (RaspberryPi) <-> 5V0 (NX1060P101-011).
Do you have any idea? Thank you very much.

pi@raspberrypi:~/Documents/python_projects $ nextion-fw-upload /dev/ttyS0 NX1060P101-011C-I.tft
2022-03-19 15:01:07,142 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 2400
2022-03-19 15:01:07,145 INFO nextion.nextion.protocol.base Connected to serial
2022-03-19 15:01:08,942 WARNING nextion.nextion.client No valid reply on 2400 baud. Closing connection
2022-03-19 15:01:08,943 ERROR nextion.nextion.protocol.base Connection lost
2022-03-19 15:01:08,944 WARNING nextion.nextion.client Baud 2400 did not work
2022-03-19 15:01:08,944 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 4800
2022-03-19 15:01:08,946 INFO nextion.nextion.protocol.base Connected to serial
2022-03-19 15:01:09,910 WARNING nextion.nextion.client No valid reply on 4800 baud. Closing connection
2022-03-19 15:01:09,912 ERROR nextion.nextion.protocol.base Connection lost
2022-03-19 15:01:09,913 WARNING nextion.nextion.client Baud 4800 did not work
2022-03-19 15:01:09,914 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 9600
2022-03-19 15:01:09,916 INFO nextion.nextion.protocol.base Connected to serial
2022-03-19 15:01:10,463 WARNING nextion.nextion.client No valid reply on 9600 baud. Closing connection
2022-03-19 15:01:10,464 ERROR nextion.nextion.protocol.base Connection lost
2022-03-19 15:01:10,465 WARNING nextion.nextion.client Baud 9600 did not work
2022-03-19 15:01:10,465 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 19200
2022-03-19 15:01:10,467 INFO nextion.nextion.protocol.base Connected to serial
2022-03-19 15:01:10,802 WARNING nextion.nextion.client No valid reply on 19200 baud. Closing connection
2022-03-19 15:01:10,803 ERROR nextion.nextion.protocol.base Connection lost
2022-03-19 15:01:10,804 WARNING nextion.nextion.client Baud 19200 did not work
2022-03-19 15:01:10,805 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 38400
2022-03-19 15:01:10,807 INFO nextion.nextion.protocol.base Connected to serial
2022-03-19 15:01:11,037 WARNING nextion.nextion.client No valid reply on 38400 baud. Closing connection
2022-03-19 15:01:11,038 ERROR nextion.nextion.protocol.base Connection lost
2022-03-19 15:01:11,039 WARNING nextion.nextion.client Baud 38400 did not work
2022-03-19 15:01:11,040 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 57600
2022-03-19 15:01:11,042 INFO nextion.nextion.protocol.base Connected to serial
2022-03-19 15:01:11,238 WARNING nextion.nextion.client No valid reply on 57600 baud. Closing connection
2022-03-19 15:01:11,239 ERROR nextion.nextion.protocol.base Connection lost
2022-03-19 15:01:11,240 WARNING nextion.nextion.client Baud 57600 did not work
2022-03-19 15:01:11,240 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 115200
2022-03-19 15:01:11,242 INFO nextion.nextion.protocol.base Connected to serial
2022-03-19 15:01:11,405 WARNING nextion.nextion.client No valid reply on 115200 baud. Closing connection
2022-03-19 15:01:11,406 ERROR nextion.nextion.protocol.base Connection lost
2022-03-19 15:01:11,407 WARNING nextion.nextion.client Baud 115200 did not work
2022-03-19 15:01:11,407 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 230400
2022-03-19 15:01:11,409 INFO nextion.nextion.protocol.base Connected to serial
2022-03-19 15:01:11,554 WARNING nextion.nextion.client No valid reply on 230400 baud. Closing connection
2022-03-19 15:01:11,556 ERROR nextion.nextion.protocol.base Connection lost
2022-03-19 15:01:11,557 WARNING nextion.nextion.client Baud 230400 did not work
2022-03-19 15:01:11,557 ERROR nextion.nextion.client Connection failed
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.9/site-packages/nextion/client.py", line 159, in connect
result = await self._try_connect_on_different_baudrates()
File "/home/pi/.local/lib/python3.9/site-packages/nextion/client.py", line 200, in _try_connect_on_different_baudrates
raise ConnectionFailed("No baud rate suited")
nextion.exceptions.ConnectionFailed: No baud rate suited
Traceback (most recent call last):
File "/home/pi/.local/bin/nextion-fw-upload", line 8, in
sys.exit(main())
File "/home/pi/.local/lib/python3.9/site-packages/nextion/console_scripts/upload_firmware.py", line 48, in main
loop.run_until_complete(upload(args))
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/home/pi/.local/lib/python3.9/site-packages/nextion/console_scripts/upload_firmware.py", line 11, in upload
await nextion.connect()
File "/home/pi/.local/lib/python3.9/site-packages/nextion/client.py", line 159, in connect
result = await self._try_connect_on_different_baudrates()
File "/home/pi/.local/lib/python3.9/site-packages/nextion/client.py", line 200, in _try_connect_on_different_baudrates
raise ConnectionFailed("No baud rate suited")
nextion.exceptions.ConnectionFailed: No baud rate suited

No STARTUP event

What causes the STARTUP event to be triggered? Using your example, I never get that event.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.