Smart Home Automation with #Python

There are many home automation systems that put python as a support for the extension. Being a dynamic language, python makes it very easy to extend and control the systems. The flexibility offered by python is what java developers can only imagine. With the introduction of micro python recently, the language can be integrated to all levels, from sensors to automation, integration to third party services.

Among the most important home automation systems that use python stands home assistant, which places the programming language on a significant position. The home assistant offers mobile and desktop browsers to a client who can control their home appliances remotely. It is quite different from commercial products as it has no hub appliance, no cloud components. This allows for better security, privacy, and flexibility. The greatest benefit to people is that they are no longer dependent on a cloud provider, if in case the internet goes down, home appliances still work while the private data stays in your home.

Home assistant is an open source platform and runs on Python 3. Installation takes less than a few minutes and it works great. There are many things you can control at home with this unique device, whether you want to turn on the lights in the morning, turn them off at night, dim them when you’re watching your favorite movie or generally know how many appliances are on so you can keep a check on the electricity bill, home automation is perfect for it all.

There is a list of devices that home assistant can interface with, such as the wireless routers, lights, switches, sensors, TV, Amazon, iTunes, thermostats, Raspberry Pi, and Modbus. It can integrate data from Bitcoin network, meteorological data, forecasts, transmissions and a myriad of other supported devices. Home assistant works great with Raspberry Pi which can also be programmed easily with python.

raspberry-pi-logo

Another cool home automation system that uses python as the programming language is the Raspberry pi. The ability of devices in our houses being able to communicate with one another has recently become a very famous concept. These devices can keep in touch using the Internet and pass data from one to another. For example sensors in the garden can download temperature details from weather forecasts and adjust accordingly. This data can be visible to you anywhere around the world. Creating this device, such as the raspberry pi is relatively easy and can incorporate simple programming python language.

raspberry_pi_-_model_a

In both these tools, the system is composed of two parts, the server, and the client. The server is normally the web interface that will allow you turn off or on the device of your choice. This consists of files to store data.  The home assistant can also easily run from a Raspberry Pi to a NAS device and ships with docker container to make transport on other systems easy.

Raspberry Pi ships with IDLE, which is a python development environment and gives you the leverage to add commands. It also includes a help feature that helps you with your syntax and comes with an inbuilt text editor with the automatic placing of indents in order to facilitate you with your programming. IDLE is just one example of a text editor, there are many others that can be used, such as Leafpad that comes with Pi. Geany is another well-liked choice among python programmers.

There are other home automation toolkits that can be operated with the help of python, for example, lighting, heating and security devices. Python is a strong and powerful programming language that is user-friendly and can easily be used with systems such as Raspberry Pi and lets you connect your developments with the world. The syntax is clean and uses Standard English keywords. Soon, a lot of home automation appliances will rely on this wonderful language and it will become easier to operate devices at home, even when you are sitting a million miles away. The best part about these devices is that they do not rely on cloud applications and hence, can still run without the internet. With a standard coding language that is easily implementable, more devices will be up in the future, automating the entire home, from lighting to heating sensors, our houses will all be covered.

 

Advertisements

#APIs, #SmartCities, #IoT and more on @APIlama

Today I wanted to do some research on the topics that I like to post more about. Don’t get too alarmed, this is not an academic essay about the pros and cons of technology and stuff. I just “googled” the most hot topics of tech and the results can be found below.

To summarize this a little bit, those topics are:

Mainly I wanted to look out how those topics are discussed throughout the Internet and see if my personal gut is right on following after those areas.

It is pretty obvious from the graphic below that APIs, Web and Programming in general are pretty popular topics while Smart Cities and IoT only now start to pick up. Those were more or less what I was expecting to see. I was a little bit surprised with the peak of WWW the last year. This is something I did not see coming and I am not totally sure on why this happened.

I was also expecting to see more traffic on Smart Cities and IoT but maybe this means that Google needs more time to understand a new topic that people search and discuss about.

Screen Shot 2016-03-07 at 21.52.46

For this research I used Google Trends. This is a really nice tool to provide an overview of various topics across time and regions. You can find this specific research directly on Google Trends.

Regional Interest

Another area of interest apart from how those article perform over time, is how those perform over regions. Some of the results were surprising.

