Nextion display plugin

Moderators: BertB, rtenklooster, Voyager, Stuntteam, Martinus

Message
Author
BertB
Normal user
Posts: 898
Joined: 25 Apr 2015, 14:39

Re: Nextion display plugin

#181 Post by BertB » 21 May 2018, 10:56

waspie wrote:
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?
There is some kind of a summary halfway this topic. I agree, it deserves a proper one, but I simply have no time.
Remote update would be awsome, but I honestly have no clue how to do it.
I have my displays direcly connected to WeMos boards without any problem. If you interprete the description of the interface, you see it gives an output of max 3.2 volts, but accepts between 3.3 and 5 volt as a logic high at its input.

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

Re: Nextion display plugin

#182 Post by BertB » 21 May 2018, 14:18

I started to create a WIKI in the devices list, but it is in its very preprepre stadium.
https://www.letscontrolit.com/wiki/inde ... IONDisplay

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

Re: Nextion display plugin

#183 Post by waspie » 23 May 2018, 02:23

BertB wrote:
21 May 2018, 14:18
I started to create a WIKI in the devices list, but it is in its very preprepre stadium.
https://www.letscontrolit.com/wiki/inde ... IONDisplay
Nice! I may go in there and at least fix grammatical issues.

on another note, for you or hopefully anyone else that can answer...

How can I get imported text into the nextion?

Code: Select all

on foyerNextion#temp do
nextion,page0.t0.txt="%[foyerNextion#temp]%"
endon
doesn't work. neither does

Code: Select all

on foyerNextion#temp do
nextion,page0.t0.txt="[foyerNextion#temp]"
endon
or

Code: Select all

on foyerNextion#temp do
nextion,page0.t0.txt="%foyerNextion#temp%"
endon
I just get some version of this in the log:

Code: Select all

2009401 : IMPT : [foyerNextion#temp] : 69.13
2009402 : EVENT: foyerNextion#temp=69.13
2009450 : ACT  : nextion,page0.t0.txt="%%"
page0.t0.txt="%%"

***EDIT**** it's %eventvalue% duh. trying to remember all the stuff on the rules tutorial page is hard :P got it!

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

Re: Nextion display plugin

#184 Post by BertB » 23 May 2018, 11:11

waspie wrote:
23 May 2018, 02:23

Nice! I may go in there and at least fix grammatical issues.
Great! :D

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

Re: Nextion display plugin

#185 Post by waspie » 29 May 2018, 02:32

hamster wrote:
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?
ever make any progress on this? I think I'm looking to do something similar. I may end up doing the counting in ESP rules but maybe better to do in Nextion? not sure the best route to go

and rather than pressing something to "enter" the number why not a timer that waits 5-10? seconds after last press to send the number? not sure if that's an option?

what about in the rules of ESP do something like

on ESPNXT#code=5 (say 5 is up and 6 is down)
if ( dummval#TMP <= 79 )
dummyval#TMP = dummyval#TMP+1
else
dummyval = 65
endif
timerSet,1,10
endon

on ESPNXT#code=6
if ( dummvalTMP >= 66 )
dummyval#TMP = dummyval#TMP+1
else
dummyval = 80
endif
timerSet,1,10
endon

on Rules#Timer=1 do
Publish /%sysname/dummyval#TMP
endon

this is all untested and off the top of my head. I'm not a rules expert so take this as a general IDEA of what you need to do. Would this not be better then? The rules portion of the ESP handles all the incrementing.
When no button has been pressed then after 10 seconds it publishes the value to MQTT. I think that's how it will work? TD-er?

then with an MQTT import you can set the display to show the setpoint AND update the dummyval so it all stays in sync.

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

Re: Nextion display plugin

#186 Post by waspie » 09 Jun 2018, 20:39

is there a way to make a button with a cropped picture change based on a variable without refreshing the page?

say page0.b0 has picc 1 (on) and 2 (off)
and there's a global variable va0 used to storing that state for when pages are changed.

trying to keep espeasy, the button, and openhab (mqtt) involves some rules. many buttons means many rules and running out of rule space

I could cut down a lot of i could just set the variable to the nextion and make the nextion update the picture based on the variable instead of having to set the variable and the picture.

so say on some mqtt#import do
nextion,page0.va0.val=0

then the nextion sees that va0.val changed and changes the b0 picc = 2

is this possible (without sending a page refresh) ?

TD-er
Normal user
Posts: 744
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Nextion display plugin

#187 Post by TD-er » 10 Jun 2018, 10:29

If you need some extra commands to make the rules easier, just ask.

What I need then is:
- Command-name
- Parameters + description
- Description of the call to the Nextion, based on such parameters.

We can add commands to the Nextion plugin, which can be called from rules.

If the discussion about what commands are needed and how to format them is closing to something useful, we can add an issue on Github about it.

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

Re: Nextion display plugin

#188 Post by waspie » 10 Jun 2018, 14:11

Ok, let me think about that. A lot of the stuff is pretty repetitive but I don't know how else to do it. I'll get back to you on Monday when I'm at work and have time to tinker

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

Re: Nextion display plugin

#189 Post by waspie » 14 Jun 2018, 21:55

TD-er wrote:
10 Jun 2018, 10:29
If you need some extra commands to make the rules easier, just ask.

What I need then is:
- Command-name
- Parameters + description
- Description of the call to the Nextion, based on such parameters.

We can add commands to the Nextion plugin, which can be called from rules.

If the discussion about what commands are needed and how to format them is closing to something useful, we can add an issue on Github about it.
all right, so I haven't had a lot of time to dedicate to this yet. I've been busy at work and when i get home i'm tending to try and wrap up several of my HA things that are in progress. Replacing bedroom switches with nextions that control the light via relay and my vents via openhab. car presence. etc etc.

So one way i found to update the nextion display is to create a hotspot on the page, typically named m0 (this was suggested in their forums by one of the two main guys i think). in the m0 on the nextion IDE you put all your commands for that page similar to the page pre-init stuff.
then you "click" the m0 like:
nextion m0,click (IIRC, i'd have to look at my rules on one of the new units i've set up).

So a function like "Check this box to "click" m0 when a variable is sent to the nextion" hah no idea how you'd do that... that's why you get paid the big bucks :O

A rule looks like

on MQTT#import=1 do
nextion,page0.va1.val=1
TaskValueSet,2,1,1
nextion m0,click
endon

I do this stuff to keep the nextion,esp, and openhab all in sync.

I know you can do "nextion,page0" and it refreshes the page but for whatever reason "clicking" the m0 doesn't redraw the page so it looks much smoother.
Try both, you'll see what I mean.

so i suppose maybe the command could just be "nxtupdate" ? and then the parameter would be the hotspot name. m0, m1, m2 etc. that makes sense i think...right?

on whatever do
nextion, stuff
nxtupdate
endon

TD-er
Normal user
Posts: 744
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Nextion display plugin

#190 Post by TD-er » 14 Jun 2018, 23:51

waspie wrote:
14 Jun 2018, 21:55
[...]
So a function like "Check this box to "click" m0 when a variable is sent to the nextion" hah no idea how you'd do that... that's why you get paid the big bucks :O
[...]
Just to be clear, I don't get paid anything for ESPeasy.
It only costs me money to let the postmen (and -women) visit my front door very frequently with bags filled with all kind of stuff from Ali or Banggood. :)

I really have to free some time to get my Nextion display connected so I could play with it a bit.
Then I am sure I would get annoyed enough by missing features and add them. Until then you'll have to formulate your annoyances for me to convert into C++ code. :lol:

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest