IMPORTANT NOTE
THERE'S A NEW PLUGIN TO INTEGRATE AMBIENT WEATHER DEVICES WITH UBIDOTS MORE EASILY.
PLEASE REFER TO "Plugins: Connect Ambient Weather stations and sensors to Ubidots".
The WS-0262A is wireless outdoor thermo-hygrometer that transmits 915 MHz from the outdoor sensor to the console(indoor), which sends real time data to different kind of services letting us monitoring the indoor and outdoor conditions to take decisions in real time.
Following this guide you will be able to integrate the Thermo-Hygrometer with Ubidots cloud in order to keep an eye on the oudoor & indoor conditions, for examples babies room, vacation home, humidors, wine cellars and more.
Requirements
Step-by-Step
Hardware setup
WiFi Setup
Ambient weather & Ubidots Setup
1. Hardware Setup
Outdoor Sensor
1. Remove the battery door on the back of the sensor.
2. Insert 2 x AA batteries.
3. After inserting the batteries, the remote sensor will display temperature and humidity on the console display.
IMPORTANT NOTE: For cold weather climates is recommend lithium batteries, but alkaline batteries are sufficient for most climates.
Indoor Console
1. Connect the display console power jack to AC power adapter with the included power adapter.
2. Remove the battery door on the back of the console, and insert 2xAAA batteries.
3. Wait a couple of minutes for the remoter sensor to synchronize with the display console. Please make sure the remote sensor is powered up and about 5 to 10 feet way while waiting for synchronize.
4. The display console includes a 90 cm dry probe to accurately measure air temperature, since the console generates heat. The probe should not be touching any surface to accurately measure air temperature.
For a detailed documentation about the console buttons operations, lights / snooze mode, plus extra configurations refer to the following link.
With the devices already synchronized, let's connect the indoor console to WiFi to be able to start transmitting the data to Ubidots Cloud.
2. WiFi Setup
IMPORTANT NOTE: The console have to be connected to the AC power, because the WiFi due higher energy requirements.
1. Based on the OS of your cellphone, download the AmbientTool App:
3. Run the AmbientTool application, and select Add Device.
4. Verify if your cellphone is connected to your WiFi network.
5. In the following windows, enter the password for your router, and select Save.
6. If the WiFi icon is not flashing rapidly:
(1) Press and hold the SET and ALARM buttons at the same time for four seconds.
(2) The WiFi icon will begin flashing rapidly, indicating the console is searching for your WiFi network
WiFi icon state
Slow Flash – connected to WiFi but not the Internet
Fast Flash – configure WiFi from AmbientTool application
Solid – Connected to WiFi and the Internet
Not displayed – Not connected to WiFi or Internet
7. Once the console established the connection with your WiFi network, the device MAC address and IP address will be displayed in the app.
8. Compare the MAC address displayed with the one of the console to verify if the device linked is the right one. The MAC address of the console is located in the back side of the device.
9. Refer to the upload panel by clicking the device from the list displayed.
10. In the upload panel you will find the various supported servers like AmbientWeather, Wunderground and WeatherCloud which provides an plug & play pre-built integration.
The purpose of this guide is to provide the conditions variables to Ubidots in order to be able to monitor and make decisions in real time based on those conditions. For that, we are going to update the data in ambientWeather to then post the data in the Ubidots side using the ambientWeather API.
For that, choose ambient Weather between the servers supported.
11. Enter the upload timer desired (1 to 5 minutes) and select the Auto Upload Switch to ON.
3. AmbientWeather Ubidots setup
Go to Ambient Weather to create an account and select Add Device. Then, ingress the MAC address of the console to the empty field where is required:
Once the MAC address is already specified, you should get the successful message below. Then, press Create:
2. Once the console is registered, select the dashboard to view your data updating in the Ambient Weather Side.
3. Go to the account settings you will find the API Keys required to be able to talk with the Ambient Weather API. If the Application Key is not generated, you have to request it through support@ambientweather.com providing the MAC address of the console.
With the keys required already generated, is time to configure the Ubidots account.
4. Ubidots UbiFunction Setup
1. Go to your Ubidots account -> Device Management -> UbiFunction
NOTE: If you cannot see the "Function" module in your account, you will need to enable the add-on for $29/month in the billing section of your account.
2. Click the blue "+" icon in the upper-right corner to create a new function:
3. Assign a name to the Function, e.g. "WS-0262A". Then, assign the POST as the HTTP method.
4. To finish the Function, press the blue button "Make it live". As you will see, the endpoint URL is generated (as is shown below).
5. Copy and paste the code below into the Ubidots Function's code editor. Once pasted, assign your Ubidots Token, WeatherAmbient apiKey and application Key where is indicated in the code below:
var request = require('request-promise');
// Ubidots Access Credentials
var ubidotsToken = 'xxxxxxxxxxxxxxxxxxxxxxxxxx';
// Weather Ambient Access Credentials
var apiKeyWeatherAmbient = 'xxxxxxxxxxxxxxxxxxxxxxxxxx';
var applicationKeyWeatherAmbient = 'xxxxxxxxxxxxxxxxxxxxxxxxxx';
// This function build the HTTP GET request to Weather Ambient
async function weatherAmbientRequest() {
var options = {
url: 'https://api.ambientweather.net/v1/devices?applicationKey=' + applicationKeyWeatherAmbient + '&apiKey=' + apiKeyWeatherAmbient,
json: true
};
return await request.get(options);
}
// This function build the HTTP POST request to Ubidots
async function ubidotsPostRequest(deviceLabel, data) {
var options = {
method: 'POST',
url: 'https://industrial.api.ubidots.com/api/v1.6/devices/' + deviceLabel,
body: data,
json: true,
headers: {
'Content-Type': 'application/json',
'X-Auth-Token': ubidotsToken
}
};
return await request.post(options);
}
async function main(args) {
var waResponse = await weatherAmbientRequest();
var deviceLabel = waResponse[0]['macAddress'];
var waResponse = waResponse[0]['lastData'];
var payload = {
"tempf": waResponse['tempf'],
"humidity": waResponse['humidity'],
"tempinf": waResponse['tempinf'],
"dewPoint": waResponse['dewPoint']
};
await ubidotsPostRequest(deviceLabel, payload);
return {parser_status: "OK"}
}
6. In the runtime select NodeJS as programming language.
7. Now we have to assign how often we desired to trigger the UbiFunction. To do this, active the flag "Time based trigger" and assign the time desired to trigger the function in minutes.
Deactivated:
Activated:
To finish, save the changes by pressing "Make it live"
8. After making the function live, data will being updating in your account at the set interval. To Verify functionality go to Device Management -> Devices and located the new AmbientWeather device created using UbiFunctions.
9. Don't like the MAC address as your device's name in your Ubidots display? Don't worry! You can change the name to a more friendly one, but the device label will be stay as the MAC address to never get confused which device is which. Check out this help center article to better understand Device Labels and Device Names in Ubidots.
10. With the data already in our Ubidots account it's time to create Ubidots Dashboards to visualize and understand your data to make better decisions simply and intelligently.
5. Summary
I just a couple of minutes, you successfully integrated your AmbientWeather sensor to stream live data to Ubidots where the data can go to work in your Ubidots powered App. Now it's time to assemble dashboards and add users who can see and engage with your Apps' data. :)
Other readers have also found useful...