Nextion display plugin

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#331 Post by BertB » 27 Jul 2018, 18:25

I removed the part with:

Code: Select all

        if ((int(Settings.TaskDevicePluginConfig[event->TaskIndex][2]) != int(UserVar[event->BaseVarIndex])) ||
          (int(Settings.TaskDevicePluginConfig[event->TaskIndex][3]) != int(UserVar[event->BaseVarIndex+1]))) {
            Settings.TaskDevicePluginConfig[event->TaskIndex][2] = UserVar[event->BaseVarIndex];  // Save new idx.
            Settings.TaskDevicePluginConfig[event->TaskIndex][3] = UserVar[event->BaseVarIndex+1]; // Save new value.
            success = true;
        } 
        else {
            success = false;
        }
entirely and the disco is still there ... :?

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#332 Post by ThomasB » 28 Jul 2018, 02:22

@BertB: Sorry to hear about the problems. I've made some changes, plus added some log info to help debug the problems.

This version has a new checkbox for those users that want to resend idx and value data at the interval. Of course I know you don't want these values to be resent, so uncheck the Interval Options->Resend Values. When deselected/unchecked, the "Lines" statements will still act at each interval timeout, but the idx & value data will be skipped.

Code: Select all

//#######################################################################################################
//#######################################################################################################
//################################### Plugin 075: Nextion <info@sensorio.cz>  ###########################
//###################################   Created on the work of  majklovec     ###########################
//###################################    Revisions by BertB and ThomasB       ########################### 
//###################################    Last Revision: July-27-2018 (TB)     ###########################
//#######################################################################################################

#ifdef USES_P075

#include <ESPeasySoftwareSerial.h>

// *****************************************************************************************************
// Defines start here
// *****************************************************************************************************

// Plug-In defines
#define PLUGIN_075
#define PLUGIN_ID_075 75
#define PLUGIN_NAME_075 "Display - Nextion [TESTING]"
#define PLUGIN_VALUENAME1_075 "idx"
#define PLUGIN_VALUENAME2_075 "value"

// Configuration Settings. Custom Configuration Memory must be less than 512 Bytes!
#define Nlines 10        // Custom Config, Number of user entered Command-Text Lines. 
#define Lenlines 51      // Custom Config, Length of user entered Command-Text Lines.

// Nextion defines
#define RXBUFFSZ  80     // Local Serial RxD buffer.  
#define TOUCH_BASE 500   // Base offset for 0X65 Touch Event Component ID.

// Serial defines
#define B9600    0  
#define B38400   1
#define B57600   2
#define B115200  3
#define DEFAULT_BAUD B9600

// Global vars
ESPeasySoftwareSerial *SoftSerial = NULL;
char deviceTemplate[Nlines][Lenlines]; 
int rxPin = -1;
int txPin = -1;


// *****************************************************************************************************
// PlugIn starts here
// *****************************************************************************************************