For example, I did not expect so many people from Sri Lanka or Tunisia to be interested on APIs. Mainly because I don’t know any developers over there 😛

Some other of the results were expected more or less one could say. For example it was no surprise that South Korea is so interested in IoT. Or Germany is searching a lot for World Wide Web, which is somewhat expected since they are trying to become the Silicon Valley of Europe.

What amazed me a lot, was the increased “googling” of Malta about Smart Cities. I did expect this for United Arab Emirates, Singapore and India who are considered pioneers on the area, but Malta was a surprise to me.With a little bit of searching I found out that Malta is deep on the Smart City game with their SmartCity project which btw, looks awesome!

Top Interests and Queries

Another interesting information that Trends show are the top topics regarding the overall category you are searching for and the most prominent queries.

I am only attaching the information about APIs, because the rest were not that interesting mostly cause either they are not that populated yet or they were not that relevant to a technical site.

Screen Shot 2016-03-07 at 21.53.52

Looking at the results, it totally makes sense that REST is there, and also JSON and Javascript. But Java???

46e039da6efd16c540b180b964d5a0278267ec0126da7e6f4fff0e3af0224b22

I am not a big fan of Java, but it is definitely not a term to attach with APIs. On the other hand, Java was the first to coin the term, but since then we’ve gone a loooong way.

In any case, it is definitely a good thing that people are looking for better programming paradigms and this is the whole thing about APIs.

APIS: Better programming, Better software quality

Create your Own Trend Graphics

This article is part of my research on the topics that I find “hot”. I would like to see what you also think about those trends and play with your own graphics.

Feel free to contact me with your ideas and I would love to share them in a next post!! As I have quoted many times in the past, this site is a collaborative effort and my posts are only a trigger for further discussion.

 

What The Internet of Things Is Not

We all try to understand what the Internet of Things is about and how to better create businesses to fulfil its potential.One day I started looking the whole thing from a totally different perspective. Instead of trying to explain to everyone what the IoT is and what we need in order to become “IoT enabled”, I should start comparing to what Internet of Things is not. And then I started writing an article about that when I noticed a super awesome one by John Muller and thus I deleted mine and quoted his. Hope you enjoy it as much as I did and send me your ideas for future posts.

 

what-iot-is-notSome time ago, I wrote an article entitled, “What is the Internet of Things?” It sought to help put the Internet of Things (IoT) into perspective and helped describe a dream about what the IoT could eventually become. Technologies always mature and people’s feelings toward them change. In addition, the reality of the Internet of Things begins to set in. The vaporware and promises of yesterday fade in the face of what the technology can actually do and how people actually expect to use it. Many people are saying that the IoT is losing steam, but that’s not really the case. The IoT is maturing and becoming a more useful technology space that developers can actually employ to create some really compelling digital experiences. This article looks at the IoT through the lens of reality to state what the IoT isn’t, which means that you discover what it really is all about.

Avoiding the Hype Products

Some companies see IoT as a means for making all of us excessively lazy and they’re willing to provide the products to help us go there. Some people considerAmazon’s Dash Button as one such device. The idea is to stick it to something in your laundryroom, such as the washing machine, and you push it every time you’re out of detergent. While some people were drooling over the device, some industry pundits  saw it for what it was—ludicrous. Of course, Amazon wants to get everyone to participate, so there is the Dash Replenishment Service and Amazon is inviting developers to join. That’s right! You can access an API that makes it possible to create your own Dash Button. The API is still in development, but you can get in on the ground floor with the beta. (Another interesting product in this genre is the Egg Minder—an IoT device designed to tell you how many eggs you have left in the refrigerator.)

Of course, the question is where real products will come into play. What vendors need to consider with IoT is how to create products people actually need. For example, people really do need to monitor various not-internet-of-thingsenvironmental conditions, including things like freezer temperatures. Companies, such asMonnit, provide devices to perform all sorts of monitoring using IoT devices. The iMonnit API makes it possible for developers to write applications to interact with these devices so that it’s possible to use the sensors in unique ways. (Just in case you need that solution for a home environment, trySmartHome instead.) The point is that this is the promise of IoT that hype products tend to miss.

Connecting Diverse Products

