system variable after boot
Moderators: grovkillen, Stuntteam, TD-er
system variable after boot
Hi,
beg this has been answered somewhere .. but I don't find it and I also don't get it solved ..
When (re)booting my device, system variables as e.g. %ip% or the fourth octet of Devices -> System Info -> IP does not seem to be loaded.
Looks like that takes some time?
How can I have my ESP wait for a state where all variables are loaded and available correctly?
I'm running ESP_Easy_mega_20211105_normal_WROOM02_2M256 on this device.
Thanks for your help
beg this has been answered somewhere .. but I don't find it and I also don't get it solved ..
When (re)booting my device, system variables as e.g. %ip% or the fourth octet of Devices -> System Info -> IP does not seem to be loaded.
Looks like that takes some time?
How can I have my ESP wait for a state where all variables are loaded and available correctly?
I'm running ESP_Easy_mega_20211105_normal_WROOM02_2M256 on this device.
Thanks for your help
Re: system variable after boot
After event "Wifi#Connected" the network interface, including IP address, will be initialized properly, so after that you can use those values.
All System events can be found on this documentation page: https://espeasy.readthedocs.io/en/lates ... Rules.html
All System events can be found on this documentation page: https://espeasy.readthedocs.io/en/lates ... Rules.html
/Ton (PayPal.me)
Re: system variable after boot
To be slightly more specific with the link to the events: https://espeasy.readthedocs.io/en/lates ... ore-events
But Ton's link may provide more examples.
Better read both
But Ton's link may provide more examples.
Better read both
Re: system variable after boot
Thanks for your posts.
Meanwhile I believe it's due to the standard 60sec in the Device's-tab for this item - although I thought it might set the values first and THEN run down the counter to update them 60seconds later
Meanwhile I believe it's due to the standard 60sec in the Device's-tab for this item - although I thought it might set the values first and THEN run down the counter to update them 60seconds later
- Attachments
-
- delayDevices.png (22.12 KiB) Viewed 5930 times
Re: system variable after boot
Not sure if your conclusion is correct, or not all is clear to me
The sysinfo task may report wrong info on its first call, as that's done before WiFi is initialized.
So you may want to call taskrun on that task as soon as you see the WiFi#Connected event.
The sysinfo task may report wrong info on its first call, as that's done before WiFi is initialized.
So you may want to call taskrun on that task as soon as you see the WiFi#Connected event.
Re: system variable after boot
hmm, getting lost even more ..
What I'm trying to do: setting up three devices (two differing, two identical ones) using the same rules for all three. I'd like to differentiate the devices by their fixed ip addresses.
But it reaches the wrong section ..
Tools -> System variables is showing the correct ip address
it hence should perform statements in [1] but it executes the [3] part that's meant for a differing ip address.
The commands in the if statements are pretty plain ones, e.g.
What am I doing wrong?
P.S.: taskrun is working fine, but maybe not the solution to my problem
What I'm trying to do: setting up three devices (two differing, two identical ones) using the same rules for all three. I'd like to differentiate the devices by their fixed ip addresses.
Code: Select all
on System#Boot do
TaskValueSet 6,2, 74 // identical setting regardless of device
endon
on WiFi#Connected do
taskrun,12 // initialize 4th ip octet
if %ip% = 192.168.178.52
// do [1]
endif
if %ip% = 192.168.178.61
// do [2]
endif
if %ip% = 192.168.178.46
// do [3]
endif
endon
Tools -> System variables is showing the correct ip address
Code: Select all
%ip% 192.168.178.52
The commands in the if statements are pretty plain ones, e.g.
Code: Select all
gpio, 4,0
P.S.: taskrun is working fine, but maybe not the solution to my problem
Re: system variable after boot
This is not going to work:
The IP-address may be parsed into a floating point value 192.168
Not sure if it will evaluate to true, but if it does, then it does it probably for all your nodes.
Just assuming you have a "class C" network (subnet = 255.255.255.0) then you could compare the last part of the IP:
The sysinfo task is not responsible for the system variables to be initialized.
Code: Select all
if %ip% = 192.168.178.52
Not sure if it will evaluate to true, but if it does, then it does it probably for all your nodes.
Just assuming you have a "class C" network (subnet = 255.255.255.0) then you could compare the last part of the IP:
Code: Select all
on System#Boot do
TaskValueSet 6,2, 74 // identical setting regardless of device
endon
on WiFi#Connected do
taskrun,12 // initialize 4th ip octet
if %ip4% = 52
// do [1]
endif
if %ip4% = 61
// do [2]
endif
if %ip4% = 46
// do [3]
endif
endon
Re: system variable after boot
in the afterglow this makes sense.This is not going to work:
if %ip% = 192.168.178.52
Pity, I had chosen a test before that worked .. for the last !! of the three devices (can I call this 'worked', hmm )
Thanks so much. Cheers
Who is online
Users browsing this forum: Ahrefs [Bot], uah007 and 53 guests