Difference between revisions of "NEXTIONDisplay"

From Let's Control It
Jump to: navigation, search
(Introduction)
(The script)
 
(73 intermediate revisions by 2 users not shown)
Line 6: Line 6:
 
The OLED page is being used as a donor.
 
The OLED page is being used as a donor.
  
 +
[[File:Beware.jpg]]
  
 +
This is not an ordinary display. You cannot simply write data to it. You will first have to create an appropriate interface.<br/>
 +
This is a very easy process when using the free Itead IDE (just search for Nextion on the web).<br/>
 +
It has some good tutorials and once you have created your own display, it is very easy to present data and control devices with it.
  
The ESP8266 module can be used to control an Serial Nextion Display.
+
The ESP8266 module can be used to control a serial Nextion display.
 
Due to its on-board intelligence and the presence of a touch panel, the display can be used to control devices.
 
Due to its on-board intelligence and the presence of a touch panel, the display can be used to control devices.
  
Line 14: Line 18:
  
 
= Hardware =
 
= Hardware =
The board is connected to a controller by means of 4 wires
+
The board is connected to a controller by means of 4 wires.
  
 
[[File:Nextion2.jpg]]
 
[[File:Nextion2.jpg]]
  
Connect the Nextion Display to a serial port and to +5 V and ground.
+
Connect the Nextion display to a serial port and to +5 V and ground.
The Nextion software module provides the use of a Software Serial port. So, it is not required to use the 'native'Tx and Rx ports of the controller.
+
The Nextion software module provides the use of a software serial port. So, it is not required to use the 'native'Tx and Rx ports of the controller.
This display works with 5V and can be connected directly to the ESP module.
+
This display works with 5V and can be connected directly to the ESP module. The Tx pin of the Nextion is regulated to 3.3v making it safe to directly connect.  
  
 
== Connections ==
 
== Connections ==
Line 31: Line 35:
 
   Rx GPIO port acting as Tx
 
   Rx GPIO port acting as Tx
  
In order to get those displays to work properly you need to activate the pull-up of the Tx pin. A quick test is to set the pin to high (1) but for long turn you should enable the pull-up instead. If the pin is missing a pull-up you can add one yourself by soldering a 10k resistor from 3.3V to the pin.
+
In order to get these displays to work properly you need to activate the pull-up of the Tx pin. A quick test is to set the pin to high (1) but for long turn you should enable the pull-up instead. If the pin is missing a pull-up you can add one yourself by soldering a 10k resistor from 3.3V to the pin.
 +
 
 +
 
 +
[[File:Nextion-WeMos.jpg]]
 +
 
 +
= Screen preparations =
 +
 
 +
Although this is not the place to go into too much detail of the Nextion Editor, the examples help to explain the possibilities of the plugin. Please bear in mind, that this is the result of my experiments, no more, no less.<br/>
 +
 
 +
<br/>
 +
 
 +
Let's assume you would like to have a control panel with several pages. Below is an example with 5 pages and some test pages. A front page, an info page and some switching pages.
 +
To make browsing between pages run smoothly without having to wait for databoxes to be filled, variables can be used.
 +
Several of them are declared and made global on the front page. The variables get their info from the ESPEasy in integer or text format.
 +
One timer, tm0, makes sure the control panel dims its backlight and go back to its start screen.
 +
Timer tm1 provides an update of the values once every 5000 msec.
 +
 
 +
Hereunder a step by step explanation.
 +
<br/>
 +
<br/>
 +
 
 +
[[File:Front-pre.PNG]]<br/>
 +
 
 +
During pre initialisation, timer tm0 is set to 0 msec and disabled. The backlight is set to faint with dim=10. This is the standby mode<br/>
 +
 
 +
<br/>
 +
<br/>
 +
 
 +
 
 +
[[File:Tim0.PNG]] <br/>
 +
 
 +
When timer tm0 fires, the backlight is set to very faint, the panel goes to page 0 (front page) and the timer is disabled. Again, this is the standby mode with an even lower brightness, to indicate the difference with start up.<br/>
 +
<br/>
 +
<br/>
 +
 
 +
[[File:Front-post.PNG]]<br/>
 +
 
 +
During the post initialisation of the page, after all boxes etc are made available, some data is written to various info boxes.<br/>
 +
-clock time panel t0 gets the "actual" time from variable vTime.<br/>
 +
