How to reach my IOT device from everywhere without static IP - networking

I am able to access to my IOT device if I assign it a static IP with a service like dydns. But I would like to be able to reach it without relying on something.
I was thinking that my IOT device could ,on every start, write in a database its IP adress so my script on the server knows its ip.
The problem is that the IP will correspond to my hotspot IP. I am missing the connection part "hotspot -->IOT device".
For example I would like to be able to connect my IOT device to my mobile phone in hotspot mode.

One way to do this would be to re-design your system: if when it comes online the IoT device always connects (and stays connected) to a server component (which has a well-known/unchanging hostname/IP address), then the server can always send the IoT device a command over that TCP connection without knowing the hostname/IP address of the IoT device, and without it having to be contactable from the internet, i.e. this approach is firewall-friendly at the device end.
This is how the IoT is architected when using e.g. MQTT: devices connect inwards to the MQTT broker (i.e. server). MQTT also removes the need for the server application itself to need to connect to the clients. MQTT uses a concept called publish/subscribe with pre-agreed 'topics' - the client will subscribe to a 'command' topic, the server app publishes commands to that topic and the broker handles forwarding the command to the device. Incoming data from the device is published to another topic and the server application subscribes to that topic, the broker forwards the published data. You can try pub/sub example (using a browser, but real devices can also connect to the same server) using e.g. http://m2m.demos.ibm.com/utilities.html

Related

Can an already on PC respond to a Wake-on-Lan packet?

Can software respond to a Wake-on-Lan packet, or does it get filtered out by the NIC and/or OS?
My PC receives a Wake-on-Lan packet when one of my devices can't connect to the service it's expecting. If the PC is off, the packet will cause the machine to boot up, as expected. Unfortunately, it's possible (and common) for a PC user to quit the service manually. This leaves the system in a bad state where the machine is on but the service isn't running.
This particular service (Steam Big Picture Mode) doesn't have a 'run as service' option, and doesn't provide any other hooks to start it remotely. I'd like to write some bootstrap code that listens for the WoL packet and launches the service.
I want to honor the user's request to close the service on the host, up until the point that the WoL request is received. Thus, I'd prefer not to write a process that just monitors the service health and re-starts it when it's closed.

Asterisk server connected to ATA adapter needs to be always powered on?

my setup would look like this:
ubunutu linux pc running Asterisk Server
analog phone connected to the VOIP ATA adapter
VOIP ATA adapter connected to Asterisk Server via Ethernet
I have only found information about setting up an extension within the Asterisk Server for the ATA. Here the SIP account for the phone is configured within Asterisk, it becomes clear to me that the Asterisk Server needs to be powered on at all times, otherwise the ATA won't be able to send/receive any phone calls.
My Question
Is it possible to let the ATA adapter store and manage the SIP accounts while the Asterisk Server monitors incoming calls (I need the called id) and also can send a desired phone number to the ATA to initiate an outgoing call. With this even if the Asterisk Server is powered down the user still is able to make/receive calls via the ATA adapter using the analog phone. If this is possible, could you please give me a reference or hint how to setup the Asterisk extension for this situation?
If you have linksys adapters, you can create dialplan on adapters to callout directly other adapter(with static ip) in case if server is down.
On most adapters you can use backup proxy if primary proxy failed
Thats all.
In most case if your server is down, you have no phone service

Networking: How do wifi enabled IoT products allow remote access?

I have been looking for an answer to this problem, but I cannot find what I am looking for. I think, perhaps, it is because I lack the knowledge to ask the question in meaningful way.
I have been learning a lot about remote access to devices at home. I know that ISP's change public IP addresses regularly (dynamic IP address). I know that to get around this, one could use a service like "no-ip", etc. Or one could get a static IP address.
What I do not understand is how some of the latest home automation devices are able to be controlled remotely without use of a static IP, or a service like "no-ip". For example, a wifi enabled thermostat, or lighting system.
If the device had a built in server, or client, then I assume that the device could connect to an outside server in a remote location. The user could then also log into that server and send commands to the device. What I don't understand is how commands sent to the device from a cell phone, for example, can reach the home device. Presumably the off site location of the server would have to know the public IP address where the devise is located, and then port-forwarding would have to be set up to allow access to the device.
What am I missing here? Is it possible to create a homemade wifi enabled thermostat, webcam, or other device without using port-forwarding, no-ip, or a static IP?
Well, there are several ways to bypass the inbound connection constraint of NAT protocol. Such as:
A virtual adapter on the device configured to a VPN server that has an inbound port open ready to transfer data. Various open source solutions such as openVPN are considered as great examples for this service over IOT boards like Raspberry Pi, Beagle Bone, etc. These are used as gateways often. Further, they communicate with the microcontrollers over popular IOT protocols such as MQTT, COAP, etc.
Another solution is to create a port forwarding tunnel, since the router won't block the outbound connection. There are various tunneling services that are availble such as localtunnel, ngrok, etc. You could also use a cloud server that has a public IP such as AWS, DigitalOcean, etc. Again as above mentioned point, they can be implemented in the gateways.
Some devices "phone home" to a server so that there are ports open between them and the servers, and the mobile apps just contact the servers. This is the same way your web browser can receive web pages from a web server. If you have a NAT router, the router must open a port from the inside device to the outside server. This is maintained in a NAT table with expiration timers for UDP and session monitoring for TCP.

Finding IP of device over GPRS/GSM

I am currently working on a hobby project where I am using a PIC controller and a sim900 modem for remote monitoring, over a GPRS connection.
I can upload data from my remote device on to the server in regular intervals.
Now I would like to send some control signals to the device from the server, but how do I find which device to send data to? I need to know the IP address of the device which is assigned dynamically.
Is there a static IP on GSM modem, or can anyone please suggest a solution for this?
You need to contact your service provider(SIM card providers) to assign a static IP for your SIM card.
Other option is you have to develop a simple application layer protocol for data transfer over TCP/UDP in which once the connection is established your modem should send its identity(Name/ID etc.)
On the server side you need to write the code in which you have to maintain a dynamic table of modem details and socket number. When the modem is connected you can send data over the same socket for control commands.

Send data to IoT device on home network from remote server

To stop an internet connected device (lets say it's an internet connected thermostat) from having to poll the remote server all the time to see if the user has changed its settings how would a server send data to that device when needed? I understand how to initiate a connection from the internet connected device, just not the other way round.
It's safe to assume that the device would have already registered it's details with the server in some kind of set up process initiated by the device.
Check out SignalR, in these links:
http://signalr.net/
http://www.asp.net/signalr
http://www.codeproject.com/Tips/590660/Introduction-to-SignalR
HTH

Resources