boolean Plugin_075(byte function, struct EventStruct *event, String& string) 
{
  boolean success = false;
  static uint8_t BaudCode = 0;                          // Web GUI baud rate drop down. 9600 if 0, See array for other rates. 
  static boolean HwSerial = false;                      // Use Hardware Serial if true.
  static boolean AdvHwSerial = false;                   // Web GUI checkbox enabled, Hardware Serial if true.
  static boolean IncludeValues = false;                 // Web GUI checkbox enabled, Send Values at interval if true.
  uint32_t AdvHwBaud = 9600UL;

  switch (function) {

    case PLUGIN_DEVICE_ADD: {
      Device[++deviceCount].Number = PLUGIN_ID_075;
      Device[deviceCount].Type = DEVICE_TYPE_DUAL;
      Device[deviceCount].VType = SENSOR_TYPE_DUAL;
      Device[deviceCount].Ports = 0;
      Device[deviceCount].PullUpOption = true;
      Device[deviceCount].InverseLogicOption = false;
      Device[deviceCount].FormulaOption = false;
      Device[deviceCount].ValueCount = 2;
      Device[deviceCount].SendDataOption = true;
      Device[deviceCount].TimerOption = true;
      Device[deviceCount].TimerOptional = true;             // Allow user to disable interval function.
      Device[deviceCount].GlobalSyncOption = true;
      break;
    }


    case PLUGIN_GET_DEVICENAME: {
      string = F(PLUGIN_NAME_075);
      break;
    }


    case PLUGIN_GET_DEVICEVALUENAMES: {
      strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0],PSTR(PLUGIN_VALUENAME1_075));
      strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[1],PSTR(PLUGIN_VALUENAME2_075));
      break;
    }


    case PLUGIN_GET_DEVICEGPIONAMES: {

      AdvHwSerial = Settings.TaskDevicePluginConfig[event->TaskIndex][0];
      rxPin = Settings.TaskDevicePin1[event->TaskIndex];
      txPin = Settings.TaskDevicePin2[event->TaskIndex];

      event->String1 = F("GPIO SS RX &larr; ");
      event->String2 = F("GPIO SS TX &rarr; ");

      if(AdvHwSerial == true) {
        if ((rxPin == 3 && txPin == 1) || (rxPin == 13 && txPin == 15)) {
            event->String1 = F("GPIO HW RX &larr; ");
            event->String2 = F("GPIO HW TX &rarr; ");
        }
      }
      break;
    }


    case PLUGIN_WEBFORM_LOAD: {
      rxPin = Settings.TaskDevicePin1[event->TaskIndex];
      txPin = Settings.TaskDevicePin2[event->TaskIndex];

      if (!((rxPin == 3 && txPin == 1) || (rxPin == 13 && txPin == 15))) { // Hardware Serial Compatible?
        Settings.TaskDevicePluginConfig[event->TaskIndex][0] = false;      // Not HW serial compatible, Reset Check Box.
      }
      
      if (rxPin == 3 && txPin == 1) {                                      // USB Port?
        if(Settings.TaskDevicePluginConfig[event->TaskIndex][0]==false &&  // Hardware serial disabled.
         Settings.TaskDeviceEnabled[event->TaskIndex] == true) {           // Plugin is enabled.
            Settings.TaskDevicePluginConfig[event->TaskIndex][0]=true;     // USB port access uses HW serial, Force set Check Box.
        }
      }

      if (Settings.TaskDevicePluginConfig[event->TaskIndex][0] == false) { // Softserial mode. 
        Settings.TaskDevicePluginConfig[event->TaskIndex][1] = B9600;      // Reset to 9600 baud.
      }

      addFormSeparator(2);
      addFormSubHeader(F("Enhanced Serial Communication"));
      addFormCheckBox(F("Use Hardware Serial"), F("AdvHwSerial"), Settings.TaskDevicePluginConfig[event->TaskIndex][0]);

      byte choice = Settings.TaskDevicePluginConfig[event->TaskIndex][1];
      String options[4];
      options[0] = F("9600");
      options[1] = F("38400");
      options[2] = F("57600");
      options[3] = F("115200");
      
      addFormSelector(F("Baud Rate"), F("plugin_075_baud"), 4, options, NULL, choice);      
      addFormNote(F("Un-check box for Soft Serial communication (low performance mode, 9600 Baud)."));
      addFormNote(F("Hardware Serial is available when the GPIO pins are RX=D7 and TX=D8."));
      addFormNote(F("D8 (GPIO-15) requires a Buffer Circuit (PNP transistor) or ESP boot may fail."));
      addFormNote(F("Do <b>NOT</b> enable the Serial Log file on Tools->Advanced->Serial Port."));
      
//    ** DEVELOPER DEBUG MESSAGE AREA **
//    addFormNote(ExtraTaskSettings.TaskDeviceName);    // Debug value.
//    int datax = (int)(Settings.TaskDeviceEnabled[event->TaskIndex]); // Debug value.
//    String Data = "Debug. Plugin Enable State: ";
//    Data += String(datax);
//    addFormNote(Data);


      addFormSubHeader(F("")); // Blank line, vertical space.
      addFormHeader(F("Nextion Command-Text Strings (Optional)"));
      
      char deviceTemplate[Nlines][Lenlines];
      LoadCustomTaskSettings(event->TaskIndex, (byte*)&deviceTemplate, sizeof(deviceTemplate));
      for (byte varNr = 0; varNr < Nlines; varNr++) {
        addFormTextBox(String(F("Line ")) + (varNr + 1), String(F("Plugin_075_template")) + (varNr + 1), deviceTemplate[varNr], Lenlines-1);
  
      }
      if( Settings.TaskDeviceTimer[event->TaskIndex]==0) {
        if(IncludeValues) {
            addFormNote(F("Interval Timer OFF, Nextion Lines (above) and Values (below) <b>NOT</b> scheduled for updates"));
        }
        else {
            addFormNote(F("Interval Timer OFF, Nextion Lines (above) <b>NOT</b> scheduled for updates"));
        }
      }

      addFormSeparator(2);
      addFormSubHeader(F("Interval Options"));
      addFormCheckBox(F("Resend <b>Values</b> (below) at Interval"), F("IncludeValues"), Settings.TaskDevicePluginConfig[event->TaskIndex][2]);

      success = true;
      break;
    }


    case PLUGIN_WEBFORM_SAVE: {

        String argName;

        char deviceTemplate[Nlines][Lenlines];
        for (byte varNr = 0; varNr < Nlines; varNr++)
        {
          String arg = F("Plugin_075_template");
          arg += varNr + 1;
          String tmpString = WebServer.arg(arg);
          strncpy(deviceTemplate[varNr], tmpString.c_str(), sizeof(deviceTemplate[varNr])-1);
            deviceTemplate[varNr][Lenlines-1]=0;
        }
        if(ExtraTaskSettings.TaskDeviceName[0] == 0) {          // User forgot to enter device name!
            strcpy(ExtraTaskSettings.TaskDeviceName,"NEXTION"); // Give standard name.
        }
        Settings.TaskDevicePluginConfig[event->TaskIndex][0] = isFormItemChecked(F("AdvHwSerial"));
        Settings.TaskDevicePluginConfig[event->TaskIndex][1] = getFormItemInt(F("plugin_075_baud"));
        Settings.TaskDevicePluginConfig[event->TaskIndex][2] = isFormItemChecked(F("IncludeValues"));
        SaveCustomTaskSettings(event->TaskIndex, (byte*)&deviceTemplate, sizeof(deviceTemplate));

        success = true;
        break;
    }


    case PLUGIN_INIT: {

      AdvHwSerial   = Settings.TaskDevicePluginConfig[event->TaskIndex][0];
      BaudCode      = Settings.TaskDevicePluginConfig[event->TaskIndex][1];
      IncludeValues = Settings.TaskDevicePluginConfig[event->TaskIndex][2];

      if(BaudCode > B115200) BaudCode = B9600;
      const uint32_t BaudArray[4] = {9600UL, 38400UL, 57600UL, 115200UL};
      AdvHwBaud = BaudArray[BaudCode];

      if (Settings.TaskDevicePin1[event->TaskIndex] != -1) {
        rxPin = Settings.TaskDevicePin1[event->TaskIndex];
      }
      if (Settings.TaskDevicePin2[event->TaskIndex] != -1) {
        txPin = Settings.TaskDevicePin2[event->TaskIndex];
      }

      if (SoftSerial != NULL) { 
        delete SoftSerial;
        SoftSerial = NULL;
      }

      String log = F("NEXTION075 : serial pin config RX:");
      log += rxPin;
      log += F(", TX:");
      log += txPin;
      if(Settings.TaskDeviceEnabled[event->TaskIndex]==true) 
       log += F(", Plugin Enabled");                    // Plugin is enabled.
      else log += F(", Plugin Disabled");
      addLog(LOG_LEVEL_INFO, log);

      if(Settings.TaskDeviceEnabled[event->TaskIndex] == true) { // Plugin is enabled.
      // Hardware serial is RX on 13 and TX on 15 (swapped hw serial)
        if (AdvHwSerial &&  rxPin == 13 && txPin == 15) {
            log = F("NEXTION075 : Using swap hardware serial");
            addLog(LOG_LEVEL_INFO, log);
            HwSerial = true;
            Settings.UseSerial = false;                 // Disable global Serial port.
            Settings.SerialLogLevel = 0;                // Disable logging on serial port.
            Settings.BaudRate = AdvHwBaud;              // Set BaudRate for Nextion.
            Serial.flush();
            Serial.begin(AdvHwBaud);
            Serial.swap();
        }
        // Hardware serial is RX on 3 and TX on 1. USB serial for Nextion IDE (User MCU Input function).
        else if(AdvHwSerial && rxPin == 3 && txPin == 1) {
            log = F("NEXTION075 : Using USB hardware serial");
            addLog(LOG_LEVEL_INFO, log);
            HwSerial = true;
            Settings.UseSerial = false;                 // Disable global Serial port.
            Settings.SerialLogLevel = 0;                // Disable logging on serial port.
            Settings.BaudRate = AdvHwBaud;              // Set BaudRate for Nextion.
            Serial.flush();
            Serial.begin(AdvHwBaud);
        }
        else {
            log = F("NEXTION075 : Using software serial");
            addLog(LOG_LEVEL_INFO, log);
            HwSerial = false;
            if (SoftSerial == NULL) {
                SoftSerial = new ESPeasySoftwareSerial(rxPin, txPin);
            } 
            SoftSerial->begin(9600);
            SoftSerial->flush();
        }
    }
    else {
    }
      success = true;
      break;
    }


    case PLUGIN_READ: {    // Get Plugin's optional command-text strings. Special RSSIBAR bargraph keyword is supported.
        char deviceTemplate[Nlines][Lenlines];
        int RssiIndex;
        String newString;
        String tmpString;
        String UcTmpString;

        LoadCustomTaskSettings(event->TaskIndex, (byte*)&deviceTemplate, sizeof(deviceTemplate));

        for (byte x = 0; x < Nlines; x++) {
          tmpString = deviceTemplate[x];
          if (tmpString.length()) {
            UcTmpString = deviceTemplate[x];
            UcTmpString.toUpperCase();
            RssiIndex = UcTmpString.indexOf(F("RSSIBAR"));  // RSSI bargraph Keyword found, wifi value in dBm.
            if(RssiIndex >= 0) {
              int barVal;
              newString = tmpString.substring(0, RssiIndex);
              int nbars = WiFi.RSSI();
              if (nbars < -100 || nbars >= 0)
                 barVal=0;
              else if (nbars >= -100 && nbars < -95)
                 barVal=5;
              else if (nbars >= -95 && nbars < -90)
                 barVal=10;
              else if (nbars >= -90 && nbars < -85)
                 barVal=20;
              else if (nbars >= -85 && nbars < -80)
                 barVal=30;
              else if (nbars >= -80 && nbars < -75)
                 barVal=45;
              else if (nbars >= -75 && nbars < -70)
                 barVal=60;
              else if (nbars >= -70 && nbars < -65)
                 barVal=70;
              else if (nbars >= -65 && nbars < -55)
                 barVal=80;
              else if (nbars >= -55 && nbars < -50)
                 barVal=90;
              else if (nbars >= -50)
                 barVal=100;

              newString += String(barVal,DEC);
            }
            else {
              newString = parseTemplate(tmpString, 0);
            }

            sendCommand(newString.c_str(), HwSerial);
 //         success = true;
          }
        }

        // At Interval timer, send idx & value data only if user enabled "values" interval mode.
        if(IncludeValues) {
            String log = F("NEXTION075: Interval Values enabled, resending idx=");
            log += String(UserVar[event->BaseVarIndex]);
            log += F(", value=");
            log += String(UserVar[event->BaseVarIndex+1]);
            addLog(LOG_LEVEL_INFO, log);
            success = true;
        }
        else {
            String log = F("NEXTION075: Interval Values disabled, idx & value values not resent");
            addLog(LOG_LEVEL_INFO, log);
            success = false;
        } 

        break;
    }


    case PLUGIN_WRITE: {
        String tmpString = string;
        int argIndex = tmpString.indexOf(',');
        if (argIndex) tmpString = tmpString.substring(0, argIndex);

//        String log = F("Nextion Name : ");
//        log += ExtraTaskSettings.TaskDeviceName;
//        log += F(", str: ");
//        log += string;      
//        addLog(LOG_LEVEL_INFO, log);

      if (tmpString.equalsIgnoreCase(F("NEXTION"))) {     // Use hard coded name, patch for TaskDeviceName bug.
//        if (tmpString.equalsIgnoreCase(ExtraTaskSettings.TaskDeviceName)) { // Buggy! Plugin's TaskDeviceName not working correctly.
            argIndex = string.indexOf(',');
            tmpString = string.substring(argIndex + 1);
            sendCommand(tmpString.c_str(), HwSerial);

            String log = F("NEXTION075 : WRITE, ");
            log += F("Command is ");
            log += (tmpString.c_str());
            addLog(LOG_LEVEL_INFO, log);

            success = true;                             // Set true only if plugin found a command to execute.
        }
        break;
    }


    case PLUGIN_EXIT: {
        if (SoftSerial) {
            delete SoftSerial;
            SoftSerial=NULL;
        }

        if(HwSerial) {
            HwSerial = false;
            Settings.UseSerial		= DEFAULT_USE_SERIAL;
            Settings.BaudRate		= DEFAULT_SERIAL_BAUD;
            Serial.flush();
            Serial.begin(DEFAULT_SERIAL_BAUD);          // Restart Serial Logging with default baud.
        }
        break;
    }


    case PLUGIN_ONCE_A_SECOND: {
        success = true;
        break;
    }

    
    case PLUGIN_TEN_PER_SECOND: {
      uint16_t i;
      uint8_t c;
      uint8_t charCount;
      String log;
      String Vidx;
      String Nvalue;
      String Svalue;
      String Nswitch;
      char __buffer[RXBUFFSZ+1];

      if(HwSerial) {
        charCount = Serial.available();                 // Prime the Hardware Serial engine.
      }
      else {
        if(SoftSerial == NULL) break;                   // Plugin issue, maybe it was deleted. 
        charCount = SoftSerial->available();            // Prime the Soft Serial engine.
      }

      while (charCount) {                               // This is the serial engine. It processes the serial Rx stream.
        if(HwSerial) c = Serial.read();
        else c = SoftSerial->read();

        if (c == 0x65) {
          if (charCount < 6) delay((5/(AdvHwBaud/9600))+1); // Let's wait for a few more chars to arrive.

          if (HwSerial) charCount = Serial.available();
          else charCount = SoftSerial->available();
          if (charCount >= 6) {
            __buffer[0] = c;
            for (i = 1; i < 7; i++) {
                if(HwSerial) __buffer[i] = Serial.read();
                else __buffer[i] = SoftSerial->read();
            }

            __buffer[i] = 0x00;

            if (0xFF == __buffer[4] && 0xFF == __buffer[5] && 0xFF == __buffer[6]) {
              UserVar[event->BaseVarIndex] = (__buffer[1] * 256) + __buffer[2] + TOUCH_BASE;
              UserVar[event->BaseVarIndex + 1] = __buffer[3];
              sendData(event);

              log = F("NEXTION075 : code: ");
              log += __buffer[1];
              log += ",";
              log += __buffer[2];
              log += ",";
              log += __buffer[3];
              addLog(LOG_LEVEL_INFO, log);
            }
          }
        } 
        else {
          if (c == '|') {
            __buffer[0] = c;

            if (charCount < 8) delay((9/(AdvHwBaud/9600))+1); // Let's wait for more chars to arrive.
            else delay((3/(AdvHwBaud/9600))+1);               // Short wait for tardy chars.
            if (HwSerial) charCount = Serial.available();
            else charCount = SoftSerial->available();

            if(HwSerial) {
                i = 1;            
                while (Serial.available() > 0 && i<RXBUFFSZ) {  // Copy global serial buffer to local buffer.
                  __buffer[i] = Serial.read();
                  if (__buffer[i]==0x0a || __buffer[i]==0x0d) break;
                  i++;
                }
            }
            else {
                i = 1;            
                while (SoftSerial->available() > 0 && i<RXBUFFSZ) {  // Copy global serial buffer to local buffer.
                  __buffer[i] = SoftSerial->read();
                  if (__buffer[i]==0x0a || __buffer[i]==0x0d) break;
                  i++;
                }
            }

            __buffer[i] = 0x00;
            
            String tmpString = __buffer;
            log = F("NEXTION075 : code: ");
            log += tmpString;
            addLog(LOG_LEVEL_INFO, log);

            int argIndex = tmpString.indexOf(F(",i"));
            int argEnd = tmpString.indexOf(',', argIndex + 1);
            if (argIndex) Vidx = tmpString.substring(argIndex + 2,argEnd);

            boolean GotPipeCmd = false;
            switch (__buffer[1]){
              case 'u':
                GotPipeCmd = true;
                argIndex = argEnd;
                argEnd = tmpString.indexOf(',',argIndex + 1);
                if (argIndex) Nvalue = tmpString.substring(argIndex + 2,argEnd);
                argIndex = argEnd;
                argEnd = tmpString.indexOf(0x0a);
                if (argIndex) Svalue = tmpString.substring(argIndex + 2,argEnd);
                break;
              case 's':
                GotPipeCmd = true;
                argIndex = argEnd;
                argEnd = tmpString.indexOf(0x0a);
                if (argIndex) Nvalue = tmpString.substring(argIndex + 2,argEnd);
                if (Nvalue == F("On")) Svalue='1';
                if (Nvalue == F("Off")) Svalue='0';
                break;
            }

            if (GotPipeCmd) {
                UserVar[event->BaseVarIndex] = Vidx.toFloat();
                UserVar[event->BaseVarIndex+1] = Svalue.toFloat();
                sendData(event);

                log = F("NEXTION075 : Pipe Command Sent: ");
                log += __buffer;
                log += UserVar[event->BaseVarIndex];
            }
            else {
                log = F("NEXTION075 : Unknown Pipe Command, skipped");
            }
            addLog(LOG_LEVEL_INFO, log);
          }
        }
        if(HwSerial) charCount = Serial.available();
        else charCount = SoftSerial->available();
      }

      success = true;
      break;
    }
  }
  return success;
}


void sendCommand(const char *cmd, boolean SerialMode) 
{
    if(SerialMode) {                                    // Send command using Hardware UART serial.
        Serial.print(cmd);
        Serial.write(0xff);
        Serial.write(0xff);
        Serial.write(0xff);
    }
    else {                                              // Send command using bit-bang soft serial.
        if(SoftSerial != NULL){
            SoftSerial->print(cmd);
            SoftSerial->write(0xff);
            SoftSerial->write(0xff);
            SoftSerial->write(0xff);
        }
        else {
            String log = F("NEXTION075 : SoftSerial error, aborted sendCommand");
            addLog(LOG_LEVEL_INFO, log);
        }
    }
    return;
}

#endif // USES_P075
I did a quick validation and reviewed the syslog. I don't see any issues that will invite disco dance. Hopefully nothing new is broken and the changes fix the disco problem.

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

Re: Nextion display plugin

#333 Post by BertB » 29 Jul 2018, 16:27

Seems to be okay now :)

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#334 Post by ThomasB » 29 Jul 2018, 21:07

@BertB:
Thanks for checking the fixed code. If you find any more problems then please let me know.

@everyone:
TD-er was kind enough to investigate plugin memory allocations. He found that a plugin may use up to 1024 bytes for custom configuration settings (wiki states only 512 are allowed). Since the correct number is 1024 bytes I will be restoring Nextion's "Lines" to the original 12 lines x 64 chars format.