Some people have gotten the idea that IoT is all about connecting disparate devices together in some manner—that somehow it will be possible to use a single app to control every aspect of a home, business, or industrial setting. The IoT isn’t an actual networking solution today. In fact, like most new technologies, the IoT suffers from a serious amount of proprietary solutions. When working with IoT devices, you need to consider issues such as:

  • Hubs: Each vendor seems to use a proprietary hub so that you need one hub for each product type. Some vendors don’t use hubs. Getting products that avoid the whole hub mess is the best way to go.
  • Subscriptions: If you work through a cable service or telephone company, you’ll almost certainly end up having a subscription to a service that makes your device accessible. Some other vendors go this route too. Unless the product has something special to offer, having to pay a monthly subscription fee to access the hardware you bought seems like a bad idea.
  • Headless Devices: Some devices don’t offer any sort of control system, other than a smartphone or other computing device. What this means is that you actually need another device to control the device you wanted to interact with in the first place. In general, avoid headless devices when you can. You shouldn’t need a smartphone to control the temperature of a building.
  • Differing Protocols: Various vendors use different protocols. One vendor might rely on Bluetooth, while another relies on ZigBee. Obtaining devices that all use the same protocol is the best way to ensure you have at least a chance of controlling the devices using the same approach.

Fortunately, some vendors, such as Cisco, recognize that connectivity is important. However, even though Cisco has been working on these solutions since 2013 , a perfect solution still remains to be seen. The Cisco IoT Field Network Director does offer the promise of consolidation, however, because it extends the network out to the device. This technology makes it possible to manage your devices using a single application. The concept is extended further by using a technique called fog computing, where the cloud is extended to the edge of the network.

The point is that IoT will eventually become more standardized and devices will become plug-and-play in nature, but you can’t count on it today. What you need to look at is one IoT device connected to a single application. When possible, try to get all your devices from a single vendor who also provides an API so you can create applications to interact with the devices as needed.

Securing the IoT Solutions

