Page 1 of 1

how to extract only the last 3 digits of %ip%

Posted: 16 Dec 2018, 11:26
by kenkoknz
Hi,
What is the easiest way to extract the last 3 digits of %ip%? (so I can display in a 4 digit 7seg led)
Thanks
Ken

Re: how to extract only the last 3 digits of %ip%

Posted: 16 Dec 2018, 11:45
by grovkillen
%ip4%

Re: how to extract only the last 3 digits of %ip%

Posted: 16 Dec 2018, 19:40
by kenkoknz
Hi @grovkillen,

Must be magic, it just works, so simple! I was thinking something complex like putting it in as a variable and using substrings, mid functions in rules (if espeasy has those functions).

Now I can have low costs tm1637 in all my espeasy to show the ip without having to use fing or interrogate the router.

What other magic tricks you have?

Merry Christmas and Happy New Year to you and all in the forum!
Thanks,
Ken

Re: how to extract only the last 3 digits of %ip%

Posted: 16 Dec 2018, 19:53
by grovkillen
Merry Christmas! :D

Re: how to extract only the last 3 digits of %ip%

Posted: 16 Dec 2018, 22:35
by kenkoknz
Hi,
Works when I type the the cmd 7dn,%ip4% on the web interface, however with the rule it does not work:

on system#boot do
Pulse,2,0,1000
7dn,%ip4%
endon

The idea is of course to display the last ip oclet on start. Am I missing something?

Environment:
Unit: 5
GIT version: mega-20181216
Local Time: 2018-12-17 09:33:15
Uptime: 0 days 0 hours 6 minutes
Load: 14.90% (LC=6706)
Free Mem: 7592 (6184 - sendContentBlocking)
Free Stack: 3584 (1732 - parseTemplate3)
IP: 192.168.20.112
Wifi RSSI: -64 dB (hg566)

HW: Wemos d1 mini

Thanks,

Re: how to extract only the last 3 digits of %ip%

Posted: 17 Dec 2018, 06:11
by grovkillen
Just as a test, try to have a timer in the boot event block that is set to 10 seconds. When the timer run out, set the text. It could be that the system variable is not set at the boot event.

Re: how to extract only the last 3 digits of %ip%

Posted: 17 Dec 2018, 09:39
by kenkoknz
Yep works with a timer delay, got it down to timer delay of 3 sec or more works, but under 3 secs does not work.
Thanks

Re: how to extract only the last 3 digits of %ip%

Posted: 17 Dec 2018, 13:23
by grovkillen
Yep, makes sense since you haven't connected to the WiFi until after those 3 seconds.

Re: how to extract only the last 3 digits of %ip%

Posted: 17 Dec 2018, 20:40
by kenkoknz
I was not thinking as fast as you!
Thanks and have a good holiday, you deserve one.

Ken,
NZ

Re: how to extract only the last 3 digits of %ip%

Posted: 17 Dec 2018, 22:11
by grovkillen
Thank you! Same to you.