TD-er is also making some major changes to the system core that will impact the Nextion plugin. When his released firmware is stable I will update the Nextion Plugin so it is compatible. Then I will request that we formally release the new Nextion plugin (with hardware serial) to the mega testing branch.

- Thomas

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

Re: Nextion display plugin

#335 Post by BertB » 29 Jul 2018, 23:38

Good news.
I have an idea though.
It would be nice if Nextion was able to obtain the current states of devices at boot up.

I know it is possible to use json to interrogate Domoticz, put it requires a lot of parsing to get the requested data.
Or is there a simpler way?

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#336 Post by ThomasB » 30 Jul 2018, 01:30

@BertB: The Nextion display and the plugin already have the flexibility to do things like that. Here's one example:

1. Use Nextion's page0 pre-initialize Event to send a unique idx to Domoticz (any value from 1-499). For example, let's say you assign idx 10. In page0 pre-initialize enter this:

Code: Select all

delay=30000   // Wait 30 seconds for ESPeasy to connect by WiFi
print "|s,i10,sOff"   // Nextion panel restoration command
printh 0a
2. Then create a rule in ESPeasy to forward this idx to Domoticz using HTTP or MQTT (or use the Nextion plugin's Send to Controller action).

3. Lastly, create a rule in Domoticz for idx 10. The rule would use HTTP to send commands back to the ESP/Nextion. The commands would utilize Domoticz's status to restore the various state values for your buttons, graphics, and text.

I'm not a Domoticz user (I use Openhab). So I can't offer any Domoticz code examples for this method.

- Thomas
Last edited by ThomasB on 30 Jul 2018, 16:16, edited 1 time in total.

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

Re: Nextion display plugin

#337 Post by BertB » 30 Jul 2018, 09:25

Any idea how to create your item number 3?

waspie
Normal user
Posts: 127
Joined: 09 Feb 2017, 19:35

Re: Nextion display plugin

#338 Post by waspie » 30 Jul 2018, 14:49

I'm an OH user as well (i've seen you post there thomas) and on my more critical ESP units I employ a watch dog.
To be sure MQTT is working I "ping" the units every 5 minutes with an MQTT message and the ESP answers back via MQTT to be sure its receiving and sending.
If there's no answer after two tries I turn off/on the sonoff that powers these units. When MQTT#Connect happens I send another message to OH to say the unit rebooted.

