Thingsboard, Posting Data to Two Seperate Devices From One Physical Node(ESP8266/32) - mqtt

I want to post data to 2 different devices from same esp32. And I want to do it like posting all the data to one device and sharing its telemetries with the second device. Is that possible on thingsboard?
I achieved this via ESP32 but when I am posting data with two different token, I need to cut the wifi and reconnect the Thingsboard with the other devices token. This situation contributes to enormous battery consumption. When I examine the thingsboard library I could not see a function about cutting the network only with thingsboard. What can be done to overcome this situation?
Any idea will be appreciated.
Thanks

One way I could think of, would be using ThingsBoard Integrations. Where one input payload can have multiple outgoing payloads (works even for multiple target devices or assets):
https://thingsboard.io/docs/user-guide/integrations/#converter-output
But this requires ThingsBoard PE & an external MQTT Broker in between your ESP32 & TB.
Or you could try the MQTT Gateway API:
https://thingsboard.io/docs/reference/gateway-mqtt-api/

Related

How to select APN automatically in SIM800L GPRS module interfacing with ESP32

I have been working on a SIM800L GPRS module with ESP32. My purpose is to post data to a IoT platform using GPRS. I'm using sim800l library.
Here in the code i want to provide apn manually like this,
const char APN[] = "airtelgprs.com";
is there any possible method to assign apn automatically?
It's possible, but not simple. There are people who maintain a public database of network providers in the world and their access points: Service Provider Database. Upon logging into a GSM network you can choose the correct APN based on the MCC and MNC of what your GSM module is reporting. It's not entirely trivial, as the database file is over 341 KiB (but it's XML, so lots of redundancy).
The most annoying factor is that there are entries with different APNs, but same combination of MCC and MNC. This means there are networks with look exactly the same to the GSM module, but use different APNs. In such case you cannot automatically choose an APN and expect it to work. Either the user would have to choose between the alternative APNs or you'd have to try them out one by one until you succeed in connecting to the Internet.

IoT devices in pcap files

I'm doing some network research, I want to find all the IoT devices (or at least devices that could be IoT) from .pcap files. Do IoT devices have some unique traffic characteristics, traffic pattern or identification (eg. protocols, ports, etc)? I can't find the answer. IoT devices are relatively new so there is not that much documentation about it.
Thanks!
This is an active area of research and may require some sort of ML algorithm. We (3 students at UC Berkeley) are also looking into it. Do you have any pcaps you can share?
There are many characteristics, but because this is a new field with insufficient standardization - there is no solution to find all devices, and you will have to use several different methods.
Watch the protocol - some devices use niche protocols that single them out (like SIP for VOIP devices)
Watch the urls devices are looking for via DNS - since most iot devices are not directly human controlled like normal computers, their communication is rather unique per device. They will contact the site of their vendors for updates, send and receive data that directly relates to their function and won't have much variance in their behavior.
Watch for service discovery protocols. Many protocols include the service that the device gives as field. Read about ssdp and mdns.
There are many more complex ways of using the fact that most of the communication is pre-defined. Devices have unique patterns of communication - like specific times between requests for example.
There really isn't. It's an internet device after all, and the manufacturer and the user through configuration will define its traffic pattern.
That said, there will be a traffic pattern for a particular type of IoT devices. Sine IoT devices always phones home for legit reasons, you can probably find your device types by the servers they connect to, and use that to refine your statistics/ML algorithm.
Now on a tangent, a lot of IoT devices (medical devices, OnStar, Tesla and etc) use cellular networks, both for mobility and for reliability. There are a set of protocols that show a lot more information.

send a word device to device on wifi direct android using a service

We required to send a word from one mobile device to another using wifi-direct. The wifi-direct, wifi-discoveryservice samples given in android sdk shows its usage with MainActivity. As we have app with multiple activities and from selected activities we need to send particular word to another device on wifi, we are looking for a simple 'SendWordWiFiService' approach.
Any related input in this regard is awaited. We are struggling for last 1 week trying to implement wifi-direct, wifi-discoveryservice in a project having multiple activities. But no success.
You need to use Sockets. If you haven't done them before, I suggest reading this as it got me started. Additionally you might find Oracle's documentation to be useful. In particular, you may want to read up on of using threads to run server sockets.
The steps you need to take are:
Discover peers using Wi-Fi Direct
Make a peer connection between decies (NB: Be mindful of who the group owner is once this is done, if you're application needs to differentiate between a group owner and a group client(s)).
Once the peer connection is made, sockets can be set up between the peers for the transfer of data streams, ie sending words in your case. You might find it most logical to set your Wi-Fi Direct GroupOwner as the server socket, and your GroupClient devices as a client which connects to the server.
I hope that helps.

How to send a small amount of data to a large amount of iPhones

What kind of protocols can I use to send data from a server (php) to iPhones?
I ruled out UDP because on cellular, iPhones don't keep any ports open for outside communication (for obvious reasons). And TCP is too data hungry. I'm trying to find an in between that uses minimal data and doesn't tax infrastructure.
I'm first doing an API call to get information - then at this point, I want the iPhones to "listen" for data. Then my server will send data to all the phones that are listening.
Any thoughts on how to go about doing this? Or is this kind of connection impossible?
As discussed in the comments, one solution is to use the Apple Push Notifications Service.
More info here:
http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html
http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html

How do I communicate between devices connected to a WiFi Access Point?

I have got a couple of phones and another couple of PC's connected to a Wifi access point and need to send and receive messages between either of these, I mean anyone can send a message to anyone and receive a message from anyone.
I am willing to write apps on the phones(Symbian OS, S60 platform) or PC(Windows), but what I can't understand is how do I set up a client or server, since any one of these devices could be a client or server.
If I use sockets do I have to script for ServerSockets and also Sockets on each of these devices? Can I use the HTTP protocol?
Alternatively any standard protocol that I could use to implement this?
You would broadcast UDP packets which would arrive at every device on the Wifi network. You would have to invent your own protocol to decide on the identity of each device, since you wouldn't be able to easily infer the IP addresses of your network devices. Without writing an election algorithm you would find it difficult to use a client/server architecture, so just use point-to-point (P2P).
Google for UDP broadcasts and read the relevant RFCs at ietf.org.
It seems like you're looking for pretty typical peer-to-peer communication over IP. I suppose other requirements will dictate which transport you use (HTTP, raw sockets, etc), but yes: Each node will be both a client and a server. You could possibly use MDNS (http://www.multicastdns.org/) to help the nodes find eachother in an ad-hoc manner.

Resources