-with command cov, the string containing solar energie value in vSold is converted to an int value in va0. <br/>
 +
-solar indicator panel j1 gets the relative solar power value from variable va0.<br/>
 +
-wifi indicator panel j0 gets the relative rssi power value from variable vRS.<br/>
 +
<br/>
 +
<br/>
 +
 
 +
[[File:Tim1.PNG]]<br/>
 +
 
 +
Timer tm1 is programmed to provide periodic update (once every 5000 msec. when tm1 fires, data is written to various info boxes.<br/>
 +
-clock time panel t0 gets the "actual" time from variable vTime.<br/>
 +
-with command cov, the string containing solar energie value in vSold is converted to an int value in va0. <br/>
 +
-solar indicator panel j1 gets the relative solar power value from variable va0.<br/>
 +
-wifi indicator panel j0 gets the relative rssi power value from variable vRS.<br/>
 +
<br/>
 +
<br/>
 +
 
 +
[[File:Front-release.PNG]]<br/>
 +
 
 +
Normally, the Nextion is in a standby mode. This means that a the Front page is active and the backlight is dimmed. ESPEasy sends updates to the Nextion, with stores them in the appropriate variables and boxes.<br/>
 +
After the Nextion gets a tough release trigger, some actions are carried out:<br/>
 +
-the backlight is set to 80% of the maximum brightness.<br/>
 +
-if timer tm0 is already enabled, page 1 is selected the tm0 of that pages is charged. <br/>
 +
this allows for a jump from the Front page, when it is touched for the second time within 10 seconds.
 +
-if this is the first time Front page is touched, its own timer tm0 is charged and enabled.
 +
<br/>
 +
<br/>
 +
 
 +
 
 +
 
 +
[[File:P1-pre.PNG]]<br/>
 +
<br/>
 +
<br/>
 +
 
 +
[[File:P1-post.PNG]]<br/>
 +
<br/>
 +
<br/>
 +
 
 +
[[File:Switchesl.PNG]]<br/>
 +
<br/>
 +
<br/>
 +
 
 +
[[File:Values.PNG]]<br/>
 +
<br/>
 +
<br/>
  
 
= ESP Easy =
 
= ESP Easy =
Use the device tab on the ESP Easy webinterface and create a new task by editing one of the available tasks. Select "Display - OLED 1306" from the dropdown box.
+
Use the device tab on the ESP Easy webinterface and create a new task by editing one of the available tasks. Select "Display - Nextion" from the dropdown box.
  
Enter template texts into lines 1 to 8. Plain text will be shown on the display exactly as entered.
+
Now you first need to prepare your display. It needs to contain textboxes, numerical boxes etc.
If you want to show a value, enclose <task name> and <value name> between brackets, separated by a hashtag.
+
In the example below, I created variables vHO, vSold and vSolt. Data retrieved from a MQTT tasks can be written to it with:
  
So if you have a dallas sensor running, with taskname "Dallas", to get the temperature value, use this:
+
''page0.vHO.txt=[MQTT1#RFLWsTH_h]''
  
  [Dallas#Temperature]
+
where page0.vHO.txt describes the variable in the Nextion display, that I created beforehand.
  
With release 057, some features were added. If you put %sysname% or %ip% or %systime% on a line in the table, the display will show either the name you gave the ESP module, its IP address or its time. The latter only when NTP is being deployed.
+
Check this sample on how to get it done:
  
 +
[[File:NextionSettings.PNG]]
  
Check this sample on how to get it done:
+
In the second example
 +
 +
[[File:NextionSettings2.PNG]]
 +
 
 +
The idx and value fields are used to communicate button presses etc.
  
[[File:EasyConfigOLED.png]]
+
This info can be handled in the Rules:
  
 +
[[File:NextionRules.PNG]]
  
(The IDX field will be stuffed with '1', because it's needs a value. But nothing will be send with this device)
+
(The upper (MQTT) IDX field will be stuffed with '1', because it's needs a value. But nothing will be send with this device the second one is to write to a debug text box in Domoticz, but could also be 1)
  
 
= Commands =
 
= Commands =
Line 62: Line 154:
 
|-
 
|-
  
| OLED,<row>,<col>,<text>
+
| Nextion,
 
| -
 
| -
 
| Write text messages to OLED screen, ROW for row, COL for starting column, and Text for text.
 
| Write text messages to OLED screen, ROW for row, COL for starting column, and Text for text.
 
|-
 
|-
  
| OLEDCMD,<value>
+
| Nextion,<value>
| on, off, clear
+
|  
 
| Switch on or off the OLED or to clear the display. During the off state, the content will be updated according to the latest values or states.
 
| Switch on or off the OLED or to clear the display. During the off state, the content will be updated according to the latest values or states.
 
|-
 
|-
Line 74: Line 166:
  
 
= Special characters =
 
= Special characters =
 +
{|
 +
|}
 +
 +
= Mass update [Domoticz, HTTP] =
 +
== Introduction ==
 +
This HowTo is intended for users who use Domoticz as their domotics platform and wish to synchronize the device settings in Domoticz with those in the Nextion display. This is especially convenient when the ESP/Nextion needs to obtain device settings from domoticz after reset.<br/>
 +
<br/>
 +
Syncing can be initiated in the Rules section of the ESPEasy that interfaces to the display, for examply during boot up or with the flip of a switch. <br/>
 +
 +
== Requirements ==
 +
To make this work, we need to have:<br/>
 +
- A Domoticz platform<br/>
 +
- An ESPEasy with the latest firmware and Nextion display connected to it<br/>
 +
- The devices to be updated in Nextion, must exist in Domoticz<br/>
 +
- Some preparations to the attributes of devices in Domoticz<br/>
 +
- A switch in Domoticz that directly triggers the update proces<br/>
 +
- The update script written in dzVents<br/>
 +
- Some basic understanding of the device attributes in Domoticz<br/>
 +
<br/>
 +
This will all be explained in the following parts.
 +
 +
== HowTo in steps ==
 +
Common knowledge on how to use ESPEasy with Nextion in conjunction with Domoticz is assumed to be available.
 +
If not, let us know and we will try to help.<br/>
 +
 +
=== dzVents and attributes ===
 +
The script that actually updates the Nextion, is written in dzVents, the next generation LUA scripting.<br/>
 +
It now is an integrated part of Domoticz and it can be deployed with the build in editor.
 +
A manual can be found here:
 +
<url> https://www.domoticz.com/wiki/DzVents:_next_generation_LUA_scripting <url/>
 +
<br/>
 +
More details on Domoticz devices and attributes are here:
 +
<url>https://www.domoticz.com/wiki/DzVents:_next_generation_LUA_scripting#Device_attributes_and_methods_for_all_devices<url/>
 +
<br/>
 +
To get started, you first have to make sure dzVents is enabled at the bottom of page Main/Setup/Settings/Others in Domoticz.
 +
<br/><br/>
 +
[[File:Setup_Other1.png]]
 +
<br/>
 +
The setting is at the bottom of the page.
 +
 +
=== Domoticz preparations ===
 +
Let us assume, for the sake of the example, that we have a Domoticz with:<br/>
 +
- One wind sensor, named RFLWsWind and <br/>
 +
- Four switches, named RFLPontpump, RFLPontlight, RFLYardlight and RFLDoorlight<br/>
 +
<br/>
 +
These devices have corresponding counterparts in the Nextion display and they relate as follows (note: the windsensor has three counterparts in Nextion):<br/>
  
 
{| class="wikitable sortable"
 
{| class="wikitable sortable"
 
|-
 
|-
! Name
+
! Domoticz device
! Character
+
! Device attribute
! Code (generic)
+
! Nextion device
! Code (html)
+
! Nextion type
! Code (verbose)
+
! data type
! Extra information
+
! description
 +
|-
 +
 
 +
| RFLWsWind
 +
| direction
 +
| page7.t0
 +
| textbox
 +
| txt
 +
| direction|page7.t0.txt=
 +
|-
 +
 
 +
| RFLWsWind
 +
| direction
 +
| page4.z0
 +
| gauche
 +
| val
 +
| direction|page4.z0.val=
 
|-
 
|-
  
| Degree
+
| RFLWsWind
| ˚
+
| speed
| {D}
+
| page7.t1
| &amp;deg;
+
| textbox
| degreeC<br>degree_C
+
| txt
| "degreeC" and "degree_C" will give you ˚C
+
| speed|page7.t1.txt=
 
|-
 
|-
  
| Angle quotes (L/R)
+
| RFLPontPump
| «<br>»
+
| nValue
| {<<}<br>{>>}
+
| page0.vFont
| &amp;laquo;<br>&amp;raquo;
+
| integer variable
| -
+
| val
| -
+
| nValue|page0.vFont.val=
 
|-
 
|-
  
| Greek mu
+
| RFLPontLight
| µ
+
| nValue
| {u}
+
| page0.vLight
| &amp;micro;
+
| integer variable
| -
+
| val
| -
+
| nValue|page0.vLight.val=
 
|-
 
|-
  
| Currency
+
| RFLYardLight
| €<br>¥<br>£<br>¢
+
| nValue
| {E}<br>{Y}<br>{P}<br>{c}
+
| page0.vErf
| &amp;euro;<br>&amp;yen;<br>&amp;pound;<br>&amp;cent;
+
| integer variable
| -
+
| val
| -
+
| nValue|page0.vErf.val=
 
|-
 
|-
  
| Math symbols
+
| RFLDoorLight
| <span style="color: #A3BABF">x</span>¹<br><span style="color: #A3BABF">x</span>²<br><span style="color: #A3BABF">x</span>³<br>¼<br>½<br>¾<br>±<br>×<br>÷
+
| nValue
| {^1}<br>{^2}<br>{^3}<br>{1_4}<br>{1_2}<br>{3_4}<br>{+-}<br>{x}<br>{..}
+
| page0.vAcht
| &amp;sup1;<br>&amp;sup2;<br>&amp;sup3;<br>&amp;frac14;<br>&amp;frac12;<br>&amp;frac34;<br>&amp;plusmn;<br>&amp;times;<br>&amp;divide;
+
| integer variable
| -
+
| val
| -
+
| nValue|page0.vAcht.val=
 
|-
 
|-
 +
 
|}
 
|}
 +
 +
<br/>
 +
Also the required Domoticz device attributes are listed, as well as the Nextion data types (Number or String) and the command part of the URL to be send to the EASPEasy.
 +
<br/>
 +
 +
==== create a trigger button ====
 +
To initiate the sync script, a dummy switch has the be created in the setup/hardware section of Domoticz. In this example I named it E16Conf. Upon clicking Edit of E16Conf in the Switches section of Domoticz, the setup of the switch pops up. Here the type of swtich can be modified, but most important is the text in the description box. Here are the names of a user variable that holds the IP address of the ESPEasy with Nextion and that of the uservariable that holds the names of the devices to be synchronised.
 +
The two are separated by the pipe "|" symbol. It is very important to use the exact names of the variables, in this specific order.
 +
 +
<br/>
 +
[[File:E16Button.PNG]]
 +
<br/><br/>The E16Conf button in the switches section.<br/><br/>
 +
[[File:E16Desc.PNG]]
 +
<br/><br/>The E16Conf setup with the description text box.
 +
 +
==== create your variables ====
 +
In Setup/More Options in Domoticz, are two more relevant options: User Variables and Events. In Events, the synchronisation script can be found, but that is for later.
 +
<br/>
 +
[[File:Setup_More1.png]]
 +
<br/><br/>
 +
To allow the script to synchronise the devices in Nextion, it needs to know where to find the device (the IP address) and what devices are relevant. The IP address is stored in a variable named E16NextionIP. The names of the devices, separated by the | in E16NextionDev.
 +
<br/><br/>
 +
[[File:Vars1.png]]
 +
<br/>
 +
The user variables with IP address and the devices of interest
 +
<br/><br/>
 +
==== Device preparations ====
 +
<br/>Last but not least, the device attributes, and the appropriate Nextion command, has to be revealed to the script. The easiest way to use is the description attribute, each device has. We use it to express the attibute and the command, separated by a | symbol. More than one combination can be noted, but always in that specific order and speparated by the | symnbol.
 +
<br/><br/>
 +
[[File:WindDesc.PNG]]
 +
<br/>The windsensor with three attibutes.<br/><br/>
 +
 +
 +
 +
=== The script ===
 +
[[File:Script1.pdf]]
 +
 +
=== Script ===

Latest revision as of 11:40, 29 August 2018

Introduction

WIP.gif

This page is under contruction.
The OLED page is being used as a donor.

Beware.jpg

This is not an ordinary display. You cannot simply write data to it. You will first have to create an appropriate interface.
This is a very easy process when using the free Itead IDE (just search for Nextion on the web).
It has some good tutorials and once you have created your own display, it is very easy to present data and control devices with it.

The ESP8266 module can be used to control a serial Nextion display. Due to its on-board intelligence and the presence of a touch panel, the display can be used to control devices.

Nextion2.jpg

Hardware

The board is connected to a controller by means of 4 wires.

Nextion2.jpg

Connect the Nextion display to a serial port and to +5 V and ground. The Nextion software module provides the use of a software serial port. So, it is not required to use the 'native'Tx and Rx ports of the controller. This display works with 5V and can be connected directly to the ESP module. The Tx pin of the Nextion is regulated to 3.3v making it safe to directly connect.

Connections

 LCD 	 	ESP
 GND 	 	GND
 VCC    	VCC
 Tx		GPIO port acting as Rx
 Rx		GPIO port acting as Tx

In order to get these displays to work properly you need to activate the pull-up of the Tx pin. A quick test is to set the pin to high (1) but for long turn you should enable the pull-up instead. If the pin is missing a pull-up you can add one yourself by soldering a 10k resistor from 3.3V to the pin.


Nextion-WeMos.jpg

Screen preparations

Although this is not the place to go into too much detail of the Nextion Editor, the examples help to explain the possibilities of the plugin. Please bear in mind, that this is the result of my experiments, no more, no less.


Let's assume you would like to have a control panel with several pages. Below is an example with 5 pages and some test pages. A front page, an info page and some switching pages. To make browsing between pages run smoothly without having to wait for databoxes to be filled, variables can be used. Several of them are declared and made global on the front page. The variables get their info from the ESPEasy in integer or text format. One timer, tm0, makes sure the control panel dims its backlight and go back to its start screen. Timer tm1 provides an update of the values once every 5000 msec.

Hereunder a step by step explanation.

Front-pre.PNG

During pre initialisation, timer tm0 is set to 0 msec and disabled. The backlight is set to faint with dim=10. This is the standby mode




Tim0.PNG

When timer tm0 fires, the backlight is set to very faint, the panel goes to page 0 (front page) and the timer is disabled. Again, this is the standby mode with an even lower brightness, to indicate the difference with start up.


Front-post.PNG

During the post initialisation of the page, after all boxes etc are made available, some data is written to various info boxes.
-clock time panel t0 gets the "actual" time from variable vTime.
-with command cov, the string containing solar energie value in vSold is converted to an int value in va0.
-solar indicator panel j1 gets the relative solar power value from variable va0.
-wifi indicator panel j0 gets the relative rssi power value from variable vRS.


Tim1.PNG

Timer tm1 is programmed to provide periodic update (once every 5000 msec. when tm1 fires, data is written to various info boxes.
-clock time panel t0 gets the "actual" time from variable vTime.
-with command cov, the string containing solar energie value in vSold is converted to an int value in va0.
-solar indicator panel j1 gets the relative solar power value from variable va0.
-wifi indicator panel j0 gets the relative rssi power value from variable vRS.


Front-release.PNG

Normally, the Nextion is in a standby mode. This means that a the Front page is active and the backlight is dimmed. ESPEasy sends updates to the Nextion, with stores them in the appropriate variables and boxes.
After the Nextion gets a tough release trigger, some actions are carried out:
-the backlight is set to 80% of the maximum brightness.
-if timer tm0 is already enabled, page 1 is selected the tm0 of that pages is charged.

this allows for a jump from the Front page, when it is touched for the second time within 10 seconds.

-if this is the first time Front page is touched, its own timer tm0 is charged and enabled.


P1-pre.PNG


P1-post.PNG


Switchesl.PNG


Values.PNG


ESP Easy

Use the device tab on the ESP Easy webinterface and create a new task by editing one of the available tasks. Select "Display - Nextion" from the dropdown box.

Now you first need to prepare your display. It needs to contain textboxes, numerical boxes etc. In the example below, I created variables vHO, vSold and vSolt. Data retrieved from a MQTT tasks can be written to it with:

page0.vHO.txt=[MQTT1#RFLWsTH_h]

where page0.vHO.txt describes the variable in the Nextion display, that I created beforehand.

Check this sample on how to get it done:

NextionSettings.PNG

In the second example

NextionSettings2.PNG

The idx and value fields are used to communicate button presses etc.

This info can be handled in the Rules:

NextionRules.PNG

(The upper (MQTT) IDX field will be stuffed with '1', because it's needs a value. But nothing will be send with this device the second one is to write to a debug text box in Domoticz, but could also be 1)

Commands

Command Value Extra information
Nextion, - Write text messages to OLED screen, ROW for row, COL for starting column, and Text for text.
Nextion,<value> Switch on or off the OLED or to clear the display. During the off state, the content will be updated according to the latest values or states.

Special characters

Mass update [Domoticz, HTTP]

Introduction

This HowTo is intended for users who use Domoticz as their domotics platform and wish to synchronize the device settings in Domoticz with those in the Nextion display. This is especially convenient when the ESP/Nextion needs to obtain device settings from domoticz after reset.

Syncing can be initiated in the Rules section of the ESPEasy that interfaces to the display, for examply during boot up or with the flip of a switch.

Requirements

To make this work, we need to have:
- A Domoticz platform
- An ESPEasy with the latest firmware and Nextion display connected to it
- The devices to be updated in Nextion, must exist in Domoticz
- Some preparations to the attributes of devices in Domoticz
- A switch in Domoticz that directly triggers the update proces
- The update script written in dzVents
- Some basic understanding of the device attributes in Domoticz

This will all be explained in the following parts.

HowTo in steps

Common knowledge on how to use ESPEasy with Nextion in conjunction with Domoticz is assumed to be available. If not, let us know and we will try to help.

dzVents and attributes

The script that actually updates the Nextion, is written in dzVents, the next generation LUA scripting.
It now is an integrated part of Domoticz and it can be deployed with the build in editor. A manual can be found here: <url> https://www.domoticz.com/wiki/DzVents:_next_generation_LUA_scripting <url/>
More details on Domoticz devices and attributes are here: <url>https://www.domoticz.com/wiki/DzVents:_next_generation_LUA_scripting#Device_attributes_and_methods_for_all_devices<url/>
To get started, you first have to make sure dzVents is enabled at the bottom of page Main/Setup/Settings/Others in Domoticz.

Setup Other1.png
The setting is at the bottom of the page.

Domoticz preparations

Let us assume, for the sake of the example, that we have a Domoticz with:
- One wind sensor, named RFLWsWind and
- Four switches, named RFLPontpump, RFLPontlight, RFLYardlight and RFLDoorlight

These devices have corresponding counterparts in the Nextion display and they relate as follows (note: the windsensor has three counterparts in Nextion):

Domoticz device Device attribute Nextion device Nextion type data type description
RFLWsWind direction page7.t0 textbox txt page7.t0.txt=
RFLWsWind direction page4.z0 gauche val page4.z0.val=
RFLWsWind speed page7.t1 textbox txt page7.t1.txt=
RFLPontPump nValue page0.vFont integer variable val page0.vFont.val=
RFLPontLight nValue page0.vLight integer variable val page0.vLight.val=
RFLYardLight nValue page0.vErf integer variable val page0.vErf.val=
RFLDoorLight nValue page0.vAcht integer variable val page0.vAcht.val=


Also the required Domoticz device attributes are listed, as well as the Nextion data types (Number or String) and the command part of the URL to be send to the EASPEasy.

create a trigger button

To initiate the sync script, a dummy switch has the be created in the setup/hardware section of Domoticz. In this example I named it E16Conf. Upon clicking Edit of E16Conf in the Switches section of Domoticz, the setup of the switch pops up. Here the type of swtich can be modified, but most important is the text in the description box. Here are the names of a user variable that holds the IP address of the ESPEasy with Nextion and that of the uservariable that holds the names of the devices to be synchronised. The two are separated by the pipe "|" symbol. It is very important to use the exact names of the variables, in this specific order.


E16Button.PNG

The E16Conf button in the switches section.

E16Desc.PNG

The E16Conf setup with the description text box.

create your variables

In Setup/More Options in Domoticz, are two more relevant options: User Variables and Events. In Events, the synchronisation script can be found, but that is for later.
Setup More1.png

To allow the script to synchronise the devices in Nextion, it needs to know where to find the device (the IP address) and what devices are relevant. The IP address is stored in a variable named E16NextionIP. The names of the devices, separated by the | in E16NextionDev.

Vars1.png
The user variables with IP address and the devices of interest

Device preparations


Last but not least, the device attributes, and the appropriate Nextion command, has to be revealed to the script. The easiest way to use is the description attribute, each device has. We use it to express the attibute and the command, separated by a | symbol. More than one combination can be noted, but always in that specific order and speparated by the | symnbol.

WindDesc.PNG
The windsensor with three attibutes.


The script

File:Script1.pdf

Script