“Alexa, what’s my energy usage?” Or how to get real-time data out of your smart meter and onto the cloud
Let’s get a simple service up to bring your real-time smart meter data up to Amazon AWS. There are a couple of things you will need: 1) Rainforest Automation Eagle 100/200 device, 2) an Amazon AWS account, and 3) an Amazon Echo so we can have a little fun. You’ll want to be familiar with creating Lambda functions and also be able to create simple Amazon Alexa Skills to be able to digest the information here.
We’ll want to set up the Eagle with Rainforest Cloud through their Relay API. An AWS Lambda function will do direct external API call to your Relay API account. For fun, we’ll create an Alexa Skill so you can know how much your smart meter is measuring your usage, just by asking!
Installing an Eagle
The Rainforest Automation Eagle 100/200 is a ZigBee Smart Energy Profile 1.1 gateway device. It creates a radio connection on the 2.4GHz band to your smart meter, at one of 11 channels within that band . I live in the Pacific Gas and Electric service territory, under a residential contract, so I can have a pge.com online MyAccount access various utility services, including access to set-up my smart meter with ZigBee Smart Energy devices. That service is called Stream My Data.
What’s ZigBee Smart Energy Profile 1.1?
Eons ago (well, maybe five years ago in wireless technology timescales), ZigBee Smart Energy Profile (ZSEP) was the “big” thing for electric utilities — enable a direct connection with your smart meter and do all sorts of things. The California utilities equipped and enabled the ZSEP for all their residential smart meters. For PG&E, that’s a full 5.1 million meters with this capability. Unfortunately, the private industry never ran with it and so these meters have a neat capability that’s sitting there, waiting for someone to come along and make great use of them.
How do you use ZSEP?
To access your meter’s ZSEP capability, you need to get some hardware. Currently there are just a handful of devices vendors out there selling devices over retail channels. Rainforest Automation’s Eagle gateway is one of them. You can get one at the Amazon online shop for about a hundred dollars; the current device is the Eagle 200. I have an Eagle 100 so that’s what I’m going to base the description on.
The Eagle is a little box with a ZigBee 2.4 GHz radio and ZSEP functionality running on its embedded processor. It also has an Ethernet port to send data on to the Rainforest Cloud service. Here is the high level view of what you’ll need to do.
- “Provision” your smart meter to accept the Eagle connection
- Set up your Eagle’s Rainforest Cloud with your credentials and device information
- Prepare some serverless Lambda functions to access your Rainforest Cloud account by using a RESTful API.
Provisioning will be different for each electric utilities’ smart grid system configuration so my description is based on PG&E’s processes. Setting up the Rainforest Cloud is common to all users of their service and pretty simple.
Provisioning your Smart Meter
The smart meter’s radio needs to know your Rainforest Eagle device’s MAC address and Install Code (IC) values. When those two pieces of information are registered onto the smart meter micro-controller, that specific Rainforest Eagle becomes whitelisted for a secure wireless connection. I did that by accessing PG&E’s online portal after logging on to MyAccount, following the link on the dashboard to Stream My Data.
You’ll want to follow your utilities’ procedure here. But once your Eagle is connected to the smart meter, the data is there over the Rainforest Relay API to be polled and retrieved into an AWS functionality.
Setting up Rainforest Cloud
Please refer to the Rainforest Relay API for directions:
You can try using Postman to directly access the URL for the RainforestCloud Relay API, using the following header and HTTP method:
And a REQUEST BODY:
A successful POST will generate a response of the following:
The <demand>[value]</demand> tag is where the real-time kilowatt value of electricity resides. The Multiplier and Divisors are applied on the value to give the true measured value. The DigitsRight and DigitsLeft indicate how many digits there are from the decimal point (1792 * 1 /1000 KW) = 1.792KW. The timestamp gives the Unix UTC timestamp of the electricity reading (e.g. Friday 23rd February 2018 05:49:41 AM).
Getting the demand data into Amazon Web Services
Having your smart meter data available on AWS opens up a whole world of possibilities. We could do streaming data analysis, store the usage for later batch analysis, etc., etc. Here, we’ll enable the read to happen from a serverless Lambda function, which doubles as the Intent in our Amazon Alexa Skill.
Alexa Skill and Intent
Create an Alexa Skill on the Alexa Skill Developer Console.
- Name your skill (in this example, it is getUsage, the name of the Intent)
- Take a note of the Skill ID (this will be your Skill App Id)
- Decide on the invocation (in this example, it is “Open my Usage”
External Lambda call to RainforestCloud Relay API