Send temp value to other ESP before sleep

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
BounceMeister
Normal user
Posts: 10
Joined: 10 Mar 2017, 20:25

Send temp value to other ESP before sleep

#1 Post by BounceMeister » 21 Jul 2020, 13:28

I have one ESP with two temp sensors, let's call it "TempEsp". Is sleeps for 10 minutes, wakes for 60 seconds, measures temp, then sleeps again.
Temp sensors are linked to Domoticz through IDX, values showing correctly in Domoticz.

I have another ESP with some pushbuttons and an Oled screen, let's call this "OledEsp". This one never sleeps. I created two dummy variables which should contain values to show on the oled screen.

I want to send the temp values from TempEsp to OledEsp just before TempEsp goes to sleep.

I added these rules to OledEsp:
on remoteTempDisplay do
TaskValueSet 10,1,%eventvalue%
endon

on remoteTempDisplay2 do
TaskValueSet 11,1,%eventvalue%
endon


When i type this to my browser for example:
h t t p://192.168.1.xx/control?cmd=event,remoteTempDisplay2=24
(Where xx is the correct ip.)
It shows "24" on the display of OledEsp.

Now i want this oled screen to show the temperature measured by TempEsp.

I added this this rule to TempEsp:

on System#Sleep do
h t t p://192.168.1.xx/control?cmd=event,remoteTempDisplay=[Temp1#Temperature]
h t t p://192.168.1.xx/control?cmd=event,remoteTempDisplay2=[Temp3#Temperature]
endon

The values are not shown on OledEsp, because http commands like this are not working from rules.
How should i send it, i can't find an explanation about remote events with a value instead of just turning something on or off.

(I added spaces between http to show the entire url on the forum, otherwise it does not show correctly on the forum)

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

Re: Send temp value to other ESP before sleep

#2 Post by TD-er » 21 Jul 2020, 14:56

With taskvalueset, you try to set a value to a dummy task.
So on the OLED ESP you can address this value from almost anywhere referring to it via [taskname#valuename]

So if you make sure to name both the dummy task and the variable, you can refer to them in the display plugin.

For example, two lines I have in my Framed OLED task:

Code: Select all

[test#uptime] mins
[test#freeheap] heap
Here I have the system info plugin named "test" and their respective values are shown including some formatting on the OLED.

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

Re: Send temp value to other ESP before sleep

#3 Post by Ath » 21 Jul 2020, 20:35

You can go 3 ways to have the temperatures sent from the TempEsp to the OLedEsp:
  • Use SendToHttp (the most generic and independent*)
  • Use the Inter-ESPEasy network (the easiest to use*)
  • Use the ESPEasy P2P Networking controller (a bit finicky but quite doable*)
(* that is my opinion, not a verdict)

SendToHttp
The simplest way is to adjust your url's to the SendToHttp syntax:

Code: Select all

SendToHttp,192.168.1.xx,80,'/control?cmd=event,remoteTempDisplay2=[Temp3#Temperature]'
//etc....
(the quotes are required as the url contains commas)

Inter-ESPEasy network
- Configure both your Esp's with a unique Unit Number ( > 0 and < 255) (I tend to use the last part of the ip address)
- Configure both your Esp's with the same UDP Port for the Inter-ESPEasy network on the Advanced Settings page (I use 65500, don't use 8266!)
- Use the SendTo command in your rules on TempEsp:

Code: Select all

SendTo,<OLedEsp's unitnumber>,'event,remoteTempDisplay2=[Temp3#Temperature]'
//etc....
ESPEasy P2P Networking
Most accurate description is here: https://espeasy.readthedocs.io/en/lates ... #c013-page
(haven't used this myself, yet, and I don't like to re-type a chunk of the documentation)

And to complete it all, a link to the command reference: https://espeasy.readthedocs.io/en/lates ... mmand.html
/Ton (PayPal.me)

BounceMeister
Normal user
Posts: 10
Joined: 10 Mar 2017, 20:25

Re: Send temp value to other ESP before sleep

#4 Post by BounceMeister » 21 Jul 2020, 21:30

Ath wrote: 21 Jul 2020, 20:35 You can go 3 ways to have the temperatures sent from the TempEsp to the OLedEsp:
  • Use SendToHttp (the most generic and independent*)
  • Use the Inter-ESPEasy network (the easiest to use*)
  • Use the ESPEasy P2P Networking controller (a bit finicky but quite doable*)
(* that is my opinion, not a verdict)

SendToHttp
The simplest way is to adjust your url's to the SendToHttp syntax:

Code: Select all

SendToHttp,192.168.1.xx,80,'/control?cmd=event,remoteTempDisplay2=[Temp3#Temperature]'
//etc....
(the quotes are required as the url contains commas)

Inter-ESPEasy network
- Configure both your Esp's with a unique Unit Number ( > 0 and < 255) (I tend to use the last part of the ip address)
- Configure both your Esp's with the same UDP Port for the Inter-ESPEasy network on the Advanced Settings page (I use 65500, don't use 8266!)
- Use the SendTo command in your rules on TempEsp:

Code: Select all

SendTo,<OLedEsp's unitnumber>,'event,remoteTempDisplay2=[Temp3#Temperature]'
//etc....
ESPEasy P2P Networking
Most accurate description is here: https://espeasy.readthedocs.io/en/lates ... #c013-page
(haven't used this myself, yet, and I don't like to re-type a chunk of the documentation)

And to complete it all, a link to the command reference: https://espeasy.readthedocs.io/en/lates ... mmand.html
""SendToHttp,192.168.1.xx,80,'/control?cmd=event,remoteTempDisplay2=[Temp3#Temperature]'"
Thanks, that's it!
I was looking on the letscontrolit site, and the commands weren't clear to me.
Thank you for the extensive answer. I might try the other method as well.

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests