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

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
kenkoknz
Normal user
Posts: 64
Joined: 03 Jul 2018, 23:46
Location: New Zealand

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

#1 Post by kenkoknz » 16 Dec 2018, 11:26

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

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

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

#2 Post by grovkillen » 16 Dec 2018, 11:45

%ip4%
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

kenkoknz
Normal user
Posts: 64
Joined: 03 Jul 2018, 23:46
Location: New Zealand

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

#3 Post by kenkoknz » 16 Dec 2018, 19:40

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

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

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

#4 Post by grovkillen » 16 Dec 2018, 19:53

Merry Christmas! :D
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

kenkoknz
Normal user
Posts: 64
Joined: 03 Jul 2018, 23:46
Location: New Zealand

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

#5 Post by kenkoknz » 16 Dec 2018, 22:35

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,

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

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

#6 Post by grovkillen » 17 Dec 2018, 06:11

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.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

kenkoknz
Normal user
Posts: 64
Joined: 03 Jul 2018, 23:46
Location: New Zealand

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

#7 Post by kenkoknz » 17 Dec 2018, 09:39

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

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

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

#8 Post by grovkillen » 17 Dec 2018, 13:23

Yep, makes sense since you haven't connected to the WiFi until after those 3 seconds.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

kenkoknz
Normal user
Posts: 64
Joined: 03 Jul 2018, 23:46
Location: New Zealand

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

#9 Post by kenkoknz » 17 Dec 2018, 20:40

I was not thinking as fast as you!
Thanks and have a good holiday, you deserve one.

Ken,
NZ

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

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

#10 Post by grovkillen » 17 Dec 2018, 22:11

Thank you! Same to you.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 26 guests