Nextion display plugin
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 25
- Joined: 19 Apr 2016, 11:12
Re: Nextion display plugin
Hi everyone.
So glad this has been developed. I am going to replace my previous incarnation of Heating Thermostat (using a sonoff TH) with this Nextion. I have used Scargills PCB and screen design (modified) with a relay board and small PSU from a phone charger.
The advantage of Scargills board is that is has all the breakouts purposely positioned and also screws to the back of the Nextion screen making it compact.
I added the MQTT Import utility so I can pick up my Heating setpoint and display it along side the Temperature and Humidity from the DHT22 mounted at the bottom. I also brought up the Relay status (light on the right)
So glad this has been developed. I am going to replace my previous incarnation of Heating Thermostat (using a sonoff TH) with this Nextion. I have used Scargills PCB and screen design (modified) with a relay board and small PSU from a phone charger.
The advantage of Scargills board is that is has all the breakouts purposely positioned and also screws to the back of the Nextion screen making it compact.
I added the MQTT Import utility so I can pick up my Heating setpoint and display it along side the Temperature and Humidity from the DHT22 mounted at the bottom. I also brought up the Relay status (light on the right)
Re: Nextion display plugin
Thank you for help me.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
My wiring was not good for Tx. I use an external 5 volt power.
I'll try to my come back.
If some would like to share their hmi project, it would be great.
Re: Nextion display plugin
Yes it work
Thanks @BertB
Thanks @BertB
Re: Nextion display plugin
Hello,
I know how to handle texts and retrieve values via mqtt
How do you do the buttons to send a command to domoticz ?
I know how to handle texts and retrieve values via mqtt
How do you do the buttons to send a command to domoticz ?
Re: Nextion display plugin
I am trying to get the input from buttons as follows:
For example, in the Nextion, I have put the following lines in the Tough Release Event section of a button:
if(va1.val==0)
{
va1.val=1
print "|s"
print "idx=99&switchcmd=On"
printh 0a
}else
{
va1.val=0
print "|s"
print "idx=99&switchcmd=Off"
printh 0x0a
}
I use variable va1 as a toggle state memory.
Anyway, the idea is that the Nextion sends idx=99&switchcmd=On en idx=99&switchcmd=Off.
Those values I can now project in the variables of the Nextion plugin. Now I am trying to send those values to Domoticz.
Since I am a self tought programmer, this is not a fast creation process.
Herunder is the accompaniing plugin code. I still do not get it in the playground.
For example, in the Nextion, I have put the following lines in the Tough Release Event section of a button:
if(va1.val==0)
{
va1.val=1
print "|s"
print "idx=99&switchcmd=On"
printh 0a
}else
{
va1.val=0
print "|s"
print "idx=99&switchcmd=Off"
printh 0x0a
}
I use variable va1 as a toggle state memory.
Anyway, the idea is that the Nextion sends idx=99&switchcmd=On en idx=99&switchcmd=Off.
Those values I can now project in the variables of the Nextion plugin. Now I am trying to send those values to Domoticz.
Since I am a self tought programmer, this is not a fast creation process.
Herunder is the accompaniing plugin code. I still do not get it in the playground.
Code: Select all
#include <Arduino.h>
#include <SoftwareSerial.h>
//#######################################################################################################
//#################################### Plugin 117: Nextion <info@sensorio.cz> ###########################
//#######################################################################################################
#define PLUGIN_117
#define PLUGIN_ID_117 117
#define PLUGIN_NAME_117 "Display: Nextion"
#define PLUGIN_VALUENAME1_117 "code"
unsigned long Plugin_117_code = 0;
int8_t Plugin_117_RXpin = -1;
int8_t Plugin_117_TXpin = -1;
SoftwareSerial *nextion;
boolean Plugin_117(byte function, struct EventStruct *event, String &string) {
boolean success = false;
static byte displayTimer = 0;
switch (function) {
case PLUGIN_DEVICE_ADD: {
Device[++deviceCount].Number = PLUGIN_ID_117;
Device[deviceCount].Type = DEVICE_TYPE_DUAL;
Device[deviceCount].VType = SENSOR_TYPE_QUAD;
Device[deviceCount].Ports = 0;
Device[deviceCount].PullUpOption = true;
Device[deviceCount].InverseLogicOption = false;
Device[deviceCount].FormulaOption = false;
Device[deviceCount].ValueCount = 4;
Device[deviceCount].SendDataOption = true;
Device[deviceCount].TimerOption = true;
Device[deviceCount].GlobalSyncOption = true;
break;
}
case PLUGIN_GET_DEVICENAME: {
string = F(PLUGIN_NAME_117);
break;
}
case PLUGIN_GET_DEVICEVALUENAMES: {
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0],PSTR(PLUGIN_VALUENAME1_117));
break;
}
case PLUGIN_TEN_PER_SECOND: {
char __buffer[80];
uint16_t i;
uint8_t c;
String Vidx;
String Nvalue;
String Svalue;
String Nswitch;
while (nextion->available() > 0) {
delay(10);
c = nextion->read();
if (0x65 == c) {
if (nextion->available() >= 6) {
__buffer[0] = c;
for (i = 1; i < 7; i++) {
__buffer[i] = nextion->read();
}
__buffer[i] = 0x00;
if (0xFF == __buffer[4] && 0xFF == __buffer[5] && 0xFF == __buffer[6]) {
Plugin_117_code = ((__buffer[1] >> 8) & __buffer[2] >> 8) & __buffer[3];
UserVar[event->BaseVarIndex] = __buffer[1] * 256 + __buffer[2];
UserVar[event->BaseVarIndex + 1] = __buffer[3];
String log = F("Nextion : code: ");
log += __buffer[1];
log += ",";
log += __buffer[2];
log += ",";
log += __buffer[3];
addLog(LOG_LEVEL_INFO, log);
sendData(event);
}
}
} else {
if (c == '|') {
i = 1;
__buffer[0] = c;
c=0;
while (nextion->available() > 0) {
__buffer[i] = nextion->read();
Serial.write((char)__buffer[i]);
if (__buffer[i]==0x0d) break;
i++;
}
Serial.println("end");
__buffer[i] = 0x00;
String tmpString = __buffer;
int argIndex = tmpString.indexOf("idx=");
int argEnd = tmpString.indexOf('&');
if (argIndex)
Vidx = tmpString.substring(argIndex + 4,argEnd);
switch (__buffer[1]){
case 'u':
argIndex = tmpString.indexOf("nvalue=");
argEnd = tmpString.indexOf('&',argIndex);
if (argIndex)
Nvalue = tmpString.substring(argIndex + 7,argEnd);
argIndex = tmpString.indexOf("svalue=",argIndex);
argEnd = tmpString.indexOf(0x0a);
if (argIndex)
Svalue = tmpString.substring(argIndex + 7,argEnd);
break;
case 's':
argIndex = tmpString.indexOf("switchcmd=",argIndex);
argEnd = tmpString.indexOf(0x0a);
if (argIndex)
Nvalue = tmpString.substring(argIndex + 10,argEnd);
if (Nvalue=="On")
Nswitch='1';
if (Nvalue=="Off")
Nswitch='0';
break;
}
// }
// tmpString = tmpString.substring(0, argIndex);
// if (tmpString.equalsIgnoreCase(F("NEXTION"))) {
// argIndex = string.indexOf(',');
// tmpString = string.substring(argIndex + 1);
//
// sendCommand(tmpString.c_str());
//
// success = true;
Serial.println(tmpString);
Serial.println(Vidx);
Serial.println(Nvalue);
Serial.println(Svalue);
Serial.println(Nswitch);
UserVar[event->BaseVarIndex] = Vidx.toFloat();
UserVar[event->BaseVarIndex+1] = Nvalue.toFloat();
UserVar[event->BaseVarIndex+2] = Svalue.toFloat();
UserVar[event->BaseVarIndex+3] = Nswitch.toFloat();
String log = F("Nextion : send command: ");
log += __buffer;
log += UserVar[event->BaseVarIndex];
addLog(LOG_LEVEL_INFO, log);
ExecuteCommand(VALUE_SOURCE_SYSTEM, __buffer);
}
}
}
if (Settings.TaskDevicePin3[event->TaskIndex] != -1) {
if (!digitalRead(Settings.TaskDevicePin3[event->TaskIndex])) {
Plugin_117_displayOn();
displayTimer = Settings.TaskDevicePluginConfig[event->TaskIndex][2];
}
}
success = true;
break;
}
case PLUGIN_ONCE_A_SECOND: {
if ( displayTimer > 0) {
displayTimer--;
if (displayTimer == 0)
Plugin_117_displayOff();
}
break;
}
case PLUGIN_WEBFORM_SAVE: {
String plugin1 = WebServer.arg("plugin_117_timer");
Settings.TaskDevicePluginConfig[event->TaskIndex][0] = plugin1.toInt();
String plugin2 = WebServer.arg("plugin_117_rxwait");
Settings.TaskDevicePluginConfig[event->TaskIndex][1] = plugin2.toInt();
String plugin3 = WebServer.arg("plugin_117_events");
Settings.TaskDevicePluginConfig[event->TaskIndex][2] = plugin3.toInt();
String plugin4 = WebServer.arg("plugin_117_sensortype");
Settings.TaskDevicePluginConfig[event->TaskIndex][3] = plugin4.toInt();
char deviceTemplate[8][64];
for (byte varNr = 0; varNr < 8; varNr++) {
char argc[25];
String arg = F("Plugin_117_template");
arg += varNr + 1;
arg.toCharArray(argc, 25);
String tmpString = WebServer.arg(argc);
strncpy(deviceTemplate[varNr], tmpString.c_str(), sizeof(deviceTemplate[varNr]));
}
// Settings.TaskDeviceID[event->TaskIndex] = 1; // temp fix, needs a dummy value
SaveCustomTaskSettings(event->TaskIndex, (byte*)&deviceTemplate, sizeof(deviceTemplate));
success = true;
break;
}
case PLUGIN_WEBFORM_LOAD: {
char tmpString[128];
char deviceTemplate[8][64];
LoadCustomTaskSettings(event->TaskIndex, (byte*)&deviceTemplate, sizeof(deviceTemplate));
for (byte varNr = 0; varNr < 8; varNr++)
{
string += F("<TR><TD>Line ");
string += varNr + 1;
string += F(":<TD><input type='text'li size='50' maxlength='50' name='Plugin_117_template");
string += varNr + 1;
string += F("' value='");
string += deviceTemplate[varNr];
string += F("'>");
}
string += F("<TR><TD>Display button:<TD>");
addPinSelect(false, string, "taskdevicepin3", Settings.TaskDevicePin3[event->TaskIndex]);
sprintf_P(tmpString, PSTR("<TR><TD>Display Timeout:<TD><input type='text' name='plugin_117_timer' value='%u'>"), Settings.TaskDevicePluginConfig[event->TaskIndex][2]);
string += tmpString;
success = true;
break;
}
case PLUGIN_INIT: {
LoadTaskSettings(event->TaskIndex);
// if ((ExtraTaskSettings.TaskDevicePluginConfigLong[0] != 0) && (ExtraTaskSettings.TaskDevicePluginConfigLong[1] != 0)) {
// if (Settings.TaskDevicePin1[event->TaskIndex] != -1) {
// pinMode(Settings.TaskDevicePin1[event->TaskIndex], OUTPUT);
// digitalWrite(Settings.TaskDevicePin1[event->TaskIndex], LOW);
// delay(500);
// digitalWrite(Settings.TaskDevicePin1[event->TaskIndex], HIGH);
// pinMode(Settings.TaskDevicePin1[event->TaskIndex], INPUT_PULLUP);
// }
displayTimer = Settings.TaskDevicePluginConfig[event->TaskIndex][2];
if (Settings.TaskDevicePin3[event->TaskIndex] != -1)
pinMode(Settings.TaskDevicePin3[event->TaskIndex], INPUT_PULLUP);
if (Settings.TaskDevicePin1[event->TaskIndex] != -1)
{
Plugin_117_RXpin = Settings.TaskDevicePin1[event->TaskIndex];
// pinMode(Plugin_117_RXpin, INPUT_PULLUP);
// attachInterrupt(Plugin_117_RXpin, RF_ISR, CHANGE);
success = true;
}
if (Settings.TaskDevicePin2[event->TaskIndex] != -1)
{
Plugin_117_TXpin = Settings.TaskDevicePin2[event->TaskIndex];
// pinMode(Plugin_117_TXpin, OUTPUT);
}
if (!nextion) {
nextion = new SoftwareSerial(13,14);
// nextion = new SoftwareSerial(Plugin_117_RXpin , Plugin_117_TXpin);
}
Serial.print("pin: ");
Serial.println(Settings.TaskDevicePin1[event->TaskIndex]);
Serial.println(Settings.TaskDevicePin2[event->TaskIndex]);
Serial.println(Plugin_117_RXpin);
Serial.println(Plugin_117_TXpin);
nextion->begin(9600);
success = true;
break;
}
case PLUGIN_READ: {
char deviceTemplate[8][64];
LoadCustomTaskSettings(event->TaskIndex, (byte*)&deviceTemplate, sizeof(deviceTemplate));
for (byte x = 0; x < 8; x++) {
String tmpString = deviceTemplate[x];
if (tmpString.length()) {
String newString = parseTemplate(tmpString, 0);
Serial.println(newString);
sendCommand(newString.c_str());
}
}
success = false;
break;
}
case PLUGIN_WRITE: {
String tmpString = string;
int argIndex = tmpString.indexOf(',');
if (argIndex)
tmpString = tmpString.substring(0, argIndex);
if (tmpString.equalsIgnoreCase(F("NEXTION"))) {
argIndex = string.indexOf(',');
tmpString = string.substring(argIndex + 1);
sendCommand(tmpString.c_str());
Serial.println(tmpString);
success = true;
}
break;
}
}
return success;
}
void Plugin_117_displayOn() {
}
void Plugin_117_displayOff() {
}
void sendCommand(const char *cmd) {
nextion->print(cmd);
nextion->write(0xff);
nextion->write(0xff);
nextion->write(0xff);
}
Re: Nextion display plugin
With the advice of @majklovec page 4 I managed to understand how to send commands to domoticz.
It's simple.
In a rule
log :
Domoticz log :
I'm happy
It's simple.
I create a button, when i push in the logs1) Try to make a button in the Nextion and check on "Touch release event" - "Send component id"
See the event sent
Code: Select all
2726562 : Nextion : code:
2726563 : EVENT: NEXTION#code=6.00
2726566 : EVENT: NEXTION#=0.00
2726569 : EVENT: NEXTION#=0.00
2726571 : EVENT: NEXTION#=0.00
Code: Select all
on NEXTION#code=6.00 do
sendtohttp 192.168.1.19,8080,/json.htm?param=switchlight&type=command&idx=52&switchcmd=On
endon
Code: Select all
2765418 : EVENT: NEXTION#code=6.00
2765421 : ACT : sendtohttp 192.168.1.19,8080,/json.htm?param=switchlight&type=command&idx=52&switchcmd=On
2765479 : EVENT: NEXTION#=0.00
2765482 : EVENT: NEXTION#=0.00
2765484 : EVENT: NEXTION#=0.00
Code: Select all
2017-01-16 23:13:14.416 User: Admin initiated a switch command (52/Led buanderie/On)
Last edited by Jeff on 17 Jan 2017, 22:40, edited 1 time in total.
Re: Nextion display plugin
Ah ... I am going to try that tonight
Re: Nextion display plugin
This works very well too.
Re: Nextion display plugin
Hello
It is my First Time here. I use one Wemos with a 2,8" Nextion. I have found this Forum to handle it with espeasy.
I have install r147 rc08 yesterday. Everything ok by flash. Now when i Look in to the devices i dosn't finde Nextion display. What is wrong?
The second thing i'll not understand.... the Arduino code that is post here in these thread have i to install at the Wemos too??
I will use ESP and Nextion with Fhem.
Thanks for helping
Marko
It is my First Time here. I use one Wemos with a 2,8" Nextion. I have found this Forum to handle it with espeasy.
I have install r147 rc08 yesterday. Everything ok by flash. Now when i Look in to the devices i dosn't finde Nextion display. What is wrong?
The second thing i'll not understand.... the Arduino code that is post here in these thread have i to install at the Wemos too??
I will use ESP and Nextion with Fhem.
Thanks for helping
Marko
Re: Nextion display plugin
Hi Marko,
Yes, you have to copy the code in this thread into a file named _P117_Nextion.ino.
I use wordpad for that.
Save that file in the ESPEasy folder.
Start the Arduino IDE, complie and flash.
That should be it.
Yes, you have to copy the code in this thread into a file named _P117_Nextion.ino.
I use wordpad for that.
Save that file in the ESPEasy folder.
Start the Arduino IDE, complie and flash.
That should be it.
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.
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:
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.
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:
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
Thanks for the examples and explanation, it helps us
I have to wait for my new nextion, I have broken mine by dropping it
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
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
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
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
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
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
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!
I found this blog which is very informative about the Nextion/ESP symbiosis.
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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
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 !
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 !
- 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!
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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Nextion display plugin
I want help you but i don't understand your question !
What display want you
You can look the post i made in french
https://easydomoticz.com/forum/viewtopi ... =24&t=3731
What display want you
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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
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!
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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
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 !
How do you for the battery, we can see a photo inside !
- 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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
-
- 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 232805 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 ...?
Who is online
Users browsing this forum: No registered users and 144 guests