When the message is received I re-send all the relevant commands to the ESP. In case of ESPs with Nextions relevant commands are then sent to Nextions to update the display pictures to be in the correct state.

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#339 Post by ThomasB » 30 Jul 2018, 17:53

@BertB:
Let's say you have one or more Nextion variables, pictures, or timers that you want to set from a remote location. You can MQTT or HTTP them to ESPeasy and it will pass them to the connected NEXTION display via the plugin.

You can even do it from a web browser. For example, launch a browser and send something like this (change items in <> as needed):
http://<ESP IP address>/control?cmd=NEXTION,page<PAGE NUMBER>.<OBJ NAME>.<ELEMENT>=<VALUE>

For example, to set picture 0 on page 0 to a specific graphic image, the http command would look something similar to this:

Code: Select all

http://192.168.1.20/control?cmd=NEXTION,page0.p0.pic=3
http://192.168.1.21/control?cmd=NEXTION,page0.p_discolight.pic=12
Or to set a variable, it would be something like this:

Code: Select all

http://192.168.1.20/control?cmd=NEXTION,page0.va0.val=99
http://192.168.1.21/control?cmd=NEXTION,page0.va_discolight.val=0
Any Nextion attribute that is seen as green text in the Nextion editor is something you can change locally or remotely. The attributes that you will be remotely changing should have their vscope parameter set to global.

So for practice, open a browser and experiment. That should help you decided what to send from your Domoticz.

@waspie:
Glad to know you're a OH user too. Your watchdog method is a fantastic example. I use a Nextion timer event and ESPeasy's MQTT to send a status byte every few seconds. A rule in OH is triggered if the status byte goes missing for more than a minute; It triggers an Amazon Echo voice warning that tells us that there is a communication problem with the iot device.

- Thomas

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

Re: Nextion display plugin

#340 Post by BertB » 30 Jul 2018, 18:22

Thank you Thomas, but I already know that.
Per haps you do not know, but back in 2016, I started to continue on the work of majklovec and took Nextion plugin to what it was before TD-er brought it to the development area. Until that moment I posted some editions here.
Never mind. I am very happy with the efford you put in it. It is exactly what it needed and what I was not able to do, due to a lack of skills.

I also started a user guide here: https://www.letscontrolit.com/wiki/inde ... IONDisplay

I am only looking for a way to program Domoticz to update the display, but I think I know what to do next.

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#341 Post by ThomasB » 30 Jul 2018, 20:19

Sorry I can't help with Domoticz specific coding. It is vastly different than Openhab.

- Thomas

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

Re: Nextion display plugin

#342 Post by BertB » 30 Jul 2018, 20:41

No problem. Maybe you can help me with that some time later. For now, I am sorting out with blockly.

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#343 Post by ThomasB » 31 Jul 2018, 19:57

I was granted wiki edit privileges and have created the information page for the revised Nextion plugin. It's a web page that can be seen by clicking the ? symbol in the Nextion plugin. The direct link is: https://www.letscontrolit.com/wiki/index.php/Plugin75

It is mostly intended to be a technical reference for the plugin rather than a how-to. It includes a link to BertB's wiki that covers the latter.

- Thomas

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

Re: Nextion display plugin

#344 Post by BertB » 31 Jul 2018, 21:00

Beautiful

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

Re: Nextion display plugin

#345 Post by grovkillen » 31 Jul 2018, 22:08

Nice one! The plugin 75 page should be a redirect to a "Nextion" page but I can do that if you want.
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:

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#346 Post by ThomasB » 31 Jul 2018, 23:03

Thanks for the kind feedback on the wiki.

@grovkillen:
Go ahead and do whatever is needed to maintain a standardized wiki URL. If you create the redirected paged, and need me to copy the text/photos over to it, then just let me know. Or you can do it all if you prefer.

EDIT: @grovkillen, I was able to redirect the wiki to a "Nextion" page and moved all content to it.

- Thomas

CHK_BLN
Normal user
Posts: 24
Joined: 19 Nov 2015, 22:14

Re: Nextion display plugin

#347 Post by CHK_BLN » 07 Aug 2018, 22:34

Hello,
with http://192.168.2.69/control?cmd=NEXTION ... txt="Hallo "
can I write in the text field t.2, on Page0, the text Hello.
How can I realize this via MQTT?
This is my config from the ESP

Best regards
Attachments
pic1.png
pic1.png (10.32 KiB) Viewed 163498 times

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#348 Post by ThomasB » 07 Aug 2018, 23:14

@CHK_BLN: I'm using HTTP command reads so I can't offer any specific instructions for the MQTT equivalent. However, the wiki has MQTT command syntax information. It also says to install MQTT as the first controller (in Controllers tab).

