Nextion display plugin

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
Cdzn
Normal user
Posts: 15
Joined: 06 Oct 2020, 18:15

Re: Nextion display plugin

#501 Post by Cdzn » 01 May 2021, 11:25

Ath wrote: 01 May 2021, 11:05 Ah, the Level plugin. But still nothing specific to the Nextion.

For the Level control you can react on a sensor value changing from a specific threshold (hysteresis). You would need a rule like:

Code: Select all

on Level#Output do
  if %eventvalue% = 1
    // value within range
  else
    // value outside set range
  endif
endon
It can be used to display a warning on the Nextion (or any other type of output, like a buzzer, LED, OLED, or send an email).
I found solution and it works well. For other who wants thermostat with Nextion display.
Here is the rules in ESP-Easy

Code: Select all

on NEXTTEST#idx=505 do
  if [thermTEST#getLevel]>15
    config,task,thermTEST,setlevel,[thermTEST#getLevel]-0.5
    NEXTTEST,page0.t1.txt="[thermTEST#getLevel]" //by this we display on current temperature visible
endif
endon

on NEXTTEST#idx=504 do
  if [thermTEST#getLevel]<27
    config,task,thermTEST,setlevel,[thermTEST#getLevel]+0.5
    NEXTTEST,page0.t1.txt="[thermTEST#getLevel]"
  endif
endon
NEXTTEST#idx=505 and NEXTTEST#idx=504 is the button i created in Nextion editor (see logs in esp when u push the buttons and u will see the uniq IDX) and check "Send component ID" for both buttons

[thermTEST#getLevel] it`s the regulator level i called thermTEST. U should set getLevel for middle position. Thanks all for support and advice
Last edited by Cdzn on 01 May 2021, 16:23, edited 3 times in total.

User avatar
Ath
Normal user
Posts: 891
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Nextion display plugin

#502 Post by Ath » 01 May 2021, 11:37

ok, great you solved it, sorry that I couldn't help better :).
/Ton

Cdzn
Normal user
Posts: 15
Joined: 06 Oct 2020, 18:15

Re: Nextion display plugin

#503 Post by Cdzn » 01 May 2021, 11:44

Ath wrote: 01 May 2021, 11:37 ok, great you solved it, sorry that I couldn't help better :).
You helped, just said I couldn’t do it how You imagine)

namxcap
Normal user
Posts: 7
Joined: 06 May 2021, 23:57

Re: Nextion display plugin

#504 Post by namxcap » 11 May 2021, 10:50

Hello all, i can read temperature from esp and send it to the Nextion display, i can send data from Nextion to esp.
Now i would like to push a button on the Nextion and set a new value in a Virtual Thermostat in Domoticz (idx and value) but i don't know how to do it, what is the command to send to esp ?
I read it's easy but i think i'm missing something .......

P.S.: The plugin needs to be installed ?

Thanyou

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

Re: Nextion display plugin

#505 Post by TD-er » 11 May 2021, 11:11

You can take several routes for this.
I think the simplest way is to add a task running a Dummy plugin.
This will then be filled via the rules and you can attack any controller to this dummy task which will then send the data to the connected controller(s).

In the rules, you must then act on the push from the nextion in the rules.

I am not that familiar with the Nextion plugin myself, but I guess you can receive an event from it when you push a button.
So on that event, you have to act in the rules.

I also don't know where your value comes from, but I guess it may be included in the event? Or can you fetch it from another task?
If it comes from the event, you should refer to it like this: %eventvalue1%
If it must be taken from a task, you should refer to it like this: [taskname#varname]

The value must then be set to a position in the dummy task and you must run the dummy task to 'flush' the values to the connected controller(s)
See https://espeasy.readthedocs.io/en/lates ... skvalueset
There is also a shortcut for TaskValueSet and TaskRun, which is called TaskValueSetAndRun
You must then know the task index and the variable index (see the linked documentation)

In the rules:

Code: Select all

on myevent do
  TaskValueSetAndRun,1,0,[taskname#varname]  // When fetching from another task
endon
The IDX you need, you have to set in the dummy variable next to where you link a Domoticz controller to the task.

namxcap
Normal user
Posts: 7
Joined: 06 May 2021, 23:57

Re: Nextion display plugin

#506 Post by namxcap » 11 May 2021, 18:27

i don't understand...

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

Re: Nextion display plugin

#507 Post by ThomasB » 12 May 2021, 01:23

Now i would like to push a button on the Nextion and set a new value in a Virtual Thermostat in Domoticz (idx and value) but i don't know how to do it, what is the command to send to esp ?
The Nextion plugin has a "Send to Controller" option. If this option is selected the idx and value data will be sent to your controller. Your controller must be installed in ESPEasy's Controllers tab. There are two different Domoticz controllers to choose from.

BTW, there are three different data formats for sending Nextion touch commands to ESPEasy. The format you select is your choice. Information is explained here (see Nextion Data Format Summary section):
https://espeasy.readthedocs.io/en/lates ... /P075.html

Perhaps you mean you need advice on how to process the touch event data in your ESPEasy rules. TD-er offered a way to use the "dummy" device plugin to do this. As an alternative, here is a rule example that detects Nextion's idx that ranges from 10 to 30. It does not use the dummy plugin; It is just a basic example I pulled from one of my installations that shows how to act on a range of touch events using a rule.

Code: Select all

on NEXTION#idx do
  if [NEXTION#idx]>=10 and [NEXTION#idx]<=30 // Only observe idx 10 to 30.
// Your rule actions go here.
  endif
endon
Regarding Domoticz, information on using ESPEasy Nextion with Domoticz is available here: https://www.letscontrolit.com/wiki/inde ... IONDisplay
Hopefully the information helps you. I'm not a Domoticz user so I can't offer any additional advice.

- Thomas

namxcap
Normal user
Posts: 7
Joined: 06 May 2021, 23:57

Re: Nextion display plugin

#508 Post by namxcap » 24 May 2021, 19:25

Hello .....
No way
I don't understand because this command:

http://192.168.0.50:8088/json.htm?type= ... etpoint=11

return this error:

Command unknown: http://192.168.0.50:8088/json.htm?type= ... etpoint=11

In a browser it works, but in letscontrolit command line it doesn't

namxcap

Cdzn
Normal user
Posts: 15
Joined: 06 Oct 2020, 18:15

Re: Nextion display plugin

#509 Post by Cdzn » 25 May 2021, 10:34

Because this is 2 different commands. Internal commands can be used only from command line. read this
https://www.letscontrolit.com/wiki/inde ... _Reference
Also for your project you will find here all of you needed
https://www.letscontrolit.com/wiki/inde ... 2C_HTTP.5D

And these link describes how you should read touch events

https://www.letscontrolit.com/wiki/index.php/Nextion

For domoticz switchig from ESPEasy use this command http://192.168.0.101:8084/json.htm?type ... etpoint=25, just put your Values for thermostat. You can compare this rule

on NEXTION#idx=505 do
if [thermTEST#getLevel]>15
config,task,thermTEST,setlevel,[thermTEST#getLevel]-0.5
NEXTION,page0.t1.txt="[thermTEST#getLevel]"
endif
endon

on NEXTION#idx=504 do
if [thermTEST#getLevel]<27
config,task,thermTEST,setlevel,[thermTEST#getLevel]+0.5
NEXTION,page0.t1.txt="[thermTEST#getLevel]"
endif
endon

with HTTP-request
I still in progress. If u find a solution remind me pls

Cdzn
Normal user
Posts: 15
Joined: 06 Oct 2020, 18:15

Re: Nextion display plugin

#510 Post by Cdzn » 25 May 2021, 14:26

Cdzn wrote: 01 May 2021, 11:25
Ath wrote: 01 May 2021, 11:05 Ah, the Level plugin. But still nothing specific to the Nextion.

For the Level control you can react on a sensor value changing from a specific threshold (hysteresis). You would need a rule like:

Code: Select all

on Level#Output do
  if %eventvalue% = 1
    // value within range
  else
    // value outside set range
  endif
endon
It can be used to display a warning on the Nextion (or any other type of output, like a buzzer, LED, OLED, or send an email).
I found solution and it works well. For other who wants thermostat with Nextion display.
Here is the rules in ESP-Easy

Code: Select all

on NEXTTEST#idx=505 do
  if [thermTEST#getLevel]>15
    config,task,thermTEST,setlevel,[thermTEST#getLevel]-0.5
    NEXTTEST,page0.t1.txt="[thermTEST#getLevel]" //by this we display on current temperature visible
endif
endon

on NEXTTEST#idx=504 do
  if [thermTEST#getLevel]<27
    config,task,thermTEST,setlevel,[thermTEST#getLevel]+0.5
    NEXTTEST,page0.t1.txt="[thermTEST#getLevel]"
  endif
endon
NEXTTEST#idx=505 and NEXTTEST#idx=504 is the button i created in Nextion editor (see logs in esp when u push the buttons and u will see the uniq IDX) and check "Send component ID" for both buttons

[thermTEST#getLevel] it`s the regulator level i called thermTEST. U should set getLevel for middle position. Thanks all for support and advice
Here is description how i used the rules

namxcap
Normal user
Posts: 7
Joined: 06 May 2021, 23:57

Re: Nextion display plugin

#511 Post by namxcap » 25 May 2021, 20:01

Cdzn wrote: 25 May 2021, 10:34 Because this is 2 different commands. Internal commands can be used only from command line. read this
https://www.letscontrolit.com/wiki/inde ... _Reference
Also for your project you will find here all of you needed
https://www.letscontrolit.com/wiki/inde ... 2C_HTTP.5D

And these link describes how you should read touch events

https://www.letscontrolit.com/wiki/index.php/Nextion

For domoticz switchig from ESPEasy use this command http://192.168.0.101:8084/json.htm?type ... etpoint=25, just put your Values for thermostat. You can compare this rule

on NEXTION#idx=505 do
if [thermTEST#getLevel]>15
config,task,thermTEST,setlevel,[thermTEST#getLevel]-0.5
NEXTION,page0.t1.txt="[thermTEST#getLevel]"
endif
endon

on NEXTION#idx=504 do
if [thermTEST#getLevel]<27
config,task,thermTEST,setlevel,[thermTEST#getLevel]+0.5
NEXTION,page0.t1.txt="[thermTEST#getLevel]"
endif
endon

with HTTP-request
I still in progress. If u find a solution remind me pls
But
http://192.168.0.101:8084/json.htm?type ... etpoint=25
does not work in a rule ....

Cdzn
Normal user
Posts: 15
Joined: 06 Oct 2020, 18:15

Re: Nextion display plugin

#512 Post by Cdzn » 31 May 2021, 13:28

namxcap wrote: 25 May 2021, 20:01
Cdzn wrote: 25 May 2021, 10:34 Because this is 2 different commands. Internal commands can be used only from command line. read this
https://www.letscontrolit.com/wiki/inde ... _Reference
Also for your project you will find here all of you needed
https://www.letscontrolit.com/wiki/inde ... 2C_HTTP.5D

And these link describes how you should read touch events

https://www.letscontrolit.com/wiki/index.php/Nextion

For domoticz switchig from ESPEasy use this command http://192.168.0.101:8084/json.htm?type ... etpoint=25, just put your Values for thermostat. You can compare this rule

on NEXTION#idx=505 do
if [thermTEST#getLevel]>15
config,task,thermTEST,setlevel,[thermTEST#getLevel]-0.5
NEXTION,page0.t1.txt="[thermTEST#getLevel]"
endif
endon

on NEXTION#idx=504 do
if [thermTEST#getLevel]<27
config,task,thermTEST,setlevel,[thermTEST#getLevel]+0.5
NEXTION,page0.t1.txt="[thermTEST#getLevel]"
endif
endon

with HTTP-request
I still in progress. If u find a solution remind me pls
But
http://192.168.0.101:8084/json.htm?type ... etpoint=25
does not work in a rule ....
Read this
https://www.letscontrolit.com/wiki/inde ... SendToHTTP

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests