Nextion display plugin
Moderators: grovkillen, Stuntteam, TD-er
Re: Nextion display plugin
@Marko,
and don't forget to use PIN13 as RX and PIN14 as TX.
Or change it in the code directly. As a workaround it is a static setting.
and don't forget to use PIN13 as RX and PIN14 as TX.
Or change it in the code directly. As a workaround it is a static setting.
Re: Nextion display plugin
Hello and thank you for helping BertB an Binder. I have one error after compiling
E:\ESP-WeMos\Neue\Software\ESP-Easy\4\Source\ESPEasy\_P117_Nextion.ino: In function 'boolean Plugin_117(byte, EventStruct*, String&)':
_P117_Nextion:28: error: 'SENSOR_TYPE_QUAD' was not declared in this scope
Device[deviceCount].VType = SENSOR_TYPE_QUAD;
Can you tell me what is wrong?
E:\ESP-WeMos\Neue\Software\ESP-Easy\4\Source\ESPEasy\_P117_Nextion.ino: In function 'boolean Plugin_117(byte, EventStruct*, String&)':
_P117_Nextion:28: error: 'SENSOR_TYPE_QUAD' was not declared in this scope
Device[deviceCount].VType = SENSOR_TYPE_QUAD;
Can you tell me what is wrong?
Re: Nextion display plugin
This type is defined in the ESPEasy.ino.
#define SENSOR_TYPE_SINGLE 1
#define SENSOR_TYPE_TEMP_HUM 2
#define SENSOR_TYPE_TEMP_BARO 3
#define SENSOR_TYPE_TEMP_HUM_BARO 4
#define SENSOR_TYPE_DUAL 5
#define SENSOR_TYPE_TRIPLE 6
#define SENSOR_TYPE_QUAD 7
#define SENSOR_TYPE_SWITCH 10
#define SENSOR_TYPE_DIMMER 11
#define SENSOR_TYPE_LONG 20
lines 179-189
#define SENSOR_TYPE_SINGLE 1
#define SENSOR_TYPE_TEMP_HUM 2
#define SENSOR_TYPE_TEMP_BARO 3
#define SENSOR_TYPE_TEMP_HUM_BARO 4
#define SENSOR_TYPE_DUAL 5
#define SENSOR_TYPE_TRIPLE 6
#define SENSOR_TYPE_QUAD 7
#define SENSOR_TYPE_SWITCH 10
#define SENSOR_TYPE_DIMMER 11
#define SENSOR_TYPE_LONG 20
lines 179-189
Re: Nextion display plugin
I changed the code a bit, again.
Unfortunately I can still not put it in the ESPEasyPluginPlayGround.
For some reason I cannot upload any more pics, zo, there is a link below.
The changes are that it better communicates with the Nextion.
I adapted the Hollyberry HMI file.
![Image](https://www.dropbox.com/s/tofwdj6ign2ef9v/thermoHMI.jpg?dl=1)
First I added two variables va0 and va1 and unchecked the Send Component ID of
Bt0, b0 and down buttons.
Next I put some code under the buttons:
Under Tough Release Event of bt0:
if(va1.val==0)
{
va1.val=1
print "|s,i99,sOn"
printh 0a
}else
{
va1.val=0
print "|s,i99,sOff"
printh 0x0a
}
Under Tough Release Event of down:
va0.val--
if(va0.val<0)
{
va0.val=0
}
cov va0.val,t3.txt,0
print "|u,i230,n,s"
print t3.txt
printh 0a
Under Tough Release Event of b0:
va0.val++
if(va0.val>30)
{
va0.val=30
}
cov va0.val,t3.txt,0
print "|u,i230,n,s"
print t3.txt
printh 0a
With this you get a thermostat that can up and down settings of t3, between 0 and 30.
After update it sends a message to the ESP.
Bt0 now is a toggle switch with which I switch a lamp. Just for testing.
B1 only sends the Component ID, but you cannot distinguish on or off.
Next I have made a textbox component in Domoticz, with idx 310. It gets all the messages from the ESPEasy via the HTML interface. Nice to have as a log device.
Sorry, can’t test it with mqtt or others.
I also have a kaku or coco switch with idx 304 and a zwave Thermostat setpoint with idx 79
This is how I have set up the device in ESPEasy:
![Image](https://www.dropbox.com/s/vyny8lk14ut1vr7/thermoSetting.jpg?dl=1)
I also added some rules to the ESP.
on Nextion#idx=99 do
if [Nextion#value]=1
sendtohttp 192.168.0.243,8080,/json.htm?param=switchlight&type=
command&idx=304&switchcmd=On
else
sendtohttp 192.168.0.243,8080,/json.htm?param=switchlight&type=
command&idx=304&switchcmd=Off
endif
endon
on Nextion#idx=230 do
sendtohttp 192.168.0.243,8080,/json.htm?param=udevice&type=
command&idx=79&nvalue=0&svalue=[Nextion#value]
endon
With the code below, you can now also send values.
As for now I distinguish |u for update and |s for switch
The code is far far away from perfect, but per haps it persuades to make better code and more functionality.
https://www.dropbox.com/s/bbn4atau9uppf ... n.ino?dl=0
Unfortunately I can still not put it in the ESPEasyPluginPlayGround.
For some reason I cannot upload any more pics, zo, there is a link below.
The changes are that it better communicates with the Nextion.
I adapted the Hollyberry HMI file.
![Image](https://www.dropbox.com/s/tofwdj6ign2ef9v/thermoHMI.jpg?dl=1)
First I added two variables va0 and va1 and unchecked the Send Component ID of
Bt0, b0 and down buttons.
Next I put some code under the buttons:
Under Tough Release Event of bt0:
if(va1.val==0)
{
va1.val=1
print "|s,i99,sOn"
printh 0a
}else
{
va1.val=0
print "|s,i99,sOff"
printh 0x0a
}
Under Tough Release Event of down:
va0.val--
if(va0.val<0)
{
va0.val=0
}
cov va0.val,t3.txt,0
print "|u,i230,n,s"
print t3.txt
printh 0a
Under Tough Release Event of b0:
va0.val++
if(va0.val>30)
{
va0.val=30
}
cov va0.val,t3.txt,0
print "|u,i230,n,s"
print t3.txt
printh 0a
With this you get a thermostat that can up and down settings of t3, between 0 and 30.
After update it sends a message to the ESP.
Bt0 now is a toggle switch with which I switch a lamp. Just for testing.
B1 only sends the Component ID, but you cannot distinguish on or off.
Next I have made a textbox component in Domoticz, with idx 310. It gets all the messages from the ESPEasy via the HTML interface. Nice to have as a log device.
Sorry, can’t test it with mqtt or others.
I also have a kaku or coco switch with idx 304 and a zwave Thermostat setpoint with idx 79
This is how I have set up the device in ESPEasy:
![Image](https://www.dropbox.com/s/vyny8lk14ut1vr7/thermoSetting.jpg?dl=1)
I also added some rules to the ESP.
on Nextion#idx=99 do
if [Nextion#value]=1
sendtohttp 192.168.0.243,8080,/json.htm?param=switchlight&type=
command&idx=304&switchcmd=On
else
sendtohttp 192.168.0.243,8080,/json.htm?param=switchlight&type=
command&idx=304&switchcmd=Off
endif
endon
on Nextion#idx=230 do
sendtohttp 192.168.0.243,8080,/json.htm?param=udevice&type=
command&idx=79&nvalue=0&svalue=[Nextion#value]
endon
With the code below, you can now also send values.
As for now I distinguish |u for update and |s for switch
The code is far far away from perfect, but per haps it persuades to make better code and more functionality.
https://www.dropbox.com/s/bbn4atau9uppf ... n.ino?dl=0
Re: Nextion display plugin
Very nice changes Berb
Thanks for the examples and explanation, it helps us
I have to wait for my new nextion, I have broken mine by dropping it![Bedroeft :(](./images/smilies/icon_e_sad.gif)
![Lach :)](./images/smilies/icon_e_smile.gif)
Thanks for the examples and explanation, it helps us
![Erg Blij :D](./images/smilies/icon_e_biggrin.gif)
I have to wait for my new nextion, I have broken mine by dropping it
![Bedroeft :(](./images/smilies/icon_e_sad.gif)
Re: Nextion display plugin
Hello,
Can get it to work, I connected a 3.2" advanced Nextion screen (TX to D7/GPIO13 and RX to D5/GPIO14) via a 3v3-5V level shifter.
I installed ESP easy R120 with the plugin 117, compiling and uploading is ok. I am using a NodeMCU v1.
In the ESP easy web interface I created a Sexton device with 1st GPIO 13 and 2nd GPIO 14.
In the line 1: field I added: page0.t0.txt="test"
In the line 2: field I added page0.n0.val=1234
I created a tft file for my Nextion containing a t0,t1,n0, b0 and b1 field.
But when I connect everything and boot, nothing shows up on the Nextion display. I sniffed the RX and TX line going to the Nextion, but no data what so ever shows up.
Any idea what I might do wrong here? Already tried another NodeMCU and other set of GPIO's, but nothing.
Gr. Remco
Can get it to work, I connected a 3.2" advanced Nextion screen (TX to D7/GPIO13 and RX to D5/GPIO14) via a 3v3-5V level shifter.
I installed ESP easy R120 with the plugin 117, compiling and uploading is ok. I am using a NodeMCU v1.
In the ESP easy web interface I created a Sexton device with 1st GPIO 13 and 2nd GPIO 14.
In the line 1: field I added: page0.t0.txt="test"
In the line 2: field I added page0.n0.val=1234
I created a tft file for my Nextion containing a t0,t1,n0, b0 and b1 field.
But when I connect everything and boot, nothing shows up on the Nextion display. I sniffed the RX and TX line going to the Nextion, but no data what so ever shows up.
Any idea what I might do wrong here? Already tried another NodeMCU and other set of GPIO's, but nothing.
Gr. Remco
Re: Nextion display plugin
Hi. I never tested IT with a advanced version, so that can be a Challenge. If you don't get any data on rx or tx, you can try to make the tx and rx fixed. I showed how to do that some posts back.
Re: Nextion display plugin
Are you sure, that levelshifter is necessary? As I understood, is Nextion a 3.3 V device (it has own 3.3V voltage regulator on board -- U1 6209A).BertB wrote:For only sending data from the Wemos to the Nextion, Rx on the Wemos (Blue wire) is not required.
This is how I connect my nextion.
You can choose to feed it from a strong (Nextion requires sufficient power) usb or an external 5 volt DC power supply.
I tested it with a 1n4448 and a 1n4004 diode.
the colors are the colors of the Nextion cable, where:
blue = Tx (Nextion)
yellow = Rx (Nextion)
red = + 5v
black = gnd
It can be necessary to add capacitors.
Nextion1_Sbb.jpg
Tiit
Re: Nextion display plugin
You might be right. I will check tonight.
Re: Nextion display plugin
@Tiit12
You are so right. I measured the signal with my oscilloscope and it never came above 3.3 volt.
So, I got rid of the diode. Thank you for the tip.
You are so right. I measured the signal with my oscilloscope and it never came above 3.3 volt.
So, I got rid of the diode. Thank you for the tip.
Re: Nextion display plugin
Hello,
After hours of testing,I managed to get weather wunderground and wind, switch and alarm commands with domoticz state feedback and local temperature and domoticz temperature.
Thank you for the nextion plugin !!!
This is my broken test nextion![Bedroeft :(](./images/smilies/icon_e_sad.gif)
After hours of testing,I managed to get weather wunderground and wind, switch and alarm commands with domoticz state feedback and local temperature and domoticz temperature.
![Mr. Groen :mrgreen:](./images/smilies/icon_mrgreen.gif)
Thank you for the nextion plugin !!!
This is my broken test nextion
![Bedroeft :(](./images/smilies/icon_e_sad.gif)
Re: Nextion display plugin
Nice!
And may be broken, but still going strong.
And may be broken, but still going strong.
Re: Nextion display plugin
Nextion Capacitive Multi-touch Displays for Pro HMI design in Hours
Nextion is launching a indiegogo campaign
for its new arrivals with capacitive multi-touch panel and a good looking shell.
It’s more convenient and easier to design Pro HMI for embedded system.
https://www.indiegogo.com/projects/next ... 6202680/zy
![Image](http://blog.iteadstudio.com/wp-content/uploads/2017/03/click.jpg)
Nextion is launching a indiegogo campaign
for its new arrivals with capacitive multi-touch panel and a good looking shell.
It’s more convenient and easier to design Pro HMI for embedded system.
https://www.indiegogo.com/projects/next ... 6202680/zy
![Image](http://blog.iteadstudio.com/wp-content/uploads/2017/03/click.jpg)
Re: Nextion display plugin
I tried the code of thermostat to @BertB but the code send on serial is bad.
See my log, an idea ?
I tried the old (playground) and newest (post page 11) version, no change ![Bedroeft :(](./images/smilies/icon_e_sad.gif)
Now, i have this after compiling a fresh version espeasy
Nextion ide new version v0.46
Arduino ide 1.6.13
See my log, an idea ?
Code: Select all
52140 : Nextion : send command: s11 49.00
52259 : Nextion : send command: s12 50.00
52471 : Nextion : send command: s13 51.00
52682 : Nextion : send command: s14 52.00
53107 : Nextion : send command: s,i99,sOn 105.00
54210 : Nextion : send command: s,i99,sOff!²105.00
![Bedroeft :(](./images/smilies/icon_e_sad.gif)
Now, i have this after compiling a fresh version espeasy
Code: Select all
29006 : Nextion : send command: |u,i230,n,s6 230.00
29006 : EVENT: NEXTION#code=230.00
29014 : EVENT: NEXTION#=6.00
29021 : EVENT: NEXTION#=0.00
29028 : EVENT: NEXTION#=0.00
97012 : Nextion : send command: |s,i99,sOn 99.00
97013 : EVENT: NEXTION#code=99.00
97021 : EVENT: NEXTION#=1.00
97028 : EVENT: NEXTION#=0.00
97035 : EVENT: NEXTION#=0.00
Arduino ide 1.6.13
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Nextion display plugin
Just want to add that I just got my 2.4" Nextion display the other day and I follow this thread with great interest! ![Razz :P](./images/smilies/icon_razz.gif)
I found this blog which is very informative about the Nextion/ESP symbiosis.
![Razz :P](./images/smilies/icon_razz.gif)
I found this blog which is very informative about the Nextion/ESP symbiosis.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
![Idee :idea:](./images/smilies/icon_idea.gif)
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
![Idee :idea:](./images/smilies/icon_idea.gif)
![Idee :idea:](./images/smilies/icon_idea.gif)
![Idee :idea:](./images/smilies/icon_idea.gif)
Re: Nextion display plugin
It works but i don't know really why !
I've taked an old *.bin and it's ok !
I do a lot of testing, in the end I get lost
Edit : I tried with a Release candidates version espeasy (Firmware image R147_RC8) and the plugin Nextion page 11 of this topic and version nextion ide last v0.46
It work !![Knipoog ;)](./images/smilies/icon_e_wink.gif)
![Bedroeft :(](./images/smilies/icon_e_sad.gif)
I've taked an old *.bin and it's ok !
I do a lot of testing, in the end I get lost
![Erg Blij :D](./images/smilies/icon_e_biggrin.gif)
Edit : I tried with a Release candidates version espeasy (Firmware image R147_RC8) and the plugin Nextion page 11 of this topic and version nextion ide last v0.46
It work !
![Knipoog ;)](./images/smilies/icon_e_wink.gif)
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Nextion display plugin
Is it possible to get the input from the display back into ESPEasy? Or is it only one way as of now? Looking good though! ![Lach :-)](./images/smilies/icon_e_smile.gif)
![Lach :-)](./images/smilies/icon_e_smile.gif)
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
![Idee :idea:](./images/smilies/icon_idea.gif)
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
![Idee :idea:](./images/smilies/icon_idea.gif)
![Idee :idea:](./images/smilies/icon_idea.gif)
![Idee :idea:](./images/smilies/icon_idea.gif)
Re: Nextion display plugin
I want help you but i don't understand your question !
What display want you![Lach :)](./images/smilies/icon_e_smile.gif)
You can look the post i made in french
https://easydomoticz.com/forum/viewtopi ... =24&t=3731
What display want you
![Lach :)](./images/smilies/icon_e_smile.gif)
You can look the post i made in french
https://easydomoticz.com/forum/viewtopi ... =24&t=3731
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Nextion display plugin
Well, if you press a (virtual) button on the display, will that give that information (that the button is pressed) back to the ESP?
My question: is it possible to use the Nextion as input?
My question: is it possible to use the Nextion as input?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
![Idee :idea:](./images/smilies/icon_idea.gif)
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
![Idee :idea:](./images/smilies/icon_idea.gif)
![Idee :idea:](./images/smilies/icon_idea.gif)
![Idee :idea:](./images/smilies/icon_idea.gif)
Re: Nextion display plugin
Yes very easy.
Have you see my post page 10 with code = ID button ?
Have you see my post page 10 with code = ID button ?
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Nextion display plugin
Sorry, most have missed! Thanks! ![Lach :-)](./images/smilies/icon_e_smile.gif)
![Lach :-)](./images/smilies/icon_e_smile.gif)
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
![Idee :idea:](./images/smilies/icon_idea.gif)
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
![Idee :idea:](./images/smilies/icon_idea.gif)
![Idee :idea:](./images/smilies/icon_idea.gif)
![Idee :idea:](./images/smilies/icon_idea.gif)
Re: Nextion display plugin
Hi
I'm new on this forum,so hello.
I have nextion lcd and i trying send to them some data using lua script.
I saw examples to this,but only using arduino software..i like to use only esp and lua.
One thing is hard to do,mayby someone has solution.
I have to send 3x 0xff data to end transmission.
In lua to send hex command is write(0,0xff,0xff,0xff)
Now i have to split this with print command,but it must be one command e.g. print("t0.txt=/"test/""....and here send hex data)
If i send hex in next line,to the end of print commant i got /r/n so this metod is not ok.
How to send some hex data inside the print command?
Variable,table or using function inside?
The string must look this:
"t0="test"0xff 0xff 0xff (0xff='255' in asci,11111111 in binary).
Regards
I'm new on this forum,so hello.
I have nextion lcd and i trying send to them some data using lua script.
I saw examples to this,but only using arduino software..i like to use only esp and lua.
One thing is hard to do,mayby someone has solution.
I have to send 3x 0xff data to end transmission.
In lua to send hex command is write(0,0xff,0xff,0xff)
Now i have to split this with print command,but it must be one command e.g. print("t0.txt=/"test/""....and here send hex data)
If i send hex in next line,to the end of print commant i got /r/n so this metod is not ok.
How to send some hex data inside the print command?
Variable,table or using function inside?
The string must look this:
"t0="test"0xff 0xff 0xff (0xff='255' in asci,11111111 in binary).
Regards
Re: Nextion display plugin
Hi !
I'm new on this forum and i've discovered Nextion display on French domotic forum.
I've a question about the plugin: is it possible to switch between page (page0, page1, ...) ?
Thanks (and sorry for my bad english)
I'm new on this forum and i've discovered Nextion display on French domotic forum.
I've a question about the plugin: is it possible to switch between page (page0, page1, ...) ?
Thanks (and sorry for my bad english)
Re: Nextion display plugin
yes you can:
In a script, like after a button push. 770 is de code of the button that has been pushed.
on E16Nextion#code=770 do
Nextion,page 0
endon
or through a json call.
http://192.168.0.76/control?cmd=NEXTION,page 2
In a script, like after a button push. 770 is de code of the button that has been pushed.
on E16Nextion#code=770 do
Nextion,page 0
endon
or through a json call.
http://192.168.0.76/control?cmd=NEXTION,page 2
- ledfreak3d
- Normal user
- Posts: 48
- Joined: 21 Oct 2016, 12:41
Re: Nextion display plugin
Domoticz Synology Esp easy Location Netherlands /Hoorn
Re: Nextion display plugin
Ouah good integration !
How do you for the battery, we can see a photo inside !![Erg Blij :D](./images/smilies/icon_e_biggrin.gif)
How do you for the battery, we can see a photo inside !
![Erg Blij :D](./images/smilies/icon_e_biggrin.gif)
- ledfreak3d
- Normal user
- Posts: 48
- Joined: 21 Oct 2016, 12:41
Re: Nextion display plugin
Lol the inside looks crap but working on a beter version and domoticz interface
It basicly ru s on a single 18650 powerbank ript apart.
In the process of designig a beter case also
It basicly ru s on a single 18650 powerbank ript apart.
In the process of designig a beter case also
Domoticz Synology Esp easy Location Netherlands /Hoorn
Re: Nextion display plugin
Hello,BertB wrote: ↑12 Jul 2017, 15:06 yes you can:
(...)
or through a json call.
http://192.168.0.76/control?cmd=NEXTION,page 2
Is it possible to do the same think with MQTT ?
Regards,
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Nextion display plugin
Use the same commands over MQTT. See wiki for more info.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
![Idee :idea:](./images/smilies/icon_idea.gif)
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
![Idee :idea:](./images/smilies/icon_idea.gif)
![Idee :idea:](./images/smilies/icon_idea.gif)
![Idee :idea:](./images/smilies/icon_idea.gif)
-
- New user
- Posts: 7
- Joined: 28 Oct 2017, 16:16
Re: Nextion display plugin
Hello. I have Wemos D1 mini pro, Nextion Enhanced 3.5 "and SHT30 sensor .In ESPEasy I added plugin for display and sensor. The sensor works well. But I do not know how to properly connect the display to Wemos D1 mini pro. Would you please help me as correct connect and set to display the temperature and humidity on the display? Or show at least any text. Here is my current engagement. The power connection is each separately. Thank you
- Attachments
-
- WP_20171028_16_28_16_Pro.jpg (3.31 MiB) Viewed 224811 times
Re: Nextion display plugin
Hi.
I am not sure the plugin also works with the enhanced models, but first you need to prepare the display, so that it contains text and number objects.
There are many tutorials on the web that sohw how to do that. Especially the tutorials with Arduino are useful.
I am not sure the plugin also works with the enhanced models, but first you need to prepare the display, so that it contains text and number objects.
There are many tutorials on the web that sohw how to do that. Especially the tutorials with Arduino are useful.
-
- New user
- Posts: 7
- Joined: 28 Oct 2017, 16:16
Re: Nextion display plugin
Hi. The display is prepared as follows: I have the object t0 on which I want to display some text, eg. hello
Re: Nextion display plugin
Are you sure the baudrate is set ok?
Did you for instance test it with a USB to serial converter and Nextion Editor to send it the text you want?
Did you for instance test it with a USB to serial converter and Nextion Editor to send it the text you want?
-
- New user
- Posts: 7
- Joined: 28 Oct 2017, 16:16
Re: Nextion display plugin
Where is the baud rate set? In the plugin?
Unfortunately I do not have USB to serial converter ...
Unfortunately I do not have USB to serial converter ...
Re: Nextion display plugin
How did you program the Display with USB to serial?
-
- New user
- Posts: 7
- Joined: 28 Oct 2017, 16:16
Re: Nextion display plugin
with sd card
Re: Nextion display plugin
Difficult to test then.
-
- New user
- Posts: 7
- Joined: 28 Oct 2017, 16:16
Re: Nextion display plugin
And what USB to serial converter to buy
-
- New user
- Posts: 7
- Joined: 28 Oct 2017, 16:16
Re: Nextion display plugin
Or is it another way?
Is there any simple code in the Arduino IDE to display the text on the display? Connected only wemos D1 mini pro and nextion.
Is there any simple code in the Arduino IDE to display the text on the display? Connected only wemos D1 mini pro and nextion.
-
- New user
- Posts: 7
- Joined: 28 Oct 2017, 16:16
Re: Nextion display plugin
This is how you celebrate your first success with this http://support.iteadstudio.com/support/ ... rl_locale= contributor to Dave A "Steve, thanks very much for your help. " etc .. So at least the display works (I thought it was necessary to break it). Perhaps the problem is that your library does not support Nextion Enhanced. Or ...?
Re: Nextion display plugin
I am having issues to get sliders running, some how the data looses its first chars.
print "publish .........
and gives result in the debug screen sh......
So somehow it looses publi
Tried alsmost anything i could think of but did not find any answers. Rules just wont do for my setup as there are to many buttons and things going on that 4 pages arent enough for me.
https://github.com/maragelis/NextionMqtt
This firmware does reveals that the nextion sends out more data on the serial than we receive.
Like wakeup on sleep
0x87
0xff
0xff
0xff
Sleep
0x86
0xff
0xff
0xff
thup=1 {To set sleep on for your nextion project ( 0/1))
thsp=xx (Set sleep after xx secs)
I prefer node red and mqtt route, as you could change the status of a button based on incoming msg.
So when the lights are set on thru a rocker, the status on the nextion screen will be updated.
I would prefer to use the espeasy route, but some how i cant get it working further than buttons and updating fields.
print "publish .........
and gives result in the debug screen sh......
So somehow it looses publi
Tried alsmost anything i could think of but did not find any answers. Rules just wont do for my setup as there are to many buttons and things going on that 4 pages arent enough for me.
https://github.com/maragelis/NextionMqtt
This firmware does reveals that the nextion sends out more data on the serial than we receive.
Like wakeup on sleep
0x87
0xff
0xff
0xff
Sleep
0x86
0xff
0xff
0xff
thup=1 {To set sleep on for your nextion project ( 0/1))
thsp=xx (Set sleep after xx secs)
I prefer node red and mqtt route, as you could change the status of a button based on incoming msg.
So when the lights are set on thru a rocker, the status on the nextion screen will be updated.
I would prefer to use the espeasy route, but some how i cant get it working further than buttons and updating fields.
Re: Nextion display plugin
Very well posible. I never tested it and I do not know the difference between the two.dragowasabi wrote: ↑28 Oct 2017, 21:08 This is how you celebrate your first success with this http://support.iteadstudio.com/support/ ... rl_locale= contributor to Dave A "Steve, thanks very much for your help. " etc .. So at least the display works (I thought it was necessary to break it). Perhaps the problem is that your library does not support Nextion Enhanced. Or ...?
On the other hand, the code shows some strange serial port handling. I am not sure what baudrate is used to communicate with the display, but the plugin uses 9600 baud.
Re: Nextion display plugin
Please keep in mind this plugin is highly experimental. I did ask for someone with more programming skills to make it nice.r_255 wrote: ↑29 Oct 2017, 09:56 I am having issues to get sliders running, some how the data looses its first chars.
....
I prefer node red and mqtt route, as you could change the status of a button based on incoming msg.
So when the lights are set on thru a rocker, the status on the nextion screen will be updated.
I would prefer to use the espeasy route, but some how i cant get it working further than buttons and updating fields.
Without using the Nextion drivers, it is not easy to interprete the data coming from the display.
I created a kind of workaroud for sliders. It is a mixture of programming the display and the use of Rules.
I'll see if I can find it.
Regarding MQTT, I have a lot of problems getting it to work reliably.
Re: Nextion display plugin
Hi Bert,
Its much appreciated, all the efforts you put into the plugin.
I got the dimmer running thru the mentioned plugin, but Espeasy gives me more flexebility in other devices.
Your programming, is much better than mine... with a lot of effort i can read some.
I also did see on Jeffs website that there is some one that has things running up and down, not sure as time is a issue at the moment here.
Thanks!
Robin
BIG PS:
The example on jeff's website is domoticz related and works with bash scripts.
The whole reason that i don't want to use rules is because there are not rules enough for what i want ( 4 pages is not enough )
What i want to try is that my toggle buttons get their status get updated thru mqtt. So the intention is to make a button visible based on the on or off status and later on also push dimmer values to a slider.
" { "topic":sendCommand, "payload":{ "command":"click b9,1" } }" Works in the mqtt firmware i mentioned so technical it would be possible to send commands to your nextion screen
and get buttons updated based on a device status.
I am not sure how the decoding in your plugin works, but it could be that some data from the nextion comes thru as it sends more data than only a key press. ( strange data that occurs now and then ) The other firmware works on softserial to, and does not receive any weird chars.
Its much appreciated, all the efforts you put into the plugin.
I got the dimmer running thru the mentioned plugin, but Espeasy gives me more flexebility in other devices.
Your programming, is much better than mine... with a lot of effort i can read some.
I also did see on Jeffs website that there is some one that has things running up and down, not sure as time is a issue at the moment here.
Thanks!
Robin
BIG PS:
The example on jeff's website is domoticz related and works with bash scripts.
The whole reason that i don't want to use rules is because there are not rules enough for what i want ( 4 pages is not enough )
What i want to try is that my toggle buttons get their status get updated thru mqtt. So the intention is to make a button visible based on the on or off status and later on also push dimmer values to a slider.
" { "topic":sendCommand, "payload":{ "command":"click b9,1" } }" Works in the mqtt firmware i mentioned so technical it would be possible to send commands to your nextion screen
and get buttons updated based on a device status.
I am not sure how the decoding in your plugin works, but it could be that some data from the nextion comes thru as it sends more data than only a key press. ( strange data that occurs now and then ) The other firmware works on softserial to, and does not receive any weird chars.
Re: Nextion display plugin
Hi !BertB wrote: ↑22 Jan 2017, 15:34 Under Tough Release Event of down:
va0.val--
if(va0.val<0)
{
va0.val=0
}
cov va0.val,t3.txt,0
print "|u,i230,n,s"
print t3.txt
printh 0a
Under Tough Release Event of b0:
va0.val++
if(va0.val>30)
{
va0.val=30
}
cov va0.val,t3.txt,0
print "|u,i230,n,s"
print t3.txt
printh 0a
This will increase or decrease value of 1, is it possible to make it change (+ or -) of 0,5 ?
Regards,
Re: Nextion display plugin
The variable in Nextion is either a string or an integer. You could try to work it out, by adding or subtracting 5 and dividing the value by 10 in domoticz.dokho wrote: ↑06 Nov 2017, 18:55Hi !BertB wrote: ↑22 Jan 2017, 15:34 Under Tough Release Event of down:
va0.val--
if(va0.val<0)
{
va0.val=0
}
cov va0.val,t3.txt,0
print "|u,i230,n,s"
print t3.txt
printh 0a
Under Tough Release Event of b0:
va0.val++
if(va0.val>30)
{
va0.val=30
}
cov va0.val,t3.txt,0
print "|u,i230,n,s"
print t3.txt
printh 0a
This will increase or decrease value of 1, is it possible to make it change (+ or -) of 0,5 ?
Regards,
Re: Nextion display plugin
First post here so want to thank all contributors, very good thread and just the plugin i needed.
ESP12E bare connected to Nextion 4" and MQTT to Node-red.
Had a hard time compiling ESPEasy v2.0.something but in the end did manage with the v2.0 with plugin included.
Also took some time to understand the espeasy setup, needed to get MQTT publish triggered etc. %systemdate% etc not yet available in this version either so now filling this data via formatted MQTT input from node-red.
All communications sorted now, there is just one thing not clear to me, are actually 2 things.
First, in the ESPEasy => Device tab, the section with the 4 Values, i just don't get what "code" stands for and where the reported codes/values come from.
I've created some of @BertB 's code in the Nextion button. When using:
i get a constant code value of 105.00 but when i use |u instead of |s the code changes all the time and part of the send string "|u,i33,n,s18" is missing.
I suppose "|s |u" is some lua talk? at some point lua and other text came as data, but happened only once.
The other Values are also filled when i send a button press with this code to ESP, but can't figure out where the come from.
And the Rules engine does not pick up on this. I've changed the nextion code to:
giving me this msg in the log:
![Image](https://content.screencast.com/users/zootallure/folders/NodeRed/media/79939c54-3fc0-48e8-a1b0-01a2e30ab4c7/ESPEasy_log2.jpg)
but the rule does not work.. ? ( neither does : on Nextion#code=105 .. or Nextion#code=105.00 )
![Image](https://content.screencast.com/users/zootallure/folders/NodeRed/media/d98193ef-d1ad-41e4-8a9f-d6fa0a05bf70/ESPRules.jpg)
[update] Ok sorry, got it, about the 4 value fields anyway, it's the serial read buffers. Code is assuming the deviceid is being sent with the 0xFF's ending.
Had to rack my brain for some 1970's info stored away very deep about serial comms..![Razz :P](./images/smilies/icon_razz.gif)
I get that the plugin is a bit of a quick and dirty solution but it works so love that, and the print string is an ever quicker and dirtier solution then, but don't see how BertB's rules would work if no device id is being sent. Will give it some more thoughs and tries, maybe try Pete Scargils way of using "get attr" on the Nextion.
[update2] Solved my problem by only using button/deviceid then rule on Nextion#code to send '1' or '-1' ,depending on button, via mqtt to node-red and have node-red return the desired temp. update is fast enough for ux ease-of-use.
leaves me with the sleep/wake-up data refresh issue as all data on nextion comes from node-red in 1 min intervals. the nextion page touch event is not sent when screen is being woken up. so cant tell esp that sceen is tapped to wakeup and needs refreshing data....
setup...
![Image](https://content.screencast.com/users/zootallure/folders/NodeRed/media/dde41b95-6574-4f7f-8d9c-4a3338dabd74/iOS%20upload%20-%20do%204%20jan.%202018%20122520.JPG)
ESP12E bare connected to Nextion 4" and MQTT to Node-red.
Had a hard time compiling ESPEasy v2.0.something but in the end did manage with the v2.0 with plugin included.
Also took some time to understand the espeasy setup, needed to get MQTT publish triggered etc. %systemdate% etc not yet available in this version either so now filling this data via formatted MQTT input from node-red.
All communications sorted now, there is just one thing not clear to me, are actually 2 things.
First, in the ESPEasy => Device tab, the section with the 4 Values, i just don't get what "code" stands for and where the reported codes/values come from.
I've created some of @BertB 's code in the Nextion button. When using:
Code: Select all
if(va0.val=0)
{
print "|s,i13,n,s"
} else
{
print "|s,i33,n,s"
}
print page0.vattempset.txt
printh 0xa
I suppose "|s |u" is some lua talk? at some point lua and other text came as data, but happened only once.
The other Values are also filled when i send a button press with this code to ESP, but can't figure out where the come from.
And the Rules engine does not pick up on this. I've changed the nextion code to:
Code: Select all
print "|s,idx=33,value="
print page0.vattempset.txt
printh 0xa
![Image](https://content.screencast.com/users/zootallure/folders/NodeRed/media/79939c54-3fc0-48e8-a1b0-01a2e30ab4c7/ESPEasy_log2.jpg)
but the rule does not work.. ? ( neither does : on Nextion#code=105 .. or Nextion#code=105.00 )
![Image](https://content.screencast.com/users/zootallure/folders/NodeRed/media/d98193ef-d1ad-41e4-8a9f-d6fa0a05bf70/ESPRules.jpg)
[update] Ok sorry, got it, about the 4 value fields anyway, it's the serial read buffers. Code is assuming the deviceid is being sent with the 0xFF's ending.
Had to rack my brain for some 1970's info stored away very deep about serial comms..
![Razz :P](./images/smilies/icon_razz.gif)
I get that the plugin is a bit of a quick and dirty solution but it works so love that, and the print string is an ever quicker and dirtier solution then, but don't see how BertB's rules would work if no device id is being sent. Will give it some more thoughs and tries, maybe try Pete Scargils way of using "get attr" on the Nextion.
[update2] Solved my problem by only using button/deviceid then rule on Nextion#code to send '1' or '-1' ,depending on button, via mqtt to node-red and have node-red return the desired temp. update is fast enough for ux ease-of-use.
leaves me with the sleep/wake-up data refresh issue as all data on nextion comes from node-red in 1 min intervals. the nextion page touch event is not sent when screen is being woken up. so cant tell esp that sceen is tapped to wakeup and needs refreshing data....
setup...
Re: Nextion display plugin
@BertB
First of all: Great Plugin !
I am just beginning with the plugin for the Nextion display. I flased a nodeMCU V 1.0 and I have communication with the display.
I can send Data to the display through a url (http://192.168.178.55/control?cmd=NEXTI ... txt="Hallo" ).
Question:
Do you have more documentation for the Nextion programming
print "|u,i230,n,s" The parameters where do they stand for?
The "1230 thats the Idx value that's simple but the rest?"
Alvast bedankt!
Mvg Ernst
First of all: Great Plugin !
![Erg Blij :D](./images/smilies/icon_e_biggrin.gif)
I am just beginning with the plugin for the Nextion display. I flased a nodeMCU V 1.0 and I have communication with the display.
I can send Data to the display through a url (http://192.168.178.55/control?cmd=NEXTI ... txt="Hallo" ).
Question:
Do you have more documentation for the Nextion programming
print "|u,i230,n,s" The parameters where do they stand for?
The "1230 thats the Idx value that's simple but the rest?"
Alvast bedankt!
Mvg Ernst
Re: Nextion display plugin
Hi Ernst,
First of all, the code is not ready, it needs a some more attention, but I do not have much time to do it.
Initially the code simply received the data to the outputs, like this:
output 1 = pagenumber * 256 + itemnumber.
Page = 1 (it starts with 0) and button id is 9, you get 256+9=265
output 2 = button state, 0 is off, 1 is on.
With rules and events you can then make things happen:
Set the time out timer to 20 seconds and background intensity to 80%
on E16Nextion#code do
Nextion,tm0.tim=20000
Nextion,dim=80
endon
You only need to tick the Send Component ID box for that.
If you want more detail, like toggling a light switch via domoticz:
put this code in the Touch Release Event code box of the switch:
page0.vBT0.val=bt0.val /this is to update a variable
if(page0.vBT0.val==1)
{ / if on then send on
print "|s,i7,sOn" /This and (|s is switch identifier, i7 is a chosen id for a button)
printh 0a / this is sent to the ESP code
}else
{ / else send off
print "|s,i7,sOff"
printh 0x0a
}
The ESP code now shows 7 and the value is 1 or 0
In this case idx 7 must be a real switch. Nextion id and idx are not related.
The rules need the folowing code:
on E16Nextion#code=7 do
if [E16Nextion#value]=1
SendToHTTP <ip of domoticz,8080>,/json.htm?type=command¶m=switchlight&idx=7&switchcmd=On
else
SendToHTTP <ip of domoticz,8080>,/json.htm?type=command¶m=switchlight&idx=7&switchcmd=Off
endif
endon
sending the value of a counter after an update, you need to program the display:
va0.val-- /when the down button is touched, the variable decreases
if(va0.val<0) / not less than 0
{
va0.val=0
}
cov va0.val,t3.txt,0 convert a string to integer
print "|u,i230,n,s" |u is identifier for update of a variable, i230 is a choosen id
print t3.txt also print the value of the variable
printh 0a end of string
In the rules you can use:
on E16Nextion#code=230 do
sendtohttp ,domoticz ip,8080>,/json.htm?param=udevice&type=command&idx=79&nvalue=0&svalue=[Nextion#value]
endon
Hope this helps
First of all, the code is not ready, it needs a some more attention, but I do not have much time to do it.
Initially the code simply received the data to the outputs, like this:
output 1 = pagenumber * 256 + itemnumber.
Page = 1 (it starts with 0) and button id is 9, you get 256+9=265
output 2 = button state, 0 is off, 1 is on.
With rules and events you can then make things happen:
Set the time out timer to 20 seconds and background intensity to 80%
on E16Nextion#code do
Nextion,tm0.tim=20000
Nextion,dim=80
endon
You only need to tick the Send Component ID box for that.
If you want more detail, like toggling a light switch via domoticz:
put this code in the Touch Release Event code box of the switch:
page0.vBT0.val=bt0.val /this is to update a variable
if(page0.vBT0.val==1)
{ / if on then send on
print "|s,i7,sOn" /This and (|s is switch identifier, i7 is a chosen id for a button)
printh 0a / this is sent to the ESP code
}else
{ / else send off
print "|s,i7,sOff"
printh 0x0a
}
The ESP code now shows 7 and the value is 1 or 0
In this case idx 7 must be a real switch. Nextion id and idx are not related.
The rules need the folowing code:
on E16Nextion#code=7 do
if [E16Nextion#value]=1
SendToHTTP <ip of domoticz,8080>,/json.htm?type=command¶m=switchlight&idx=7&switchcmd=On
else
SendToHTTP <ip of domoticz,8080>,/json.htm?type=command¶m=switchlight&idx=7&switchcmd=Off
endif
endon
sending the value of a counter after an update, you need to program the display:
va0.val-- /when the down button is touched, the variable decreases
if(va0.val<0) / not less than 0
{
va0.val=0
}
cov va0.val,t3.txt,0 convert a string to integer
print "|u,i230,n,s" |u is identifier for update of a variable, i230 is a choosen id
print t3.txt also print the value of the variable
printh 0a end of string
In the rules you can use:
on E16Nextion#code=230 do
sendtohttp ,domoticz ip,8080>,/json.htm?param=udevice&type=command&idx=79&nvalue=0&svalue=[Nextion#value]
endon
Hope this helps
Re: Nextion display plugin
It can even get better if you only enable Send Component ID in the Touch Release Event of a button.
Let's assume that gives the code of 774 in the ESPEasy and in Domoticz you have a switch with idx 7.
Then with Rule:
on E16Nextion#code=774 do
SendToHTTP <domoticz ip,8080>,/json.htm?type=command¶m=switchlight&idx=7&switchcmd=Toggle
endon
you can toggle the switch.
And if you put:
http://<domoticz ip>/control?cmd=NEXTION,page3.b5.bco=1024 in the switch's On Action and
http://<domoticz ip>/control?cmd=NEXTION,page3.b5.bco=48631 in the off action
With a switch b5 on page3 of the Nextion, obviously, you get a feedback.
The switch is grey when off and green when on. It is important that the switches have a vscope set to global.
If on the Nextion you have the switch on page 0, you send: http://<domoticz ip>/control?cmd=NEXTION,page0.b5.bco=1024
Have fun.
Let's assume that gives the code of 774 in the ESPEasy and in Domoticz you have a switch with idx 7.
Then with Rule:
on E16Nextion#code=774 do
SendToHTTP <domoticz ip,8080>,/json.htm?type=command¶m=switchlight&idx=7&switchcmd=Toggle
endon
you can toggle the switch.
And if you put:
http://<domoticz ip>/control?cmd=NEXTION,page3.b5.bco=1024 in the switch's On Action and
http://<domoticz ip>/control?cmd=NEXTION,page3.b5.bco=48631 in the off action
With a switch b5 on page3 of the Nextion, obviously, you get a feedback.
The switch is grey when off and green when on. It is important that the switches have a vscope set to global.
If on the Nextion you have the switch on page 0, you send: http://<domoticz ip>/control?cmd=NEXTION,page0.b5.bco=1024
Have fun.
Who is online
Users browsing this forum: No registered users and 56 guests