- Thomas
Last edited by ThomasB on 07 Aug 2018, 23:25, edited 2 times in total.

TD-er
Core team member
Posts: 8747
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Nextion display plugin

#349 Post by TD-er » 07 Aug 2018, 23:18

It is also outdated info about MQTT controller to be set as first controller. :)
Maybe I should start reading/updating the wiki too.

You can only have one MQTT controller active though.

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#350 Post by ThomasB » 07 Aug 2018, 23:24

Maybe I should start reading/updating the wiki too.
@TD-er: Sure, you can do that in your spare time. :)

- Thomas

CHK_BLN
Normal user
Posts: 24
Joined: 19 Nov 2015, 22:14

Re: Nextion display plugin

#351 Post by CHK_BLN » 08 Aug 2018, 07:11

Hi
my first controller is an OpenHAB MQTT.
So far that's right. I can also switch a GPIO via MQTT.

What must the command for the Nextion Modul look like?

PIC.PNG
PIC.PNG (32.1 KiB) Viewed 187395 times

TD-er
Core team member
Posts: 8747
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Nextion display plugin

#352 Post by TD-er » 08 Aug 2018, 19:18

ThomasB wrote: 07 Aug 2018, 23:24
Maybe I should start reading/updating the wiki too.
@TD-er: Sure, you can do that in your spare time. :)

- Thomas
That's a great idea. :)

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

Re: Nextion display plugin

#353 Post by BertB » 09 Aug 2018, 21:09

+1

CHK_BLN
Normal user
Posts: 24
Joined: 19 Nov 2015, 22:14

Re: Nextion display plugin

#354 Post by CHK_BLN » 09 Aug 2018, 21:31

Thanks for support and help

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#355 Post by ThomasB » 11 Aug 2018, 18:35

@CHK_BLN: The Nextion plugin has few users. So I don't expect you will get the exact answer to your MQTT command question.

The Wiki information for command usage is here: https://www.letscontrolit.com/wiki/inde ... _Reference

When I follow the wiki information the MQTT command statement for your installation would probably be something like this:

Code: Select all

ESP_Easy69/cmd NEXTION,page0.t2.txt="Hello World"
Like you, my Home Automation system is OpenHab2. My installation sends commands to ESPEasy's Nextion using HTTP; I don't use MQTT to send commands to Nextion so I cannot confirm if my suggested MQTT statement works. No doubt you will need to experiment to find the winning solution.

- Thomas

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#356 Post by ThomasB » 12 Aug 2018, 02:28

@CHK_BLK:

I used the "MQTTlens" chrome browser plugin and tested sending MQTT commands to Nextion. It works as expected.

My ESPEasy Nextion device is called ESPEZ_Laundry. The text field on page 0 has attribute g1. The screenshot below shows how I setup the two fields (Publish & Message) and sent "Hello World" to the Nextion screen.

- Thomas

mqtt.jpg
mqtt.jpg (83.11 KiB) Viewed 187295 times

CHK_BLN
Normal user
Posts: 24
Joined: 19 Nov 2015, 22:14

Re: Nextion display plugin

#357 Post by CHK_BLN » 12 Aug 2018, 22:18

Hello Thomas,
as you describe it works.

Thanks for your effort

Christof

smartsoldier
New user
Posts: 6
Joined: 13 Aug 2018, 00:51

Re: Nextion display plugin

#358 Post by smartsoldier » 13 Aug 2018, 01:38

I am attempting to use ESPEasy (mega-20180809 version) which has Display - Nextion [TESTING] as a device. I'm using soft serial and GPIO-0 and GPIO-2 (D3 and D4 on my NodeMCU). I am unable to communicate with the display. I cannot send txt updates and I cannot receive presses from the screen. A wiki post a few pages ago mentioned needing a pull-up on the RX (or maybe it was TX). Anyway, I don't have that option in my device setup even though other people seem to. I was able to communicate between these devices with other non-ESPEasy software so I don't think my hardware is the issue.

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#359 Post by ThomasB » 13 Aug 2018, 02:15

@smartsoldier: GPIO-2 is the LED drive pin. Assign that pin to the WiFi Status (Hardware tab) and use another pin for Nextion.

The sensor "Pullup" check box found on earlier versions of the Nextion Plugin was a placebo. It didn't do anything, so it has been removed.

BTW, I don't recommend soft serial. There's plenty of discussion/explanation on the possible serial data corruption that may occur. The latest Plugin has introduced hardware serial to eliminate the problem.

- Thomas

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

Re: Nextion display plugin

#360 Post by BertB » 13 Aug 2018, 18:25

I use

Code: Select all

 http://xxx.xxx.xxx.xxx/control?cmd=NEXTION,page0.vLight.val=1
kind of commands to control my ESP.
For some reason it works out ok in the ESP, but I get an error in Domoticz.

I vaguely remember it used to work fine in the past.

EDIT
When I do this:

Code: Select all

http://xxx.xxx.xxx.xxx/control?cmd=GPIO,13,0
in the browser I get

Code: Select all

log	"GPIO 13 Set to 0"
plugin	1
pin	13
mode	"output"
state	0
And with domoticz I get no error

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#361 Post by ThomasB » 13 Aug 2018, 20:21

@BertB: Unlike GPIO, Nextion does not reply to HTTP writes. So you won't see a status response to your Nextion commands sent by the browser.

I suggest you retest with the browser and send commands that update some text fields (so you can verify HTTP writes to the display). If browser access is able to change text fields then the plugin is running Ok.

- Thomas

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

Re: Nextion display plugin

#362 Post by BertB » 13 Aug 2018, 21:08

ThomasB wrote: 13 Aug 2018, 20:21 @BertB: Unlike GPIO, Nextion does not reply to HTTP writes. So you won't see a status response to your Nextion commands sent by the browser.

I suggest you retest with the browser and send commands that update some text fields (so you can verify HTTP writes to the display). If browser access is able to change text fields then the plugin is running Ok.

- Thomas
I see. Well the HTTP call writes to the screen, so it is running ok.
Is it possible to build the HTTP reply in the Nextion plugin? I rely on HTTP calls to send updates to the display.

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#363 Post by ThomasB » 13 Aug 2018, 21:38

