Monthly Archives: April, 2017

Create Your First IoT Application by Connecting Raspberry Pi to FAVORIOT Platform

April 30th, 2017 Posted by IOT PLATFORM, TIPS 0 thoughts on “Create Your First IoT Application by Connecting Raspberry Pi to FAVORIOT Platform”

Magazine Favoriot-9.pngThis section provides tutorials on connecting Raspberry Pi to FAVORIOT platform.

code for creating a data stream

import requests
import json

url = ""
payload = json.dumps({
  "device_developer_id": "deviceDefault@favoriot.iot",
  "data": {"temp":"14"}
headers = {
    "apikey": "YOUR API KEY HERE",
    "content-type": "application/json",
    "cache-control": "no-cache",

response = requests.request("POST", url, headers=headers, data=payload)
parsed = json.loads(response.text)
print json.dumps(parsed, indent=4, sort_keys=True)

code for getting all data stream

import requests
import json

url = ""
headers = {
    "apikey": "YOUR API KEY HERE",
    "content-type": "application/json",
    "cache-control": "no-cache"
response = requests.request("GET", url, headers=headers)
parsed = json.loads(response.text)
print json.dumps(parsed, indent=4, sort_keys=True)

Raspbian comes preloaded with Python, the official programming language of the Raspberry Pi and IDLE 3, a Python Integrated Development Environment. We’re going to show you now how to get started with Raspberry Pi using Python to connect to our FAVORIOT platform.

You can use Raspberry Pi as IoT device by connecting sensors to it, or it can be used as IoT Gateway.

Replace the indevice_developer_id in the payload with your device name. Follow the syntax as given inside the payload.

import request is used to enable HTTPrequest from python. You install this library by running the command pip install request in the terminal.

import json is used to format the JSON response received from FAVORIOT and prepare the JSON data to be sent to the FAVORIOT platform.

If you are interested in becoming a Beta Developer, please send email to

If you are having trouble with connecting your device to our platform please contact us at

Full documentation and technical tutorial – HERE.

Introduction to FAVORIOT Middleware Platform

April 30th, 2017 Posted by IOT PLATFORM, TIPS 19 thoughts on “Introduction to FAVORIOT Middleware Platform”


Internet of Things development is a complex effort. It will be a long journey job and time consuming if one have to develop it from scratch. IoT Middleware platforms offer a jumping-off point by combining many of the tools needed to manage a deployment of device management to data consumption into one service.

FAVORIOT is a middleware platform specifically designed for any the Internet of Things (IoT) and Machine to Machine (M2M) project. The platform is developed to support the integration of data from several sensors and actuators into the internet. Collecting and storing data from IOT devices become much easier. Moreover, the platform also helps developers in building vertical applications. By using the platform, the developer does not need to worry about hosting.

FAVORIOT enables the devices to push the data to the FAVORIOT middleware platform using its REST API. The external application can also pull the data from FAVORIOT middleware platform using REST API.

Components of FAVORIOT

Favoriot building block
Figure 1:  The Building Blocks of FAVORIOT Middleware Platform

As shown in figure 1 above, the FAVORIOT IOT Middleware consists of several building blocks:

  • Device Connectivity – Brings different protocols and different data format into one Application Programming Interface (API) ensuring accurate data streaming and interaction with all devices.
  • Device Management – To ensures the connected “things” are working properly. We create the abstraction of the physical devices in IOT realms within the IOT middleware
  • Scalable Database – Scalable storage of device data brings the requirements for hybrid cloud-based databases to a new level in terms of data volume, variety, velocity and veracity
  • Business Logic – Brings data to life with rule-based event-action-triggers.
  • Notification Engine – Combining business logic with notification engine enable execution of “smart” actions based on specific sensor data.
  • Dashboarding – Enables users to see patterns and observe trends from visualization dashboards where data is vividly portrayed through various type of charts.
  • Application Integration Interface – APIs that act as interfaces for third party systems.
  • Security Modul – All interaction with the IOT Middleware are secured via HTTP/TLS protocol.

How Does it Work?

Figure 2:  The role of FAVORIOT IOT Middleware in an IOT Project

  • Connect Your IOT Device
    • Connect any type of device (Arduino, Raspberry Pi, Libelium)
    • And start your Internet of Things project with FAVORIOT middleware
  • Collecting Data
    • User our HTTP RESTful API to push JSON data generated by your device
    • Simple Data Structure
    • Secure: API Keys and HTTPS Connection
    • We store your data in our Scalable Big Data Storage.
  • Manage Devices and Data
    • Interact with your devices and data from FAVORIOT middleware.
    • Define your business logic through our RULE-BASED Engine.
    • Set Notification Action upon defining business logic.
  • Build your Application
    • Consume your data within FAVORIOT Platform using HTTPS PULL API.
    • Build your Own Application based on data pull from FAVORIOT (Visualization, Dashboarding, etc.).
    • Focus on your apps and let us carry the systems, security, and communications
    • Save development time
    • Let us take care of IT infrastructure cost, problems, and scalability for your IOT Project.

FAVORIOT Hierarchy

The device is a central entity in FAVORIOT. It is used to represent the physical devices in IOT realms within the IOT middleware. Hence the data from produced by devices can be aggregated easily. However, in FAVORIOT, IOT device and its data are managed and structured hierarchically.

  • Hierarchically, Entities such as Project, Application, Groups are used to group and structure the devices.
  • Data is associated with the stream/information produced by physical devices.
  • Rules can be defined to perform a certain action to events that raises in a device.

UTM’s Home Energy Management System (HEMS) Will Be Using FAVORIOT

April 27th, 2017 Posted by SMARTCITY 0 thoughts on “UTM’s Home Energy Management System (HEMS) Will Be Using FAVORIOT”

Home Energy Management System (HEMS)

A team of researchers from ATT, UTM led by Dr. Rozeha A.Rashid together with Dr. Mohd Adib Sarijari, Muhammad Rezan Resat, Abdul Hadi Fikri Abdul Hamid, Nur Hija Mahalin, Mohd Shahril Abdullah, Mohd Rozaini Abd Rahim and Hamdan Sayuti wanted to realize the Smart Grid vision through their project called Home Energy Management System (HEMS). They have developed the initial prototype on a different server but finally decided to migrate to a more powerful platform IoT platform from FAVORIOT.

The synopsis of their project as shown below.


Electricity is named as the greatest invention of the 20th-century engineering achievements by the United States’ National Academy of Engineering. It has been recognized as a critical ingredient for the economy growth of a country. It is predicted that the world’s electric energy consumption will be significantly increased from years to years. According to the United States Army Corps of Engineers, the worldwide energy consumption is going to increase 60% by 2030 and might be triple by 2050. Furthermore, according to the United States Energy Information Administration, the electric energy generation is projected to be as high as 35.2 trillion kWh in 2035 which is an increase of 62.1% from the year 2008.


Figure 1.0 Internet of Things (IoT) based HEMS

Domestic housing is identified as one of the major contributors to energy consumption. Therefore, a home energy management system (HEMS) offers a meaningful solution for homeowners to efficiently monitor and reduce their utility costs, of which is a big environmental bonus as well (i.e., fewer carbon emissions). Internet-of-Things (IoT) offers interconnection of home appliances with the owner as well as the utility companies through the internet so that the devices could be monitored and controlled from anywhere and at any time, as shown in Figure 1.

A forecast by Navigant Research reported that worldwide spending on energy management systems and services, including software components, will grow double from $11.3 billion in 2013 to $22.4 billion in 2020, with a compound annual growth rate of 10.3%. A global 2012 survey of 3,500 owners found that about 46 percent of respondents in the US and Canada plan to increase spending on energy-efficiency improvements.

Home Energy Management System (HEMS) Prototype

In this prototype system, three categories of energy billing are made available for the user to make a choice of according to their affordability.  For example, Category A is for monthly billing limit of RM40, Category B is for monthly billing limit of RM70 and Category C is open for customized setting.  Every category will have a different way of controlling the appliances to achieve the target power consumption within the set limit of monthly billing.

There are three modes for HEMS; mode A, mode B and mode C which directly correspond to the billing’s categories.  These modes are for controlling the usage of the appliances in HEMS depending on the respective chosen category.  If the set energy bill is high, then the allowable usage is also high and vice versa.

There are three important features implemented in the design HEMS to achieve an effective energy management monitoring and control according to the user’s preferred settings.  The features of the HEMS software solution are further explained in the following:

Demand Response (DR)

This feature allows for the appliances to be operated according to OFF/ON peak hour.  On peak hour is defined as the time of the day when the utility price is the highest.  Contrarily, the off peak hour is the time of the day when the utility charges are the lowest.  Additionally, this feature also enables minimized use of high-powered appliances such as washing machine, iron and kettle to a few times a day based on the chosen category of energy billing.

For example, a washing machine will be allowed for operation once or twice a day if category A or B of energy billing is selected respectively.  If the user wants more use than what is allowable, the system will turn off the washing machine and send a reminder to the user.  In short, this feature enforces the user to be more discipline in order to reduce their power usage.  The user can exclude the application of this feature from high-powered appliances such as the refrigerator as it needs to be powered up all the time.

Home automation

This feature facilitates the appliances controls for power saving according to the time of the day.  The hours are divided based on whether it’s night time when the ambiance is cooler but darker and vice versa for day time.  The time division is presented in Table 1.  A reset button is also made available for the user to manually override the setting if necessary.

Table 3: Appliances control according to the hours of the day. Level 3 indicator is the highest for the fan speed and lamp brightness, respectively

TimeFan SpeedTimeLamp Brightness
9 AM – 9 PM39 AM – 5 PM1
12 AM – 7 AM17 PM – 7 AM3

Customized setting for energy billing and other AMI-like functions

The customized setting is to allow the user to manage and plan their energy consumption and consequently monthly energy bills.  The setting can be made via the GUI on the main box.  Additionally, the user also can change the setting for demand response and automation services to other preferred settings.  The user might require the changes due to the environment and certain conditions.

For instance, a user might need to use the kettle more frequently for entertaining friends or guests but unable to do so because of the system control.  This can be overcome easily as the system allows the user to change the setting manually to enable operation of the kettle.  Figure 2-3 shows a fully functional HEMS testbed implemented with all the features discussed above with a proposed connection to the cloud via an IoT gateway for remote control and monitoring purposes.


Figure 2.0 HEMS testbed with FAVORIOT Cloud


Figure 3(a) Wireless-enabled Lamp


Figure 3 (b) Wireless-enabled Fan

Performance and Discussion

It is estimated that the charge of electricity during peak hour is 15% higher than an off-peak hour.  By managing the high powered appliances according to the DR and AMI-like features, the user can save up to 10% on their monthly utility cost.

Home automation feature helps the user controls the power consumption according to the time of the day.  For example, using the fan at the highest speed during sleeping hours from 12 a.m until 7 a.m can consume power up to 280W.  Whereas, due to the cooler temperature at that time, the feature will regulate the fan to a lower speed which it deems is enough for a comfortable sleep.  This might result in about 70W power saving or reduces the power usage by 25%.

The customized setting feature gives the user opportunity to synchronize their preferred settings with system control.  Even though this feature does not guarantee maximum saving as it cannot perform optimal control of the HEMS operation, it can provide assistance for the users to reduce costs by making informed decisions and plan their energy usage based on the power consumption information given.

Conclusion and Future plan

A HEM monitoring and control software solution are successfully integrated with the testbed to facilitate demand response by OFF/ON peak hour, home automation and three customized settings for energy billing. It is estimated that the system can promote 10% saving on utility bills and 25% energy saving due to their DR and AMI-like features. In general, the developed FA-HEMS is a likely solution for a greener and sustainable technology which in the long run will benefit the nation and future generation. The next plan can include:

  • An energy meter to give the real amount of the power consumed in a home so that a realistic reaction of the proposed system can be observed.
  • Adding physical sensors such as light and temperature sensors to enhance HEMS and home automation. For example, besides switching OFF/ON the light and fan according to demand response and preferred settings, a light sensor can help to control the lamp’s brightness while temperature sensor can regulate the fan speed according to the surrounding environment.

Copyright © 2024 All rights reserved