Logging electricity data to Xively

The free Internet of Things data logging service: first it was called Pachube, then Cosm, and now it is Xively.

My Cosm feed was changed to a legacy feed, and the graph disappeared when it changed to Xively.

Xively has a new API and now has an official Java client called Xively4J, so I can stop using JCosmAPI.

I have written a new DatalogControl plugin for Xively and will delete the Cosm one.

After some teething troubles, the Xively plugin seems to work. There are a lot of options with the API, and they are not well documented, and how the Java client maps onto them is even less well documented.

I decided to use the Feed level API which lets you update all the data streams (also confusingly known as channels) and all the metadata in one http PUT request.

This seems to be the recommended way to work, as far as I can tell.

To do this I get the feed when HouseControl starts, find the “power” and “energy” streams in it, and then update the current value and updated time for each stream when emonTx sends the data. This does have the disadvantage that if I update the feed on streams on the web site while HouseControl is running, the changes are likely to be put back to the out of date data. I could get the feed each time I update it, but this is less efficient and still might cause the data to revert if the web update occurs between the HouseControl get and update. I will go with what I have for the moment and see how it works out.

Currently, as I say, I just update the current power (in watts) and the cumulative energy (in kwh). emonTx gives me the current power every 5 seconds and I effectively integrate it, to create the energy used. I think the values are fairly accurate, but I have not really validated them.

I might add more streams to the feed, which I have called “Home Electricy Usage”. I could add a stream for each Individual Appliance Monitor.

There are other sites that I could update this data to, such as the OpenEnergyMonitor site. I will probably write a plugin for that site. I could also log it in my own database. I will make a decision about this, when I get round to doing some analysis of the data.

This entry was posted in Home automation and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s