@BertB: Try this:

Find the code shown below in Nextion.ino's PLUGIN_WRITE: section:

Code: Select all

            String log = F("NEXTION075 : WRITE, ");
            log += F("Command is ");
            log += (tmpString.c_str());
            addLog(LOG_LEVEL_INFO, log);

            success = true;                             // Set true only if plugin found a command to execute.
Change it to:

Code: Select all

            String log = F("NEXTION075 : WRITE, ");
            log += F("Command is ");
            log += (tmpString.c_str());
            addLog(LOG_LEVEL_INFO, log);
            SendStatus(event->Source, log);           // Send status to http or controller.

            success = true;                             // Set true only if plugin found a command to execute.
Your browser should now reply with a copy of the sent write action.

- Thomas

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

Re: Nextion display plugin

#364 Post by BertB » 13 Aug 2018, 22:49

ThomasB wrote: 13 Aug 2018, 21:38 @BertB: Try this:

Find the code shown below in Nextion.ino's PLUGIN_WRITE: section:

Code: Select all

            String log = F("NEXTION075 : WRITE, ");
            log += F("Command is ");
            log += (tmpString.c_str());
            addLog(LOG_LEVEL_INFO, log);

            success = true;                             // Set true only if plugin found a command to execute.
Change it to:

Code: Select all

            String log = F("NEXTION075 : WRITE, ");
            log += F("Command is ");
            log += (tmpString.c_str());
            addLog(LOG_LEVEL_INFO, log);
            SendStatus(event->Source, log);           // Send status to http or controller.

            success = true;                             // Set true only if plugin found a command to execute.
Your browser should now reply with a copy of the sent write action.

- Thomas
Yep, that did it.
Thanks

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

Re: Nextion display plugin

#365 Post by BertB » 13 Aug 2018, 23:04

I managed to develop an easy way to update elements in the NEXTION, with HTTP messages send by domoticz.
It uses a small dzVents (LUA) script and the attributes of the devices in domoticz.

This can be handy if you want to sync with domoticz after a reset of Nextion.

smartsoldier
New user
Posts: 6
Joined: 13 Aug 2018, 00:51

Re: Nextion display plugin

#366 Post by smartsoldier » 14 Aug 2018, 22:47

ThomasB wrote: 13 Aug 2018, 02:15 @smartsoldier: GPIO-2 is the LED drive pin. Assign that pin to the WiFi Status (Hardware tab) and use another pin for Nextion.

The sensor "Pullup" check box found on earlier versions of the Nextion Plugin was a placebo. It didn't do anything, so it has been removed.

BTW, I don't recommend soft serial. There's plenty of discussion/explanation on the possible serial data corruption that may occur. The latest Plugin has introduced hardware serial to eliminate the problem.

- Thomas
I have taken your advice and switched up my TX/RX pins to 13 and 15 (D7/D8 on my NodeMCU) so I can use hardware serial. I disabled Serial Log File in Tools and now I can communicate just fine!! I didn't get the PNP Transistor yet, so I assume if I attempt to restart the NodeMCU ESPEasy will fail on boot. Would someone be able to link me to a place to buy this transistor? I googled and there is a million different kinds...

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

Re: Nextion display plugin

#367 Post by BertB » 14 Aug 2018, 23:15

smartsoldier wrote: 14 Aug 2018, 22:47
I have taken your advice and switched up my TX/RX pins to 13 and 15 (D7/D8 on my NodeMCU) so I can use hardware serial. I disabled Serial Log File in Tools and now I can communicate just fine!! I didn't get the PNP Transistor yet, so I assume if I attempt to restart the NodeMCU ESPEasy will fail on boot. Would someone be able to link me to a place to buy this transistor? I googled and there is a million different kinds...
Any small signal pnp transistor will do. I used a BC517 which I bought at Conrad or Farnell or any local Radio Shack type of store.

smartsoldier
New user
Posts: 6
Joined: 13 Aug 2018, 00:51

Re: Nextion display plugin

#368 Post by smartsoldier » 15 Aug 2018, 00:39

