Code to check WAN IP and execute code


Noob here, and looking for the easy way out :slight_smile:

I need to create a scene than runs at certain intervals which can poll my WAN IP, check it against a string, and then execute an http command if true (or false).


Find “WAN_IP” via external service (ie “”)

If “WAN_IP” contains “*” then “http://x.x.x.x/command.cgi?user=admin&passwd=1234&device=0&command=1

Can someone help me out with the lua code?

Thanks in advance.

Edited to add: more precisely, I want to compare against my WAN hostname.