Connecting Android device sensors with NodeRED - node.js

I am new bee to NodeRED. I refer tutorial on NodeRED connecting devices such as raspberry PI. The partial documentation on NodeRED Website is available that states that how developers can reads sensors connected to GPIO pins on Raspberry PI.
Similar way, I would like to know - how can I read sensors (e.g., proximity sensors, GPS, Accelerometer) on Android device with NodeRED? More specifically, I would like to play with Android device sensors with NodeRED? I have tried to google documentations related to it, but did not find it.

You will need to write an Android app to expose the sensors in a way that can be ingested into Node-RED, I would suggest publishing the values to a MQTT broker.
Node-RED can then subscribe to the topics and process the sensor values.

write an android app, that will expose the android sensor.
either push the data from Android to MQTT server (best choice) or use a microservice like AWS lamda or Firebase .
if used pub-sub with MQTT call it on Node-red, or call Lamda function Api endpoint on node-red or call the firebase directly on Node-red,
choose wisely according to your requirements.

Related

Connecting to a custom device via Bluetooth when its SDK is unavailable

I am building an Android app in which I need to connect to an custom device over classic Bluetooth (preferably). My problem is SDK for that device is not created to facilitate the connection. Now I am stuck onto the part where I need to create a Socket which will be opened by the custom device which is acting as a server and other Android devices will act as clients and connect to it.
I am stuck at the part where we need to have identical UUIDs at both client and server for the socket connection to work. I am following the BleutoothChatApp as reference for this but I cannot always make sure that both my app and custom device will have identical UUIDs. Because I may or may not be able to hard code the UUID in custom device.
What can I do in such case.?
Also when I try to use BLE and search for services, I discover only one service which has no description or anything.
What can I do in such cases. What will be the best approach to create a connection to that device.?
You get multiple UUIDs for the same device because the devices offer multiple services. Base UUID for Bluetooth is "00000000-0000-1000-8000-00805F9B34FB".
If you find this UUID in a device, it means it supports Bluetooth Service. Use the UUID for connecting to the device.

Integrating HomeKit devices with Node-RED

node-red-contrib-homekit is a slick way to create virtual HomeKit devices in Node-RED, providing a bridge to non-HomeKit-aware hardware.
When it is time for my Node-RED flows to talk to real HomeKit devices, however, it seems to get messy.
To control a HomeKit device (thermostat, outlet, bulb, occupancy sensor, etc.) from a Node-RED flow, the most elegant solution I know of is to install Homebridge and something like homebridge-mqtt alongside Node-RED, which feels to me like a big, awkward hammer.
I feel like I'm missing something--is there a more direct approach? Or am I doing it in an advisable way?
As far as I know, there is no way to talk from Node-RED to HomeKit enabled devices using the HomeKit protocol. Apple only publish the specs for client devices and services, but the HomeKit server, and therefore UI, can only be iOS device. You can think of HomeKit as the Apple alternative to Node-RED. And the control can only be one way - from Homekit to Node-RED. You can make the data flow both ways though. For instance you can create virtual HomeKit switch in Node-RED, that the Home app can control using automation (like turning on when you're home). Thus you can have binary communication between them.
The protocol actually specifies a set of predefined accessories with their options and capabilities, and each manufacturer should provide API for the selected accessory. One physical device can have multiple virtual accessories - like temp and humidity sensors, that are shown as two items in Home app, but might be one actual device.
You need to use your iPhone/iPad to add and control the bridge/accessories, that you can create in Node-RED or are licensed HomeKit devices. But they are not able to talk to each other using that protocol. You'd have to find alternative way for doing this by looking for another API by the manufacturer. For instance Hue is certified as HomeKit and you can add it to your Home app directly, but if you want to control it with Node-RED you'd need their other API as the HomeKit server is proprietary.
Also for Node-RED use the updated node-red-contrib-homekit-bridged that can simplify your management.
I’m in the process of changing my setup from the node-red Homekit node to a separate Homebridge with the MQTT plugin myself. Not only because it is more elegant but also more flexible HomeKit-wise, provides a “separation of concerns” between processes running, and also let’s me just add one bridge to Home app.
There’s also a websocket plugin for Homebridge which also plays nice with node-red but as I have a mosquitto MQTT broker running anyway I might as well use the “language of IoT”.
I am in the process of connecting Homekit related devices and services with Node-RED using Homebridge. Both Homebridge and Node-RED can be installed on the same machine (a Pi).
There are several plugins available to connect Homebridge with Node-RED and maybe you can create a flow that then controls your devices for which you also have to find a plugin in Node-RED. It may be a bit over engineered as there are tons of plugins available for Homebridge directly but using Node-RED is much more fun. The MQTT way is also a good start but I didn't want to mess with protocols and stuff.

Parse Arduino Uno data directly to IoT

I'm making a temperature, humidity and moisture sensor system where data should be sent over to Iot hub (Cloud) every second. I have used an Arduino and Ethernet shield.
I'm able to create sensor data every second. It sends this data to the IoT hub directly from Arduino without a Raspberry Pi or PC|VS Studio. I have already created a job stream on Azure as well. Is there any mechanism with which I could send this data to Azure IoT hub directly? Thanks in advance.
You can look at the libraries for IoT Hub here:
Azure IOT SDK for C
A Quick search on the Arduino site also contains lots of examples of devices connecting to the IoT hub. I imagine you can use both AMQP and also MQTT protocols for this directly from your Arduino. I'm using MQTT in my ESP8266's without VS involved, all written in the Arduino IDE.
You can also find the Azure IoT Arduino libraries here.
Note that required libs (AzureIoTHub, AzureIoTUtility, AzureIoTProtocol_HTTP and AzureIoTProtocol_MQTT) are all published in the Arduino IDE lib manager, so you can just install them from there (no need to clone the repos).
The docs and the samples are not quite up to date (which we'll fix real soon) but you can find an MQTT sample in the MQTT lib repository.

Azure Event Hubs C Client

I am trying to send messages to Azure Event Hubs from an Arduino with a Wifi extension. Is there a way to upload the data without using the provided libraries?
You will need some kind of device to act as a gateway. The Adruino board cannot provide this functionality. Most likely, you will need to connect the device to a Raspberry Pi and send the messages using the Pi. Below is directions and code on how to set this up.
https://github.com/MSOpenTech/connectthedots

nodejs IoT device to device communication

so im working on a my bachelor thesis and for that i need to implement, in a smarthome, d2d communication between IoT devices. So i want to implement the usuall server work, like noticing if a device connects/ disconnects etc. to the IoT devices, so no server/hub is needed at home.
But I can't find good solutions for it, for websockets i need a server, for mqtt a broker and so on, but all need a server.
I found that d2d is done with "LTE" similar technology but i would like to do it with web-protocols.
So my question:
Is there a way to let IoT devices talk to each other over the network?
My IoT devices (raspberry pis) currently use nodejs with typescript but I'm not starting a server, they only have a mqtt connection to publish there sensor data to the users.
Thanks in advance.
And if im understanding something wrong, please say it. :)

Resources