need2know
need2know

Reputation: 9

How to get public IP of a Tasmota device without display?

I'm trying to determine the public IP address of a TASMOTA Smart PlugIn. I can send a request from the device to a corresponding website (e.g. www.ipchicken.com), but the TASMOTA does not have a screen. So the address is known, but i can't see it. Is there a way to have the IP sent to the caller via GET or Email or whatever? Unfortunately I can't find out about it via the router.

Thank you for any idea

Upvotes: 0

Views: 151

Answers (2)

Ellery
Ellery

Reputation: 51

Assuming that you want to know the external IP of your network you should make your tasmota device visit an external service (i.e. https://api.ipify.org/ ), you can than put the answer into a variable and send an email with this value.

script example (not tested)

>D 15
ip=""
day1=0
to="<[email protected]>"

>BS
WebQuery https://api.ipify.org/ GET

>E
ip=WebQuery

>S
print %ip%

; send at midnight
day1=day
if chg[day1]>0
then
=>sendmail [*:*:*:*:*:%to%:external IP]*
endif

>m
your external ip is %ip%
#

Firmware should have scripting functionality enabled and at least following defines:

USE_WEBSEND_RESPONSE
USE_SENDMAIL

The following parameters can be specified during compilation via #define directives in user_config_override.h:

- EMAIL_SERVER
- EMAIL_PORT
- EMAIL_USER
- EMAIL_PASSWORD
- EMAIL_FROM

Upvotes: 0

need2know
need2know

Reputation: 9

I used the WebSend-Command of TASMOTA und called a PHP-Skript which writes the $_SERVER in a file. So i can read the IP-Adress. Unfortunately, my router should be able to do port forwarding. So the IP is of no use to me. But that is another topic.

The qestion ist solved.

Upvotes: 1

Related Questions