Thanks for the advice again. You rock. Mind if I keep it coming?
I am testing the communication between Home Assistant and ESPEasy/Nextion. I am using ESPEasy MQTT Import to pull in some simple sensors, but then how do I post those values to my Nextion? Do I need to do some rule that will send the imported MQTT values through http to my Nextion (http://192.168.1.XXX/control?cmd=NEXTIO ... ure#Value1%)? I tried to use the Lines in the actual Nextion Device tab, but the %BedroomTemperature#Value1% isn't pulling the actual value, its just displaying that entire string.

Edit: Side note, I setup my NTP north america pool and set my longitude and latitude but I'm still getting a system time that is 4 hours ahead of my time. Can I adjust that somehow?

Edit2: I tried this rule

Code: Select all

on BedroomTemperature#Value1 do SendToHTTP http://192.168.1.158/control?cmd=NEXTION,page0.n0.val=13 endon
but it didn't work. That is supposed to update an element on my panel to 13 every time that MQTT topic is received. I'm watching the log and it is being received exactly as I have it written.

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#369 Post by ThomasB » 15 Aug 2018, 01:16

I used a BC517 which I bought at Conrad or Farnell or any local Radio Shack type of store.
Typo? The BC517 is listed as a NPN Darlington, whereas it needs to be a PNP small signal type. The two transistors mentioned in the Nextion Wiki are popular parts found in USA electronic shops. Plus sold by an endless number of suppliers on eBay and Amazon. Typical online price is about 0.15 USD each and often sold by the Chinese vendors in a bag of 50 pcs for $1.00.
I tried to use the Lines in the actual Nextion Device tab, but the %BedroomTemperature#Value1% isn't pulling the actual value, its just displaying that entire string.
Your "Lines" command statement would look something like this:

Code: Select all

page0.n0.val=[BedroomTemperature#Value1]
Your rules statement would look something like this:

Code: Select all

NEXTION,page0.n0.val=[BedroomTemperature#Value1]
The http would be similar to this:

Code: Select all

http://192.168.1.xxx/control?cmd=NEXTION,page0.n0.val=68
I setup my NTP north america pool and set my longitude and latitude but I'm still getting a system time that is 4 hours ahead of my time. Can I adjust that somehow?
Tools->Advanced->Timezone Offset (UTC +): -240

- Thomas

TD-er
Core team member
Posts: 8747
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Nextion display plugin

#370 Post by TD-er » 15 Aug 2018, 11:58

smartsoldier wrote: 15 Aug 2018, 00:39 [...]
Edit: Side note, I setup my NTP north america pool and set my longitude and latitude but I'm still getting a system time that is 4 hours ahead of my time. Can I adjust that somehow?
[...]
Lat/Lon coordinates are only used to compute sunrise/sunset.

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

Re: Nextion display plugin

#371 Post by BertB » 15 Aug 2018, 16:04

ThomasB wrote: 15 Aug 2018, 01:16 Typo? The BC517 is listed as a NPN Darlington, whereas it needs to be a PNP small signal type. - Thomas
ooooooooops
I use a BC327

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#372 Post by ThomasB » 15 Aug 2018, 17:03

FYI, the Euro BC series transistors have a different pinout than American 2N or PN series parts. So don't follow the Nextion Wiki drawing when using the BC327.
https://www.flickr.com/photos/56014696@N08/15559869770

-Thomas

smartsoldier
New user
Posts: 6
Joined: 13 Aug 2018, 00:51

Re: Nextion display plugin

#373 Post by smartsoldier » 18 Aug 2018, 01:27

How do I get the Slider to output its value through "idx" or "value"?
I am using

Code: Select all

print "|s,i1,sOn" // Send idx 1 and value 1 to ESPEasy
printh 0a // Required print termination character
for simple on/off buttons.
I have

Code: Select all

cov h0.val,t1.txt,0
print t1.txt
setup right now, which displays the value of the slider (h0) in a text box (t1). It also prints that value as raw number (0, 5, 100) for example. How can I incorporate these two ideas?

Edit: On another note, I can't use the "Resend Values (below) at Interval:" to constantly update a clock on my main page with

Code: Select all

page0.t0.txt="%systm_hm_am%"
because it will also constantly send the latest idx/value and it makes my Home Automation system keep receiving that and it keeps activating the event (in this case toggle lighting).

Edit2: I had another idea about updating my clock. I am trying to do a simple http post at:

Code: Select all

http://192.168.1.158/control?cmd=NEXTION,page0.t0.txt="%systm_hm_am%"
but the log is giving me this:

Code: Select all

NEXTION075 : WRITE, Command is page0.t0.txt='
Why does it work fine in the "Nextion Command Statements (Optional)" section when I add it as a Line, but not when I do http?
Lol if I run the command from the Tools menu I get this:

Code: Select all

NEXTION075 : WRITE, Command is page0.t0.txt='%systm_hm_am%'

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#374 Post by ThomasB » 18 Aug 2018, 05:32

How do I get the Slider to output its value through "idx" or "value"?
You must convert the Nextion touch move event's slider val to a text string. Like this (see Nextion commands summary for details):

Code: Select all

cov h0.val,t0.txt,0
To use this conversion you would add code to the Touch Move event that is like this example:

Code: Select all

print "|s,i"
cov h0.val,t0.txt,0
print t0.txt
print ",sOff"
printh 0a
I can't use the "Resend Values (below) at Interval:" to constantly update a clock on my main page with page0.t0.txt="%systm_hm_am%" because it will also constantly send the latest idx/value and it makes my Home Automation system keep receiving that and it keeps activating the event (in this case toggle lighting).
Put the page0.t0.txt="%systm_hm_am%" command in the Lines Statement area and select an interval. Disable Resend Values.
Or make a timer rule and send it from the rule file.
Why does it work fine in the "Nextion Command Statements (Optional)" section when I add it as a Line, but not when I do http?
http writes to Nextion plugin do not support ESPEasy system variables. Use Lines or rules if you need to work with the system variables.

- Thomas

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

Re: Nextion display plugin

#375 Post by BertB » 19 Aug 2018, 16:37

@ThomasB

Is there a more natural way to find your information page about Nextion?

Would it not be nicer to get to it through the supported sensors part?
I am more than willing to move my How to (under construction) to another part of the wiki.

BertB

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#376 Post by ThomasB » 19 Aug 2018, 18:19

@BertB:
Sounds great to me. Which Wiki page needs the Nextion plugin link added to it?

- Thomas

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

Re: Nextion display plugin

#377 Post by BertB » 19 Aug 2018, 20:18

This is my page https://www.letscontrolit.com/wiki/inde ... IONDisplay

If you search for the Nextion here https://www.letscontrolit.com/wiki/index.php/Devices and click the Nextion display, you get your pages.

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#378 Post by ThomasB » 19 Aug 2018, 21:32

You asked about a more natural way to find information page about the Nextion plugin. How do other plugins do this?

BTW, there's a hot link built into the Nextion plugin. So access to Nextion's technical wiki is click-accessible from within the plugin.

- Thomas

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

Re: Nextion display plugin

#379 Post by BertB » 19 Aug 2018, 22:29

ThomasB wrote: 19 Aug 2018, 21:32 You asked about a more natural way to find information page about the Nextion plugin. How do other plugins do this?
If you go to https://www.letscontrolit.com/, then click ESP Easy and Wiki, then in the left column click ESP Easy and on the next page on 4 Supported Sensors/Actuators. and Again on Supported Sensors/Actuators, you get a whole list of supported devices.
BTW, there's a hot link built into the Nextion plugin. So access to Nextion's technical wiki is click-accessible from within the plugin.

- Thomas
Ah, nice. I did not know that. I was looking for that for quite some time.
I must say, your way is shorter :-)

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Nextion display plugin

#380 Post by ThomasB » 20 Aug 2018, 02:39

If you go to https://www.letscontrolit.com/, then click ESP Easy and Wiki, then in the left column click ESP Easy and on the next page on 4 Supported Sensors/Actuators. and Again on Supported Sensors/Actuators, you get a whole list of supported devices.
Navigating to the Nextion information isn't convenient, but it is functional. The criticism isn't unique to Nextion since all the plugins' wiki pages are found in the same way. Someone (not me) would need champion the creation of something better.

- Thomas

Post Reply

Who is online

Users browsing this forum: No registered users and 64 guests