Nextion display plugin

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
Allycat1972
Normal user
Posts: 25
Joined: 19 Apr 2016, 11:12

Re: Nextion display plugin

#91 Post by Allycat1972 » 08 Jan 2017, 14:12

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)
IMG_2143.JPG
IMG_2143.JPG (105 KiB) Viewed 129012 times
IMG_2144.JPG
IMG_2144.JPG (137.02 KiB) Viewed 129012 times

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: Nextion display plugin

#92 Post by Jeff » 08 Jan 2017, 18:39

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
Thank you for help me.
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.

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: Nextion display plugin

#93 Post by Jeff » 15 Jan 2017, 22:50

Yes it work :mrgreen:
Thanks @BertB

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: Nextion display plugin

#94 Post by Jeff » 16 Jan 2017, 21:04

Hello,

I know how to handle texts and retrieve values ​​via mqtt :D
How do you do the buttons to send a command to domoticz ?

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#95 Post by BertB » 16 Jan 2017, 22:50

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.

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);
}

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: Nextion display plugin

#96 Post by Jeff » 16 Jan 2017, 23:15

With the advice of @majklovec page 4 I managed to understand how to send commands to domoticz.
It's simple.
1) Try to make a button in the Nextion and check on "Touch release event" - "Send component id"
See the event sent
I create a button, when i push in the logs

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
In a rule

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
log :

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
Domoticz log :

Code: Select all

2017-01-16 23:13:14.416 User: Admin initiated a switch command (52/Led buanderie/On)
I'm happy :mrgreen:
Last edited by Jeff on 17 Jan 2017, 22:40, edited 1 time in total.

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#97 Post by BertB » 17 Jan 2017, 12:23

Ah ... I am going to try that tonight

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#98 Post by BertB » 17 Jan 2017, 23:28

This works very well too.

marko67
New user
Posts: 7
Joined: 20 Jan 2017, 06:40

Re: Nextion display plugin

#99 Post by marko67 » 20 Jan 2017, 07:13

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

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#100 Post by BertB » 21 Jan 2017, 18:23

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.

User avatar
Binder
Normal user
Posts: 10
Joined: 06 Jan 2017, 13:17
Location: Germany

Re: Nextion display plugin

#101 Post by Binder » 22 Jan 2017, 07:51

@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.

marko67
New user
Posts: 7
Joined: 20 Jan 2017, 06:40

Re: Nextion display plugin

#102 Post by marko67 » 22 Jan 2017, 13:19

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?

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#103 Post by BertB » 22 Jan 2017, 13:27

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

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#104 Post by BertB » 22 Jan 2017, 15:34

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

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

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

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: Nextion display plugin

#105 Post by Jeff » 23 Jan 2017, 23:05

Very nice changes Berb :)

Thanks for the examples and explanation, it helps us :D

I have to wait for my new nextion, I have broken mine by dropping it :(

rhannink
New user
Posts: 7
Joined: 14 Nov 2016, 10:49

Re: Nextion display plugin

#106 Post by rhannink » 28 Jan 2017, 13:50

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

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#107 Post by BertB » 28 Jan 2017, 15:28

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.

tiit12
New user
Posts: 1
Joined: 09 Feb 2017, 11:57

Re: Nextion display plugin

#108 Post by tiit12 » 09 Feb 2017, 12:06

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
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).

Tiit

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#109 Post by BertB » 09 Feb 2017, 15:08

You might be right. I will check tonight.

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#110 Post by BertB » 09 Feb 2017, 20:01

@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.

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: Nextion display plugin

#111 Post by Jeff » 21 Feb 2017, 22:20

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. :mrgreen:

