Nextion display plugin

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
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 ...?

r_255
Normal user
Posts: 32
Joined: 20 Nov 2015, 20:42

Re: Nextion display plugin

#141 Post by r_255 » 29 Oct 2017, 09:56

I am having issues to get sliders running, some how the data looses its first chars.

print "publish .........
and gives result in the debug screen sh......

So somehow it looses publi

Tried alsmost anything i could think of but did not find any answers. Rules just wont do for my setup as there are to many buttons and things going on that 4 pages arent enough for me.

https://github.com/maragelis/NextionMqtt
This firmware does reveals that the nextion sends out more data on the serial than we receive.
Like wakeup on sleep

0x87
0xff
0xff
0xff

Sleep

0x86
0xff
0xff
0xff


thup=1 {To set sleep on for your nextion project ( 0/1))
thsp=xx (Set sleep after xx secs)


I prefer node red and mqtt route, as you could change the status of a button based on incoming msg.
So when the lights are set on thru a rocker, the status on the nextion screen will be updated.

I would prefer to use the espeasy route, but some how i cant get it working further than buttons and updating fields.

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

Re: Nextion display plugin

#142 Post by BertB » 01 Nov 2017, 13:17

dragowasabi wrote: 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 ...?
Very well posible. I never tested it and I do not know the difference between the two.
On the other hand, the code shows some strange serial port handling. I am not sure what baudrate is used to communicate with the display, but the plugin uses 9600 baud.

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

Re: Nextion display plugin

#143 Post by BertB » 01 Nov 2017, 13:45

r_255 wrote: 29 Oct 2017, 09:56 I am having issues to get sliders running, some how the data looses its first chars.

....

I prefer node red and mqtt route, as you could change the status of a button based on incoming msg.
So when the lights are set on thru a rocker, the status on the nextion screen will be updated.

I would prefer to use the espeasy route, but some how i cant get it working further than buttons and updating fields.
Please keep in mind this plugin is highly experimental. I did ask for someone with more programming skills to make it nice.
Without using the Nextion drivers, it is not easy to interprete the data coming from the display.

I created a kind of workaroud for sliders. It is a mixture of programming the display and the use of Rules.
I'll see if I can find it.

Regarding MQTT, I have a lot of problems getting it to work reliably.

r_255
Normal user
Posts: 32
Joined: 20 Nov 2015, 20:42

Re: Nextion display plugin

#144 Post by r_255 » 01 Nov 2017, 19:20

Hi Bert,

Its much appreciated, all the efforts you put into the plugin.
I got the dimmer running thru the mentioned plugin, but Espeasy gives me more flexebility in other devices.

Your programming, is much better than mine... with a lot of effort i can read some.

I also did see on Jeffs website that there is some one that has things running up and down, not sure as time is a issue at the moment here.
Thanks!

Robin

BIG PS:

The example on jeff's website is domoticz related and works with bash scripts.

The whole reason that i don't want to use rules is because there are not rules enough for what i want ( 4 pages is not enough )
What i want to try is that my toggle buttons get their status get updated thru mqtt. So the intention is to make a button visible based on the on or off status and later on also push dimmer values to a slider.

" { "topic":sendCommand, "payload":{ "command":"click b9,1" } }" Works in the mqtt firmware i mentioned so technical it would be possible to send commands to your nextion screen
and get buttons updated based on a device status.

I am not sure how the decoding in your plugin works, but it could be that some data from the nextion comes thru as it sends more data than only a key press. ( strange data that occurs now and then ) The other firmware works on softserial to, and does not receive any weird chars.

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

Re: Nextion display plugin

#145 Post by dokho » 06 Nov 2017, 18:55

BertB wrote: 22 Jan 2017, 15:34 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
Hi !

This will increase or decrease value of 1, is it possible to make it change (+ or -) of 0,5 ?


Regards,

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

Re: Nextion display plugin

#146 Post by BertB » 06 Nov 2017, 19:49

