So you want to build a "thing" to be part of the internet of things?
It's a great project... but there are a number of "bits" to get right. And until they are all pretty good, it is hard to know which bit isn't working.
Hint: Start with a "thing" that is only on your LAN. Everything to accomplish that is necessary to the wider goal of a thing on the internet of things. And you'll have some of "the bits" working, so what ISN'T working is easier to diagnose, as you go foward to the next objective.
I have guidance on setting up some Arduinos on the internet. You can access at least one of them at any time. (Which one(s) changes from day to day!)
If interested in copying what I have done, go to my site http://Arduserver.com On pages you can go to via links from there is all the code for various things, including Arduinos which will respond to the browser you are using right now, and tell you what sensors connected to those Arduinos "see". Furthermore, there is an output on the Arduino which you can control, again, from your browser. There are two buttons on the page you'll get from the Arduino. "Turn LED on" and "Turn LED off".
If you can read sensors on a remote Arduino, and change the state of pins on it, what CAN'T you do in the world of the "interent of things"?