You can find a number of stories that describe some of the horrors of using IoT devices in just about any environment. For example, a review of Honeywell’s smart thermostat system tells precisely what a disgruntled husband can do to his ex-wife. (Whether the story is real or not is the topic of much speculation, but it’s completely feasible. You can check out other stories of this sort at infoworld. Currently, the IoT environment is anything but safe. If you want a secure environment, then you need to keep off the Internet or rely on secure Internet solutions.

Groups like theowasp_logo_400x400 Open Web Application Security Project (OWASP) are trying to educate vendors and developers alike on safe coding practices for IoT, but even with a concise top ten list of things everyone should check, security is still an issue for IoT. However, security will improve. Companies, such as Nest, are making security a prime focus and telling potential customers about the efforts being made on their behalf.

The Bottom Line

The IoT is a new industry of technology that provides non-standard solutions to myriad problems. Some solutions are quite usable; others aren’t worth the time needed to seriously consider them. You won’t get a completely secure, standardized solution to meet most needs today unless you take the time to perform the required research and shop carefully from a single vendor. However, there are changes in the wind and eventually IoT will become the standardized environment we all wanted in the first place. For now, you need to think about whether that Egg Minder really is the device of your dreams.

Centaurs used to teach Hercules. Today they teach about the Internet of Things!

On Wednesday the 11th of November 2015 we hosted a super interesting event at the API Athens Meetup about  APIs, IoT and a bit of Business.

APIs, IoT and a bit of business

Wednesday, Nov 11, 2015, 7:00 PM

The CUBE Athens
Kleisovis 8. Kaniggos Square Athens, GR

67 API Artisans Went

DescriptionHey to all,For this meetup, we have prepared a session with APIs, IoT and a bit of business.We are hosting Sotiris Bantas founder of Centaur Technologies. Sotiris kindly accepted our invitation and will arrive from Volos for our meetup.Wednesday, November 11th at 19:00 – At The Cube Athens…The plan:1. APIs, IoT and a bit of busin…

Check out this Meetup →


The keynote speaker is a friend and mentor of mine, Sotiris Bantas. Sotiris is a technologist and entrepreneur with diverse background in semiconductors, microelectronics systems and all aspects of software. Excellent problem solver and conduit among business stakeholders and technology teams in a broad spectrum of disciplines, ranging from wireless systems design, to chip design, to cloud applications. Former co-founder and CTO of Helic, now a proud founder of Centaur Technologies. This is a company that develops and markets end-to-end solutions for the Internet of Things, focused on the Industrial and Enterprise sectors.


IMG_20151111_191620

Sotiris kickstarting his presentation

The meetup was a success, as the room was full of people! We even had people standing, just waiting to listen Sotiris discussing about Internet of Things applications, business models and relevant API technologies.

IMG_20151111_191555 IMG_20151111_191551


Below you can browser his presentation and you can always interacting with him on twitter. He is super friendly, always online and ALWAYS ready to engage interesting Tech conversations.

In Sotiri’s Words

Centaur Technologies designs for the Industrial IoT. Our sensors typically go inside cargo containers and connect to the cloud wirelessly, often through an API.  We aim to go “where no sensor has gone before”, and quite often an API is providing the breadcrumbs for this journey…

Why did we have to develop an API? There is usually a pragmatic aspect to this. An API forces a certain modularity to the design, so that multiple apps may access the same database in an orderly fashion. This becomes important in the context of databases for the IoT where data streams may flow in from numerous Things, while data consumers (human or machine) should be allowed access through some formal authentication mechanism (e.g. we use JWT for now). Moreover, an API provides ideal test fixtures for making the code testable (e.g. we use SuperAgent for that).

But there is often a strategic aspect to an API. It paves the way for onboarding others (especially 3rd party developers) to your service. In an ideal scenario, your customers may use the API to develop their own toolsets and apps over your product (or its underlying database and engines).

But is everyone open to this sort of APIxploitation (to coin a term…)? Not always. Some services will only implement the ‘R’ in CRUD, that is provide read access to the underlying database but not necessarily allow one to add to it in any meaningful way (outside their own UI). That’s not the only bottleneck with APIs; sparse documentation and lack of standardization, especially for the IoT, are some of the typical shortfalls. By the way, we like what iotdb.org is aiming to accomplish by offering some standard semantics in the way IoT APIs could be built one day.

So is the API part of the product? Is it monetizable? Some people go as far as advocating that the API is the product. This is especially true in the case of tiered or freemium services such as Mailchimp and Google Maps, where most commercial usage may originate via the supplied API. Transactional APIs such as PayPal’s or Stripe’s will implement charges per each transaction (digital payments in their case). Affiliate business models such as AdSense and the bulk of the business network comprising today’s travel industry will also rely exclusively on APIs to channel commissions between agents, platforms and providers. 

Will these business models pan out well in the IoT? Maybe so.

Most IoT products today, especially those in the consumer space, come with an API. Think of a wearable fitness device allowing third parties to develop apps for its users. Access to such an API may typically be free (to promote sales of the appliance) but tiered pay models are also possible – especially when advanced analytics are added to the offering. Regarding IoT infrastructure, platforms and middleware offerings are invariably offered to IoT developers in the form of a tiered API or via a freemium access model.

Interestingly, transactional APIs may also be envisioned especially if Things are to start transacting business with each other. A micro-payments model could be considered where Things may initiate monetary transactions and clear them using some form of blockchain-based currency. Think of your car paying the proximal parking meter using pre-stored Bitcoin.

Finally, affiliate business models should appear at some point. In the context of Smart Cities, one of the ways to enable service aggregation in what is currently a very fragmented ecosystem, could be over the development of API-driven affiliate networks. Municipalities, utility companies, telecom operators and specialized solutions developers could participate in a common marketplace, each one of them enabling partners to offer commercial services over its proprietary database and fleet of Things. In this fashion, a filling station could advertise an off-peak-hour offer for cheap electricity, by pushing it to the autonomous vehicles roaming in its vicinity. Anything could flow, as long as the proper plumbing (= API) is in place…

Final Thoughts

Some interesting discussion that were raised during the Meetup where mostly focused about the semantics of APIs and how some of those good practices can be transferred to the world of IoT and Smart Cities.

A lot of discussion about  IOTDB: The Internet of Things Database took place engaging more and more people to express their feeling about common shared practices. I am a great fun and follower of the Schema.Org paradigm, but everyone seems as comfortable by following guidelines from Google, Yahoo and Microsoft.


In order to summarise this post, it is important to notice that Greece has an active community of developers that investigate the latest technology trends and want to be part of the changes to come.

Greece could benefit from the current crisis by opening more business opportunities and enabling the creation of a european silicon valley in the way that Barcelona tries to create one.

APIs are actually opportunities for innovation, integration, new business models. New revenue streams could be created in a way that developers could be stated in Greece and work with the rest of the world. In a way, there many companies now within Greece doing exactly this.
To finalise this short article, I would like to say that Greece is not only a place for holidays. It can be a place for opportunities and developers around the world should seek this lucky chance and visit our country both for business as well some nice vacation time.

OLYMPUS DIGITAL CAMERA

The API Manifesto

APIs are important tools for the software community. No matter if we are talking about huge enterprises or about small start-ups the case is always the same:
Companies are struggling to create more revenue to survive in the business (super-competitive) world.

APIs do just that.API Design Simply Put

Each API is a collaborative tool that help businesses, wanna-become-businesses and hobbyists to share their information or consume others information in order to create relevant business models where each ones survival is dependent on the other ones surviving the business world.

Why do Enterprises use APIs?

A huge trend has been surrounding the Enterprise Area where now some of the biggest “players” have started organising API conferences, Meetups and even sustain dedicated twitter accounts around the subject.

Why all this fuss? Why is it so important to have an API strategy and to promote it so hardly? What happened to WADL and BPML, some of the most compact enterprise technologies already there?

I will only try to scratch the surface of those answers (since those can only be personal – heavily debatable opinions).

Since the era of mobile marketing rose, there has been an immediate need to support easier integration mechanisms that would sustain lighter transactions. There is a general disagreement about APIs that are indeed a new term and not just a rebranding for services that already exist for a long time. The key difference is that APIs aim on developer adoption. They try to be friendly, easy to understand and they tend to change more often according to the market needs. In a word, APIs aim to be attractive for the customers. On the other hand, traditional web services aim on long term contracts and general cost in mind. That is why this was mainly designed for enterprise processes and for agile mobile development. A nice analogy would be that APIs are a nice fancy expensive smartphone that provides a lot of functionality  but needs updates and may crash from time to time, while on the other hand services are the cheap reliable phone that will continue to work for many years without any update, and with no extra cost.

What is the difference between APIs and the Internet of Things?

It is more than clear that #IoT is a hot topic where the biggest enterprises in the area are now focusing on. For example Amazon now has officially launched their core IoT product, which is mainly a rebranding and a mashup of some of their existing #AWS stack. Oracle on the other hand has also launched their IoT platform which is  based on their existing cloud infrastructure as well.

IBM is approaching the industry in also a competitive way by participating in #IoT standards, creating an Internet of Things foundation and obviously also launching its own #IoT focused cloud-based platform, which has been trending for a while as the newly introduced PaaS: Bluemix.

Other companies have also been launching #IoT specific products, for example Golgi is one of them. Most of those products are based on existing cloud infrastructure with all the updates of the #API era. In my opinion, Internet of Things is the evolution of APIs for businesses to APIs for Everything.

What is expected from the API world?

Now I am taking a step further by discussing a little bit on what I expect to see over the next couple of decades in the area of #APIs. Why we even stay on that domain?

This is a discussion that happens over a round of beers with API friends after a #Meetup or a conference. The obvious answer, is that the Internet of Things is the next best thing which we expect to experience in our pro-careers or in our lifetime in general. I definitely agree that Internet of Things will be a great revolution which is going to change the way we live, and for this we need to heavily brainstorm on several aspects of this.

Smart Cities, A revolution that is just knocking on our door

Apart from the #IoT, Smart Cities is the next best thing in my personal opinion. It is going to be much bigger than API revolution, even bigger than #IoT, maybe even greater than the Computer Revolution itself.

Smart City

There are already huge efforts to standardise Smart Cities and #IoT. An important effort driven by IEEE, tries to create a community of people interested in Smart Cities with the ultimate goal to conclude in a Standard, Specification or even a set of best practices. Another similar approach more Specification oriented leaded by manufacturing and enterprises is the HyperCat. There are even more approaches that I do not mention here, because I just want to show that there is a community and a lot of effort around Smart Cities but I am not making an exhaustive SotA here.

Some related material I have been studying recently around the subject:

All the discussions, the material I’ve been studying or the various tweets on the subject having been giving me various ideas and future directions that I would like to discuss in future articles and webinars (or beer sessions).

More Stuff to Read

If you read this article and you think that API is what you are looking for, you can always read more in my Education Section or go directly to the ultimate API source provided by the API Evangelist. Another source that I like to consult quite often, is the blog of the API Handyman, where he writes about API best practices.

Obviously there are more API blogs, websites, whitepapers out there where I can not mention all of them here. Either contact me directly if you need anything or tweet to me.

Obviously no such blog post could ever exist without mentioning the ProgrammableWeb which is a website dedicated on news and information about APIs and there exists for a long time, before most of us even started working on the area.

Asimov’s Three Rules for the Web of Things

The era of web of things is an emerging one. New applications, ideas, tools and much more are provided. Smart locks, smart thermostats, smart cars — you’ve probably heard some of these terms lately, and you’re going to hear them even more as the year goes on. But what are these things exactly — and what makes them so smart?

These devices are all part of an emerging category called the Internet of Things, or IoT for short. At its very basic level, IoT refers to the connection of everyday objects to the Internet and to one another, with the goal being to provide users with smarter, more efficient experiences. Some recent examples of IoT products include the Nest Protect smoke detector and August door locks.


Fifty years ago, according to Asimov,  the three laws of Robotics where written down at the “Handbook of Robotics, 56th Edition, 2058 A.D.” and are listed below,
  1. A robot may not injure a human being or, through inaction, allow a human being to come to harm.
  2. A robot must obey the orders given it by human beings, except where such orders would conflict with the First Law.
  3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Laws.

Trying to apply the same thinking into devices we can identify a lot of interesting topics.

 Rule 1: A device may not injure a human being or, through inaction, allow a human being to come to harm.

So, this first rule it is a super simple one. A device should protect human beings by not allowing any harm to them directly or indirectly.
It is widely accepted that war is funding technology throughout the human history. For example in 200 B.C. we have the first massive production of armoury by Romans that would later give them the advantage to conquer and change the world. The world change not only because the had a common language but also because mass production was established. The whole idea of factories was established back then and it continues to affect our world even today.
The whole point is that war is also funding today devices and mainly war robots. There are numerous examples about the robots that G5 are building and some of those are animal like, human like and even planes.

A device must obey the orders given it by human beings, except where such orders would conflict with the First Law.

 Rule 2: A device must obey the orders given it by human beings, except where such orders would conflict with the first law

This rule makes sense. Any device is placed by humans for a specific task. This task can be either in manufacturing, in cars, in home automation or any other possible scenario the Internet of Things is discussing nowadays. Any of those devices is expected to follow human orders, meaning that human instruction are the ones to program its goals, its expectations. Thus, any device should follow any of those rules that are given by a human instructor, developer as long as it does not interfere with the first rule.
No human should be hurt by any other device.

Internet of Things is behind every single Device

Rule 3: A device must protect its own existence as long as such protection does not conflict with the First or Second Laws


I really like what this rule stands for. It stands for  something equivalent to the “Live long and Prosper” for devices. Devices should seek for their own well-being as long as they do not intervene with any of the aforementioned rules.

For example, Google’s home unit, Nest is a nice example of a smart house sensor that it is as smart as it gets in its simplicity. It is also smart enough to know when it needs a repair.

Make no mistake about it: just as the last ten years saw tech companies battling it out to control mobile, the next ten years will be all about the tech giants trying to win control of your homes. That’s because the mythical “smart home” of the future that many  were first exposed to in the 1950s with The Jetsons cartoon is actually close to being a reality now thanks to major advances in what’s known as “Internet of Things” technology. This is technology where not only our computers and mobiles are networked together, but every formerly “dumb” device in our home, like kitchen scales, coffee makers, garage door openers, and thermostats.

Asimov’s ideas are still well-timed

What Asimov envisioned maybe is yet to come in a future far far way. But we have now, is a future that knocks on our door. Billions and billions of devices are expected to come to life the next 20 years and this is just the beginning. 

Those are some my preliminary thoughts regarding the topic of Internet of Things and the rise of the machines.

Isaac Asimov – 1920/1992