dokho wrote: 06 Nov 2017, 18:55
BertB wrote: 22 Jan 2017, 15:34 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
Hi !

This will increase or decrease value of 1, is it possible to make it change (+ or -) of 0,5 ?


Regards,
The variable in Nextion is either a string or an integer. You could try to work it out, by adding or subtracting 5 and dividing the value by 10 in domoticz.

HoekNL
New user
Posts: 2
Joined: 19 Nov 2017, 11:12
Location: Almere,Netherlands

Re: Nextion display plugin

#147 Post by HoekNL » 04 Jan 2018, 12:40

First post here so want to thank all contributors, very good thread and just the plugin i needed.
ESP12E bare connected to Nextion 4" and MQTT to Node-red.

Had a hard time compiling ESPEasy v2.0.something but in the end did manage with the v2.0 with plugin included.
Also took some time to understand the espeasy setup, needed to get MQTT publish triggered etc. %systemdate% etc not yet available in this version either so now filling this data via formatted MQTT input from node-red.

All communications sorted now, there is just one thing not clear to me, are actually 2 things.
First, in the ESPEasy => Device tab, the section with the 4 Values, i just don't get what "code" stands for and where the reported codes/values come from.

I've created some of @BertB 's code in the Nextion button. When using:

Code: Select all

if(va0.val=0)
{
print "|s,i13,n,s" 
} else
{
print "|s,i33,n,s" 
}
print page0.vattempset.txt
printh 0xa
i get a constant code value of 105.00 but when i use |u instead of |s the code changes all the time and part of the send string "|u,i33,n,s18" is missing.
I suppose "|s |u" is some lua talk? at some point lua and other text came as data, but happened only once.

The other Values are also filled when i send a button press with this code to ESP, but can't figure out where the come from.
And the Rules engine does not pick up on this. I've changed the nextion code to:

Code: Select all

print "|s,idx=33,value=" 
print page0.vattempset.txt
printh 0xa
giving me this msg in the log:

Image

