Nextion display plugin
Moderators: grovkillen, Stuntteam, TD-er
Re: Nextion display plugin
Well,
Just tried it with ESPEasy 147 on a nodemcu v 1.0 and it does the same.
Can't understand this a tall
Just tried it with ESPEasy 147 on a nodemcu v 1.0 and it does the same.
Can't understand this a tall
ESP32, Arduino's,Raspberry Pi's, ESP8266's, Nextion's, Sonoff's, LightWaveRF's, RFXCom 433, and a headache
And a HackRF One, as a present to myself.
And a HackRF One, as a present to myself.
Re: Nextion display plugin
I am compiling without problemsnick-head wrote:Well,
Just tried it with ESPEasy 147 on a nodemcu v 1.0 and it does the same.
Can't understand this a tall
You have to inside the ESPEasy file _104.ino
Re: Nextion display plugin
I have the same problem. Need to dig into this.nick-head wrote:Hi,
I am using the previously mentioned Nextion Plugin (104) and came across a problem.
I cannot output to a n? number if it's below 100, unless I put zero's in front to
make a 3 digit number. Like 001, 073 etc.
Any idea what I am doing wrong ?
Regards
Nick
PS, I am using an ESP8266 NodeMCU V0.9. This maybe the problem, I will try on a 1.0 later on and report back
Re: Nextion display plugin
Anyone found out why this is happening ?
ESP32, Arduino's,Raspberry Pi's, ESP8266's, Nextion's, Sonoff's, LightWaveRF's, RFXCom 433, and a headache
And a HackRF One, as a present to myself.
And a HackRF One, as a present to myself.
Re: Nextion display plugin
Yes. I tried to put the entire file in the ESP8266nu/ESPEasyPluginPlayground. Hope I took the right steps.nick-head wrote:Anyone found out why this is happening ?
In the mean time, hereunder the new code.
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;
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 == 's') {
i = 1;
__buffer[0] = c;
c=0;
while (nextion->available() > 0) {
__buffer[i++] = nextion->read();
Serial.write((char)__buffer[i]);
}
Serial.println();
__buffer[i] = 0x00;
UserVar[event->BaseVarIndex] = __buffer[2];
UserVar[event->BaseVarIndex+1] = __buffer[3];
UserVar[event->BaseVarIndex+2] = __buffer[4];
UserVar[event->BaseVarIndex+3] = __buffer[5];
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]);
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
Nice one Bert,
I am just in the process of uploading to the ESP.
Right, uploaded. Had to remove original plugin as it has redefinitions of SoftwarSerial and other things.
OK, done.
Can't find RX/TX as before. Can't even make it produce anything on the screen.
Totally different interface. Will have to look later, I may have done something wrong at my end.
I am just in the process of uploading to the ESP.
Right, uploaded. Had to remove original plugin as it has redefinitions of SoftwarSerial and other things.
OK, done.
Can't find RX/TX as before. Can't even make it produce anything on the screen.
Totally different interface. Will have to look later, I may have done something wrong at my end.
ESP32, Arduino's,Raspberry Pi's, ESP8266's, Nextion's, Sonoff's, LightWaveRF's, RFXCom 433, and a headache
And a HackRF One, as a present to myself.
And a HackRF One, as a present to myself.
Re: Nextion display plugin
I found that the originale interface did not work anymore, so I had to change it.nick-head wrote:Nice one Bert,
I am just in the process of uploading to the ESP.
Right, uploaded. Had to remove original plugin as it has redefinitions of SoftwarSerial and other things.
OK, done.
Can't find RX/TX as before. Can't even make it produce anything on the screen.
Totally different interface. Will have to look later, I may have done something wrong at my end.
1st GPIO is now Rx and 2nd GPIO Tx.
Sorry for the inconvenience, but please do not forget, I am only trying to persuade more professional programmers to make ik more beautiful
IDX/Var is not yet functional and neither are Display button and Display Timeout.
You can send commands and data to it:
http://espeasy-ip/control?cmd=NEXTION,rest ====> resets the display
http://espeasy-ip/control?cmd=NEXTION,dim=50 ====> dims the backlight to 50%
http://espeasy-ip/control?cmd=NEXTION,page0.n0.val=12 ====> sets the value of n0 on page 0 to 12
http://espeasy-ip/control?cmd=NEXTION,page0.t5.txt="hoi" ====> sets the text of t0 on page 0 to hoi
- Attachments
-
- P104_IF.png (58.8 KiB) Viewed 112090 times
Re: Nextion display plugin
No problem Bert,
I have only been experimenting with the plugins for a few days and I have learnt a few things.
I have great respect for any developers who commit their time to produce "free" software based
on ideas generated by many people.
I am using ESPeasy in my home automation system and I have a lot to learn.
Thanks for your time and help.
Nick
I have only been experimenting with the plugins for a few days and I have learnt a few things.
I have great respect for any developers who commit their time to produce "free" software based
on ideas generated by many people.
I am using ESPeasy in my home automation system and I have a lot to learn.
Thanks for your time and help.
Nick
ESP32, Arduino's,Raspberry Pi's, ESP8266's, Nextion's, Sonoff's, LightWaveRF's, RFXCom 433, and a headache
And a HackRF One, as a present to myself.
And a HackRF One, as a present to myself.
Re: Nextion display plugin
That has cured the <100 problem Bert, works absolutely fine now.
now I have to find something to do with it now.
Thanks Bert, your a star.
Regards
Nick
now I have to find something to do with it now.
Thanks Bert, your a star.
Regards
Nick
ESP32, Arduino's,Raspberry Pi's, ESP8266's, Nextion's, Sonoff's, LightWaveRF's, RFXCom 433, and a headache
And a HackRF One, as a present to myself.
And a HackRF One, as a present to myself.
Re: Nextion display plugin
Glad tot be of help,nick-head wrote:That has cured the <100 problem Bert, works absolutely fine now.
now I have to find something to do with it now.
Thanks Bert, your a star.
Regards
Nick
Re: Nextion display plugin
Hello,
Congratulations for this development. I bought a direct nextion when i discovered it.
I try this plugin for a few days and I can not.
I created a page, a text box, a value box and a gauge.
I have compiled the last plugin on this page 8 and others before.
I plugged the RX on GPIO13- D7 and TX on GPIO14-D5
It does not communicate, I try the lines or the rules.
Ex line 1: page0.n0.val = 20
Line 2 : page0.t0.txt="[ds18b20#TEMPERATURE]"
Rules :
On ds18b20#TEMPERATURE do
NEXTION,t0.txt="[ds18b20#TEMPERATURE]"
endon
What I forgot ? Thanks
Congratulations for this development. I bought a direct nextion when i discovered it.
I try this plugin for a few days and I can not.
I created a page, a text box, a value box and a gauge.
I have compiled the last plugin on this page 8 and others before.
I plugged the RX on GPIO13- D7 and TX on GPIO14-D5
It does not communicate, I try the lines or the rules.
Ex line 1: page0.n0.val = 20
Line 2 : page0.t0.txt="[ds18b20#TEMPERATURE]"
Rules :
On ds18b20#TEMPERATURE do
NEXTION,t0.txt="[ds18b20#TEMPERATURE]"
endon
What I forgot ? Thanks
Re: Nextion display plugin
Hi, sorry to hear it does not work for you.
I assume you can see the setup page in devices in ESPEasy?
And that you can set GPIO 1 and GPIO 2
And that you did not mix up Tx and Rx?
What hardware do you use?
I assume you can see the setup page in devices in ESPEasy?
And that you can set GPIO 1 and GPIO 2
And that you did not mix up Tx and Rx?
What hardware do you use?
Re: Nextion display plugin
Thx for your help.
I use a wemos d1 mini.
I paste the sketch in espeay.ino with plugin p117... I compile, it's good. I upload.
Yes i can see the configuration page with the gpio.
I configure the gpio for the rx and tx, not error.
I made a page on the nextion with try a block t0, n0, z0...
I write on in the line 1, line 2....and with rules to try...
What is the wiring ? Need a special library, i have nextion library and i didn't error when i compile, special serial 9600 ou?
Configuration espeasy : domoticz mqtt, spi, configuration pin ?
I use a wemos d1 mini.
I paste the sketch in espeay.ino with plugin p117... I compile, it's good. I upload.
Yes i can see the configuration page with the gpio.
I configure the gpio for the rx and tx, not error.
I made a page on the nextion with try a block t0, n0, z0...
I write on in the line 1, line 2....and with rules to try...
What is the wiring ? Need a special library, i have nextion library and i didn't error when i compile, special serial 9600 ou?
Configuration espeasy : domoticz mqtt, spi, configuration pin ?
Re: Nextion display plugin
I do not use the Nextion library.
The Nextion itself is a basic model.
The Nextion requires 5 volt power and the ESP 8266 can only handle up to 3.3 volt.
On the Tx pin of the Wemos, you can connect the Rx of the Nextion.
On the Rx pin you need a voltage limiter, because the voltage of the Nextion Tx pin is 5 volts.
For that purpose I use a small signal, high speed diode and a resistor. 1n4448 or so will do fine.
Kathode to Tx of Nextion.
Anode to Rx of Wemos
Resistor of some 10 k or so from Rx of Wemos to + 3.3 volt of Wemos.
You can also try an use the Nextion IDE with a USB to serial converterd to test the Nextion.
The Nextion itself is a basic model.
The Nextion requires 5 volt power and the ESP 8266 can only handle up to 3.3 volt.
On the Tx pin of the Wemos, you can connect the Rx of the Nextion.
On the Rx pin you need a voltage limiter, because the voltage of the Nextion Tx pin is 5 volts.
For that purpose I use a small signal, high speed diode and a resistor. 1n4448 or so will do fine.
Kathode to Tx of Nextion.
Anode to Rx of Wemos
Resistor of some 10 k or so from Rx of Wemos to + 3.3 volt of Wemos.
You can also try an use the Nextion IDE with a USB to serial converterd to test the Nextion.
Re: Nextion display plugin
Hi Bert,
I think I'm having a similar (or the same) problem as Jeff.
I tried your plugin with a plain esp-12f or a nodemcu-V2.
The pins I use are GPIO13 und 14 (D7 and D5).
The pins itself are functional: for a test I changed the device to a switch and shortened them to ground. success.
Then I connected an FTDI to the pins and there is nothing. It doesn't matter if I use the URL with control?cmd=NEXTION,dim=0 or something in the device configuration. The control window always stays empty. It seems the plugin does not use the configured pins.
The hardware must be ok. For the next test I uploaded the firmware esplink, and then I saw communication on the wire.
Do you have another idea what I can check?
regards
Pete
I think I'm having a similar (or the same) problem as Jeff.
I tried your plugin with a plain esp-12f or a nodemcu-V2.
The pins I use are GPIO13 und 14 (D7 and D5).
The pins itself are functional: for a test I changed the device to a switch and shortened them to ground. success.
Then I connected an FTDI to the pins and there is nothing. It doesn't matter if I use the URL with control?cmd=NEXTION,dim=0 or something in the device configuration. The control window always stays empty. It seems the plugin does not use the configured pins.
The hardware must be ok. For the next test I uploaded the firmware esplink, and then I saw communication on the wire.
Do you have another idea what I can check?
regards
Pete
Re: Nextion display plugin
I will start with a fresh wemos to test.
Re: Nextion display plugin
You could also try to change a part of the code and re compile:
Change:
if (!nextion) {
// nextion = new SoftwareSerial(13,14);
nextion = new SoftwareSerial(Plugin_117_RXpin , Plugin_117_TXpin);
}
into:
if (!nextion) {
nextion = new SoftwareSerial(13,14);
// nextion = new SoftwareSerial(Plugin_117_RXpin , Plugin_117_TXpin);
}
Per haps something goes wrong with the pin assignment.
SPI has to be disabled.
Change:
if (!nextion) {
// nextion = new SoftwareSerial(13,14);
nextion = new SoftwareSerial(Plugin_117_RXpin , Plugin_117_TXpin);
}
into:
if (!nextion) {
nextion = new SoftwareSerial(13,14);
// nextion = new SoftwareSerial(Plugin_117_RXpin , Plugin_117_TXpin);
}
Per haps something goes wrong with the pin assignment.
SPI has to be disabled.
Re: Nextion display plugin
Hi Bert,
it works now. Thanks for your quick workaround.
regards
it works now. Thanks for your quick workaround.
regards
Re: Nextion display plugin
Thank you for the time.
I understand a little better but I still have questions.
The tx and the rx of the nextion, is it connected to the tx and the rx of the wemos or the GPIO 13 and 14 of the wemos ?
The 5v on the 3.3v, I had not seen my mistake
D3 : 1n4007
R2 : 10K
I have ordered a level swicher since, 60 days have not arrived!
I recompiled, tried my editing on 13 and 14 with your proposition but nothing, I tried other GPIOs, nothing either.
My program nextion is it good ? I draw a txt (t0), a number (N0) and a jauge (Z0) !
I go to ski tomorrow, we will see my return
I understand a little better but I still have questions.
The tx and the rx of the nextion, is it connected to the tx and the rx of the wemos or the GPIO 13 and 14 of the wemos ?
The 5v on the 3.3v, I had not seen my mistake
D3 : 1n4007
R2 : 10K
I have ordered a level swicher since, 60 days have not arrived!
It workThe pins itself are functional: for a test I changed the device to a switch and shortened them to ground. success.
It workYou can also try an use the Nextion IDE with a USB to serial converterd to test the Nextion.
I recompiled, tried my editing on 13 and 14 with your proposition but nothing, I tried other GPIOs, nothing either.
My program nextion is it good ? I draw a txt (t0), a number (N0) and a jauge (Z0) !
I go to ski tomorrow, we will see my return
Re: Nextion display plugin
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.
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.
-
- 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 ?
Who is online
Users browsing this forum: No registered users and 48 guests