Thank you for the nextion plugin !!!
Nextion_weather.jpg
Nextion_weather.jpg (33.33 KiB) Viewed 233491 times
This is my broken test nextion :(

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#112 Post by BertB » 22 Feb 2017, 14:48

Nice!
And may be broken, but still going strong.

mike86
New user
Posts: 1
Joined: 15 Feb 2017, 09:34

Re: Nextion display plugin

#113 Post by mike86 » 14 Mar 2017, 11:22

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

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: Nextion display plugin

#114 Post by Jeff » 10 Apr 2017, 21:20

I tried the code of thermostat to @BertB but the code send on serial is bad.
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
I tried the old (playground) and newest (post page 11) version, no change :(

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
Nextion ide new version v0.46
Arduino ide 1.6.13

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Nextion display plugin

#115 Post by grovkillen » 11 Apr 2017, 10:16

Just want to add that I just got my 2.4" Nextion display the other day and I follow this thread with great interest! :P

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 :idea: :idea: :idea:

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: Nextion display plugin

#116 Post by Jeff » 11 Apr 2017, 23:29

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 :D
20170411_232631.jpg
20170411_232631.jpg (42.17 KiB) Viewed 233200 times
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 ! ;)

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Nextion display plugin

#117 Post by grovkillen » 12 Apr 2017, 06:49

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 :idea: :idea: :idea:

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: Nextion display plugin

#118 Post by Jeff » 12 Apr 2017, 09:45

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

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Nextion display plugin

#119 Post by grovkillen » 12 Apr 2017, 10:23

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?
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 :idea: :idea: :idea:

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: Nextion display plugin

#120 Post by Jeff » 12 Apr 2017, 12:50

Yes very easy.
Have you see my post page 10 with code = ID button ?

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Nextion display plugin

#121 Post by grovkillen » 12 Apr 2017, 13:58

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 :idea: :idea: :idea:

wchpikus
New user
Posts: 1
Joined: 09 Jun 2017, 06:29

Re: Nextion display plugin

#122 Post by wchpikus » 09 Jun 2017, 07:04

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

dokho
New user
Posts: 6
Joined: 11 Jul 2017, 18:32

Re: Nextion display plugin

#123 Post by dokho » 11 Jul 2017, 18:36

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)

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#124 Post by BertB » 12 Jul 2017, 15:06

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

User avatar
ledfreak3d
Normal user
Posts: 48
Joined: 21 Oct 2016, 12:41

Re: Nextion display plugin

#125 Post by ledfreak3d » 21 Aug 2017, 08:22

not espeasy but works very well with domoticz


https://www.youtube.com/watch?v=8l1OMS5RgYA
Domoticz Synology Esp easy Location Netherlands /Hoorn

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: Nextion display plugin

#126 Post by Jeff » 24 Aug 2017, 19:02

Ouah good integration !
How do you for the battery, we can see a photo inside ! :D

User avatar
ledfreak3d
Normal user
Posts: 48
Joined: 21 Oct 2016, 12:41

Re: Nextion display plugin

#127 Post by ledfreak3d » 24 Aug 2017, 20:21

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
Domoticz Synology Esp easy Location Netherlands /Hoorn

dokho
New user
Posts: 6
Joined: 11 Jul 2017, 18:32

Re: Nextion display plugin

#128 Post by dokho » 13 Oct 2017, 16:59

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
Hello,

Is it possible to do the same think with MQTT ?


Regards,

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Nextion display plugin

#129 Post by grovkillen » 13 Oct 2017, 17:12

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 :idea: :idea: :idea:

dragowasabi
New user
Posts: 7
Joined: 28 Oct 2017, 16:16

Re: Nextion display plugin

#130 Post by dragowasabi » 28 Oct 2017, 16:44

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
WP_20171028_16_28_16_Pro.jpg (3.31 MiB) Viewed 232805 times

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#131 Post by BertB » 28 Oct 2017, 17:27

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.

dragowasabi
New user
Posts: 7
Joined: 28 Oct 2017, 16:16

Re: Nextion display plugin

#132 Post by dragowasabi » 28 Oct 2017, 17:32

Hi. The display is prepared as follows: I have the object t0 on which I want to display some text, eg. hello

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#133 Post by BertB » 28 Oct 2017, 18:14

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?

dragowasabi
New user
Posts: 7
Joined: 28 Oct 2017, 16:16

Re: Nextion display plugin

#134 Post by dragowasabi » 28 Oct 2017, 18:33

Where is the baud rate set? In the plugin?
Unfortunately I do not have USB to serial converter ...

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#135 Post by BertB » 28 Oct 2017, 18:40

How did you program the Display with USB to serial?

dragowasabi
New user
Posts: 7
Joined: 28 Oct 2017, 16:16

Re: Nextion display plugin

#136 Post by dragowasabi » 28 Oct 2017, 18:57

with sd card

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#137 Post by BertB » 28 Oct 2017, 19:05

Difficult to test then.

dragowasabi
New user
Posts: 7
Joined: 28 Oct 2017, 16:16

Re: Nextion display plugin

#138 Post by dragowasabi » 28 Oct 2017, 19:08

And what USB to serial converter to buy

dragowasabi
New user
Posts: 7
Joined: 28 Oct 2017, 16:16

Re: Nextion display plugin

#139 Post by dragowasabi » 28 Oct 2017, 19:35

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.

dragowasabi
New user
Posts: 7
Joined: 28 Oct 2017, 16:16

Re: Nextion display plugin

#140 Post by dragowasabi » 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 ...?

Post Reply

Who is online

Users browsing this forum: No registered users and 144 guests