but the rule does not work.. ? ( neither does : on Nextion#code=105 .. or Nextion#code=105.00 )

Image

[update] Ok sorry, got it, about the 4 value fields anyway, it's the serial read buffers. Code is assuming the deviceid is being sent with the 0xFF's ending.
Had to rack my brain for some 1970's info stored away very deep about serial comms.. :P
I get that the plugin is a bit of a quick and dirty solution but it works so love that, and the print string is an ever quicker and dirtier solution then, but don't see how BertB's rules would work if no device id is being sent. Will give it some more thoughs and tries, maybe try Pete Scargils way of using "get attr" on the Nextion.

[update2] Solved my problem by only using button/deviceid then rule on Nextion#code to send '1' or '-1' ,depending on button, via mqtt to node-red and have node-red return the desired temp. update is fast enough for ux ease-of-use.
leaves me with the sleep/wake-up data refresh issue as all data on nextion comes from node-red in 1 min intervals. the nextion page touch event is not sent when screen is being woken up. so cant tell esp that sceen is tapped to wakeup and needs refreshing data....


setup...


Image

Ernst200
New user
Posts: 2
Joined: 04 May 2017, 09:10

Re: Nextion display plugin

#148 Post by Ernst200 » 25 Jan 2018, 09:47

@BertB
First of all: Great Plugin ! :D

I am just beginning with the plugin for the Nextion display. I flased a nodeMCU V 1.0 and I have communication with the display.
I can send Data to the display through a url (http://192.168.178.55/control?cmd=NEXTI ... txt="Hallo" ).

Question:
Do you have more documentation for the Nextion programming
print "|u,i230,n,s" The parameters where do they stand for?
The "1230 thats the Idx value that's simple but the rest?"

Alvast bedankt!

Mvg Ernst

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

Re: Nextion display plugin

#149 Post by BertB » 27 Jan 2018, 12:08

Hi Ernst,

First of all, the code is not ready, it needs a some more attention, but I do not have much time to do it.
Initially the code simply received the data to the outputs, like this:
output 1 = pagenumber * 256 + itemnumber.
Page = 1 (it starts with 0) and button id is 9, you get 256+9=265

output 2 = button state, 0 is off, 1 is on.
With rules and events you can then make things happen:
Set the time out timer to 20 seconds and background intensity to 80%
on E16Nextion#code do
Nextion,tm0.tim=20000
Nextion,dim=80
endon

You only need to tick the Send Component ID box for that.

If you want more detail, like toggling a light switch via domoticz:
put this code in the Touch Release Event code box of the switch:

page0.vBT0.val=bt0.val /this is to update a variable
if(page0.vBT0.val==1)
{ / if on then send on
print "|s,i7,sOn" /This and (|s is switch identifier, i7 is a chosen id for a button)
printh 0a / this is sent to the ESP code
}else
{ / else send off
print "|s,i7,sOff"
printh 0x0a
}

The ESP code now shows 7 and the value is 1 or 0
In this case idx 7 must be a real switch. Nextion id and idx are not related.

The rules need the folowing code:
on E16Nextion#code=7 do
if [E16Nextion#value]=1
SendToHTTP <ip of domoticz,8080>,/json.htm?type=command&param=switchlight&idx=7&switchcmd=On
else
SendToHTTP <ip of domoticz,8080>,/json.htm?type=command&param=switchlight&idx=7&switchcmd=Off
endif
endon

sending the value of a counter after an update, you need to program the display:
va0.val-- /when the down button is touched, the variable decreases
if(va0.val<0) / not less than 0
{
va0.val=0
}
cov va0.val,t3.txt,0 convert a string to integer
print "|u,i230,n,s" |u is identifier for update of a variable, i230 is a choosen id
print t3.txt also print the value of the variable
printh 0a end of string


In the rules you can use:
on E16Nextion#code=230 do
sendtohttp ,domoticz ip,8080>,/json.htm?param=udevice&type=command&idx=79&nvalue=0&svalue=[Nextion#value]
endon

Hope this helps

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

Re: Nextion display plugin

#150 Post by BertB » 27 Jan 2018, 15:25

It can even get better if you only enable Send Component ID in the Touch Release Event of a button.
Let's assume that gives the code of 774 in the ESPEasy and in Domoticz you have a switch with idx 7.
Then with Rule:
on E16Nextion#code=774 do
SendToHTTP <domoticz ip,8080>,/json.htm?type=command&param=switchlight&idx=7&switchcmd=Toggle
endon

you can toggle the switch.
And if you put:
http://<domoticz ip>/control?cmd=NEXTION,page3.b5.bco=1024 in the switch's On Action and
http://<domoticz ip>/control?cmd=NEXTION,page3.b5.bco=48631 in the off action

With a switch b5 on page3 of the Nextion, obviously, you get a feedback.
The switch is grey when off and green when on. It is important that the switches have a vscope set to global.

If on the Nextion you have the switch on page 0, you send: http://<domoticz ip>/control?cmd=NEXTION,page0.b5.bco=1024

Have fun.

choxnox
New user
Posts: 1
Joined: 29 Jan 2018, 08:50

Re: Nextion display plugin

#151 Post by choxnox » 29 Jan 2018, 08:52

Is this the latest version of the plugin?

https://github.com/letscontrolit/ESPEas ... extion.ino

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

Re: Nextion display plugin

#152 Post by BertB » 29 Jan 2018, 18:23

Yes

Ernst200
New user
Posts: 2
Joined: 04 May 2017, 09:10

Re: Nextion display plugin

#153 Post by Ernst200 » 02 Feb 2018, 19:57

Bedankt Bert

Ierlandfan
New user
Posts: 2
Joined: 13 Feb 2018, 09:22

Re: Nextion display plugin

#154 Post by Ierlandfan » 13 Feb 2018, 10:34

In Domoticz I created a few scripts to update the device through this plugin. Took me a while to figure out how to send a textvalue in quotes.
So for historial purposes and well, maybe it saves someone a lot of time I''ll put a few lua examples here. You can simply update any value this way.
For example button color, button txt, textvalues, text color etc.etc. Basically everything that's "green" in the attribute window (right-down window in Nextion Editor) when selecting a box (Button, text whatever) can be updated this way. It's quite easy if you get the hang of it.

(Lines that start with -- are not code, they are comments and are ignored by Lua)

First is text as is, (no values just text in quotes)
script_device_nextiontextquotes.lua

Code: Select all

commandArray = {}

print('Script bin_selector_nextion executed')  --This shows up in Domoticz log
print(devicechanged['Afval'])
afval = otherdevices_svalues['Afval'] --Afval is the name of my dummy selector switch in this case.
print(otherdevices_svalues['Afval'])  -- svalue returns the value of level (Off, 10, 20, 30, etc) 

if (afval == "10") then -- In this case 10 is selector level 10, needs quotes, just for reference 
os.execute('curl -s "http://192.168.1.125/control?cmd=NEXTION,default.nAfval2.pic=20" ') -- changing a picture does not requires quotes
os.execute([[curl -s 'http://192.168.1.125/control?cmd=NEXTION,default.nAfval1.txt="Weekend"']]) --changing a text does requires quotes
return commandarray --execute the commands
end -- to close if
Next one is sending a value from Domoticz (Temperature or Solar or Energy for example) to Nextion. Nextion cannot handle floats (0.1 or 1.5) so sending the value in a textbox works like a charm but needs some extra lines of code.

script_device_nextion_valuequotes.lua

Code: Select all

-- we need this function to send the quotes around the values
function url_encode(str)
  if (str) then
    str = string.gsub (str, "\n", "\r\n")
    str = string.gsub (str, "([^%w %-%_%.%~])",
        function (c) return string.format ("%%%02X", string.byte(c)) end)
    str = string.gsub (str, " ", "+")
  end
  return str
end
 
powervalueintext = otherdevices_svalues['SolarEnergyLive'] --this values can be for example 88.5 or 1433.2, just like temperature can be 2.3 or -4.4)
powervalueinquotes = '"' ..powervalueintext.. '"' --First part of the magic

commandArray = {}
print('Power = '..powervalueintext) --This shows up in Domoticz log
power =tonumber(powervalueintext) -- If you want to compare numeric values, see example later on

if (devicechanged['SolarEnergyLive'])then --If value changes of device SolarEnergyLive 

os.execute('curl -s "http://192.168.1.125/control?cmd=NEXTION,default.tSolar1.txt=' .. url_encode(powervaluesinquotes) .. '"') --sending value to textbox in quotes
print('Sending data to Nextion') --This shows up in Domoticz log
return commandarray --execute the commands
end --To close the If 
What I did for example is I created 18 pictures for Solar (cropped, global) which are updated based on the power value.
power =tonumber(powervalueintext) -- If you want to compare numeric values, thats why powervalueintext and powervalueinquotes

Code: Select all


-- If power value (not the quoted onces these are the to a real number ones)  is between 80.x and 160.x 
-- this can not be compared in Nextion editor because value can be x.x (floats) so lua does that for me

if (power>=80 and power<=160) then  
os.execute('curl -s "http://192.168.1.125/control?cmd=NEXTION,default.nSolar2.pic=3" ') ---pictures do not need quotes around the value
os.execute('curl -s "http://192.168.1.125/control?cmd=NEXTION,default.nSolar1.txt=' .. url_encode(powerquotes) .. '"') --textvalue send with quotes
print('Sending data')
( Original background Domoticz picture and GUI is from here https://www.domoticz.com/forum/viewtopi ... 6&start=20
Attachments
Quick demo
Quick demo
nextion.png (417.42 KiB) Viewed 164596 times

Ierlandfan
New user
Posts: 2
Joined: 13 Feb 2018, 09:22

Re: Nextion display plugin

#155 Post by Ierlandfan » 13 Feb 2018, 11:21

Quick PHP example (Because I also use a php script (for the bus part) but just to show you how things can be done in PHP or without Domoticz.
For example(a very small part of the actual script) that is a cron job every minute around bus arrival, again not depending on Domoticz.

/* PHP code Not Lua */-- just for reference

Code: Select all

$Trip_Status = "Active"; //Example text 

/* Text color changes based on value*/

if ($Trip_Status == "Active")
{
$color2 = 63488; //Color value red because Active is true in this case
}
else if ($Trip_Status == "DroppedOff")
{
$color2 = 65535; //Color White
}
else
{
$color2 = 1024; //Color Green
}

$nex3 = curl_init("http://192.168.1.125/control?cmd=NEXTION,default.nRitstatus2.txt=\"$Trip_Status\""); // text does need quotes while sending so escaped
$nex3c =curl_init("http://192.168.1.125/control?cmd=NEXTION,default.nRitstatus2.pco=$color2"); //color doesn't need quotes while sending so no escapes
$nex3d = curl_init("http://192.168.1.125/control?cmd=NEXTION,page%20default"); //Screen jumps to the page with the name default,space escaped with %20
error_log("Nextion ('$Trip_Status')",0);
closelog();
curl_exec($nex3);
curl_exec($nex3c);
curl_exec($nex3d)
curl_close($nex3);
curl_close($nex3c);
curl_close($nex3d)

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

Re: Nextion display plugin

#156 Post by BertB » 14 Feb 2018, 12:09

It realy looks great, but honestly ... Lua is too much for me :(

fabix68
New user
Posts: 7
Joined: 14 Nov 2015, 14:04

Re: Nextion display plugin

#157 Post by fabix68 » 24 Feb 2018, 15:25

hi, and congratulations for the plugin
I'm using it to interface a nextion display with my domoticz server.
I'm having trouble changing the value of a setpoint.
In t3 I have the value to send
with a send button

Code: Select all

va0.val++
if(va0.val>30)
{
  va0.val=30
}
cov va0.val,t0.txt,0
print "|u,i230,n,s"
print t0.txt
printh 0a
If I enable "send compoment id" I can intercept the evendo from the esp but not the value.
Below is the log

Code: Select all

Nextion : code: ,,
EVENT: NEXTION#idx=261.00
ACT  : temperatura=
ACT  : sendtohttp 192.168.1.80,8080,/json.htm?param=udevice&type=command&idx=245&nvalue=0&svalue=0
HTTP/1.1 200 OK
EVENT: NEXTION#value=0.00
EVENT: NEXTION#=255.00
EVENT: NEXTION#=255.00
Nextion: send command: s7
10:00
s if the value of t3.txt
If I disable "send component id"
I get only

Nextion: send command: s7
10:00
Nextion: send command: s8
10:00



what am I wrong?
Last edited by fabix68 on 24 Feb 2018, 18:10, edited 1 time in total.

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

Re: Nextion display plugin

#158 Post by BertB » 24 Feb 2018, 16:43

Where did you put the code in the Nextion button?
It has to be in the Touch Release Event.
Your Nextion#idx=261

This is the code in Rules:

Code: Select all

on Nextion#idx=230 do
 sendtohttp xxx.xxx.xxx.xxx,8080,/json.htm?param=udevice&type=command&idx=79&nvalue=0&svalue=[Nextion#value]
endon
xxx is to be replaced by your address.

This is what I get in the log:

Code: Select all

EVENT: Nextion#idx=230.00
ACT  : sendtohttp xxx.xxx.xxx.xxx,8080,/json.htm?param=udevice&type=command&idx=79&nvalue=0&svalue=22
HTTP/1.1 200 OK

EVENT: Processing time:165 milliSeconds
EVENT: Nextion#value=22.00
EVENT: Processing time:107 milliSeconds
HTTP : connecting to xxx.xxx.xxx.xxx:8080

fabix68
New user
Posts: 7
Joined: 14 Nov 2015, 14:04

Re: Nextion display plugin

#159 Post by fabix68 » 24 Feb 2018, 18:18

The code in nextion is released in the release event of the page1 id 5 (detected as 261)

these are the rules set in the espeasy

245 if the Setpoint idx in Domoticz

Code: Select all

on NEXTION#idx=261 do
    sendtohttp 192.168.1.80,8080,/json.htm?param=udevice&type=command&idx=245&nvalue=0&svalue=[Nextion#value]
endon
if I do not enable "send component id" it will always expeasy ignore the rule.
:oops: :oops:
Image
Image
Image

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

Re: Nextion display plugin

#160 Post by BertB » 24 Feb 2018, 18:54


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

Re: Nextion display plugin

#161 Post by BertB » 24 Feb 2018, 18:56

choxnox wrote: 29 Jan 2018, 08:52 Is this the latest version of the plugin?

https://github.com/letscontrolit/ESPEas ... extion.ino
I am sorry,
It is not the latest version. Somehow I cannot get it on the playground.
Just above, there is the newest one.

fabix68
New user
Posts: 7
Joined: 14 Nov 2015, 14:04

Re: Nextion display plugin

#162 Post by fabix68 » 24 Feb 2018, 21:52

I have compiled ESPEASY with the new plugin but the result does not change.
Can you send me an HMI file and a working rule in order to understand what I'm wrong with?

Thank you

fabix68
New user
Posts: 7
Joined: 14 Nov 2015, 14:04

Re: Nextion display plugin

#163 Post by fabix68 » 24 Feb 2018, 22:55

TNK !!!!!!!
Solved

The correct Plugin is

https://www.dropbox.com/s/1leyh86xv5c2p ... n.ino?dl=0

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

Re: Nextion display plugin

#164 Post by TD-er » 26 Feb 2018, 23:23

Is this plugin currently mature enough to port to the Mega branch for the "testing" builds?

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

Re: Nextion display plugin

#165 Post by BertB » 28 Feb 2018, 14:51

I am trying to get it to the playground, but I just don't understand this process.
My current attempt seems to end up in all sorts of conflicts.

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

Re: Nextion display plugin

#166 Post by TD-er » 01 Mar 2018, 22:05

If you think it is workable, I can port it to the Mega branch, then more people can test it.

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Nextion display plugin

#167 Post by budman1758 » 02 Mar 2018, 03:33

TD-er wrote: 01 Mar 2018, 22:05 If you think it is workable, I can port it to the Mega branch, then more people can test it.
Please do that. I have one of these displays coming. :mrgreen:
"The glass is twice as big as it needs to be".

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

Re: Nextion display plugin

#168 Post by BertB » 02 Mar 2018, 10:35

TD-er wrote: 01 Mar 2018, 22:05 If you think it is workable, I can port it to the Mega branch, then more people can test it.
Yes, please do.
I work with the latest version for quite some time and I think it is quite stable.

Dennis.prior
New user
Posts: 2
Joined: 05 Mar 2018, 22:21

Re: Nextion display plugin

#169 Post by Dennis.prior » 05 Mar 2018, 22:25

hi

I am trying to upload the plugin but I keep getting an error. when I flash it without the nextion plug in it works fine. when I add the plugin _p117_nextion.ino I get the following error


C:\Documents and Settings\me2\Local Settings\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\SoftwareSerial/SoftwareSerial.cpp:38: multiple definition of `sws_isr_0()'

libraries\ESPEasySoftwareSerial\ESPeasySoftwareSerial.cpp.o:C:\Program Files\Arduino\libraries\ESPEasySoftwareSerial/ESPeasySoftwareSerial.cpp:41: first defined here

libraries\SoftwareSerial\SoftwareSerial.cpp.o: In function `sws_isr_1()':

C:\Documents and Settings\me2\Local Settings\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\SoftwareSerial/SoftwareSerial.cpp:39: multiple definition of `sws_isr_1()'

libraries\ESPEasySoftwareSerial\ESPeasySoftwareSerial.cpp.o:C:\Program Files\Arduino\libraries\ESPEasySoftwareSerial/ESPeasySoftwareSerial.cpp:42: first defined here

libraries\SoftwareSerial\SoftwareSerial.cpp.o: In function `sws_isr_2()':

C:\Documents and Settings\me2\Local Settings\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\SoftwareSerial/SoftwareSerial.cpp:40: multiple definition of `sws_isr_2()'

libraries\ESPEasySoftwareSerial\ESPeasySoftwareSerial.cpp.o:C:\Program Files\Arduino\libraries\ESPEasySoftwareSerial/ESPeasySoftwareSerial.cpp:43: first defined here

c:/documents and settings/me2/local settings/application data/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\DOCUME~1\me2\LOCALS~1\Temp\arduino_build_87757/ESPEasy.ino.elf section `.text' will not fit in region `iram1_0_seg'

collect2.exe: error: ld returned 1 exit status

Multiple libraries were found for "Servo.h"
Used: C:\Documents and Settings\me2\Local Settings\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\Servo
Not used: C:\Program Files\Arduino\libraries\Servo
exit status 1
Error compiling for board NodeMCU 0.9 (ESP-12 Module).


I am at a loss. any help would be great. thank you in advance

kulich
New user
Posts: 1
Joined: 07 Mar 2018, 13:10

Re: Nextion display plugin

#170 Post by kulich » 07 Mar 2018, 13:15

in the plugin rename 3x SoftwareSerial on ESPeasySoftwareSerial

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

Re: Nextion display plugin

#171 Post by TD-er » 07 Mar 2018, 20:09

kulich wrote: 07 Mar 2018, 13:15 in the plugin rename 3x SoftwareSerial on ESPeasySoftwareSerial
This code should work, but only added it, not tested yet and therefore not made a PR to the Mega branch: https://github.com/TD-er/ESPEasy/blob/f ... extion.ino

Dennis.prior
New user
Posts: 2
Joined: 05 Mar 2018, 22:21

Re: Nextion display plugin

#172 Post by Dennis.prior » 08 Mar 2018, 18:50

i got it sorted. I found an installer with the plugin on it.

gijsje
New user
Posts: 2
Joined: 13 Feb 2018, 10:46

Re: Nextion display plugin

#173 Post by gijsje » 08 Mar 2018, 20:25

Dennis.prior wrote: 08 Mar 2018, 18:50 i got it sorted. I found an installer with the plugin on it.
Can you share where you got it?

hamster
Normal user
Posts: 62
Joined: 27 Sep 2015, 21:01
Location: UK

Re: Nextion display plugin

#174 Post by hamster » 21 Mar 2018, 23:21

I have trying for days now to get my nextion working as thermostat control

I'm using the following on for the logic on the nextion for a up / increment button

Code: Select all

va0.val=va0.val+2
if(va0.val>9)
{
  va1.val=va1.val+1
  va0.val=va0.val-10
}
if(va1.val>25)
{
  va1.val=va3.val
  va0.val=va4.val
}
cov va0.val,t9.txt,1
cov va1.val,t10.txt,2
t4.txt=t10.txt+"."+t9.txt
for the increment down button

Code: Select all

va0.val=va0.val-2
if(va0.val<1)
{
  va1.val=va1.val-1
  va0.val=va0.val+9
}
if(va1.val<5)
{
  va1.val=va5.val
  va0.val=va6.val
}
cov va0.val,t9.txt,1
cov va1.val,t10.txt,2
t4.txt=t10.txt+"."+t9.txt
this then increments t4 as a decimal xx.x
I then use on touch press event on t4.txt

Code: Select all

print "set-temp"
print t4.txt
t4.pco=18242
on the touch release of t4.txt

Code: Select all

t4.pco=65535
This then allows me to use the up + down buttons to create a setpoint where the font is red, I then press the t3.txt this then changes the font white, and sends the selected value to the esp
on the log is see :

Code: Select all

send command: set-temp19.11
Does any one know how get this

Code: Select all

Nextion : send command: set-temp19.1116
to my mqtt broker
switches work fine by using the following rules

Code: Select all

on nextion2#code=3.00 do
sendtohttp 192.168.0.48,8080,/json.htm?param=switchlight&type=command&idx=91&switchcmd=Toggle
endon
but trying to send a value doesn't seem to be possible?

arnoldg
Normal user
Posts: 14
Joined: 29 Aug 2017, 07:02

Re: Nextion display plugin

#175 Post by arnoldg » 01 Apr 2018, 21:50

how can i send a slidder value to openhab over mqtt.

i have the plugin working.
but then, with nextion i'm new and need some help.

fazambuja
Normal user
Posts: 13
Joined: 17 Apr 2018, 19:05

Re: Nextion display plugin

#176 Post by fazambuja » 24 Apr 2018, 04:45

Does someone have a simple example of how the plugin works? Like sending a temperature value to n0...
I can test on my screen. :)

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

Re: Nextion display plugin

#177 Post by TD-er » 24 Apr 2018, 22:03

Do not forget to lower the signal levels of the TX from Nextion to the RX gpio of the ESP.
The Nextion outputs 5V, but the ESP does only accept 3v3.

fazambuja
Normal user
Posts: 13
Joined: 17 Apr 2018, 19:05

Re: Nextion display plugin

#178 Post by fazambuja » 24 Apr 2018, 23:21

TD-er wrote: 24 Apr 2018, 22:03 Do not forget to lower the signal levels of the TX from Nextion to the RX gpio of the ESP.
The Nextion outputs 5V, but the ESP does only accept 3v3.
Are all displays like this? Mine is the enhanced and at least on their website says:

Code: Select all

Interfaces Performance
Test Conditions	Min	Typical	Max	Unit
Serial Port Baudrate	Standard	2400	9600	115200	bps
Output High Voltage	IOH=-1mA	3.0	3.2		V
Output Low Voltage	IOL=1mA		0.1	0.2	V
Input High Voltage		2.0	3.3	5.0	V
Input Low Voltage		-0.7	0.0	1.3	V
Serial Port Mode	TTL
Serial Port	4Pin_2.54mm
USB interface	NO
SD card socket	Yes (FAT32 format), support maximum 32G Micro SD Card
* microSD card socket is exclusively used to upgrade Nextion firmware /HMI design
https://nextion.itead.cc/resources/data ... 4t024_011/

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

Re: Nextion display plugin

#179 Post by TD-er » 24 Apr 2018, 23:45

Not sure if all have high ( > 3V3) TX lines.
I saw at least one and better safe than sorry.
Judging from that datasheet, I would say that one should be safe to use on an ESP directly.

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

Re: Nextion display plugin

#180 Post by waspie » 21 May 2018, 01:26

I just got my first nextion and i'm already making some progress. I have to say, it's a bit confusing... someone should make a nice noob summary at some point (pointing at me too, don't worry :P )

This will be great with openhab / mqtt. I don't plan to use a slider yet, but i may at least test so I can help answer arnold's question.

I think I know the answer to this already but I'll ask anyway.

Is there any way to remotely update the Nextion? I'd love to get this pinned to a wall and halfway usable but i also need a way to update it. I know i'll be tinkering with the interface until i get it just right.
I didn't see much in the way of updating it remotely. I hate the thought of actually having to finalize some sort of design before getting it on the wall. that could take months :O

awesome plugin!


also, all the spec sheets i've looked at from the current ones show +3.3v max on the serial line. maybe older ones used 5v?

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 20 guests