Iotawatt and Python

Well, after getting halfway down the path of installing InfluxDB and Grafana with the goal of getting some data from the Iotawatt, I despaired. Not only was this a remarkable level of complication, it really wasn’t going to do what I wanted.

So, I spent a little bit of time, learned Python along the way, and put together a small Python library to access at least some of the functions of the Iotawatt - query?series, query?select, status, files, some commands (like reset). So grabbing power or energy data from the Iotawatt is now just one line (well, maybe a few lines) of Python away.

If anyone’s interested, I’ll post it up on Github. Regardless, I’ve got some good uses for it. One thing I notice when reading around here is that a lot of people have solved the problem of communicating directly with an Iotawatt, but none of them have shared their work. It turns out to be a small module of code, but it still takes a lot of spelunking and detective work to figure out what it needs to be. So I thought I’d help.

5 Likes

Well done KilroySmith. Definitely post on Github please. I’m always curious. Good on ya for the post. My longer term plan is/ was to install InfluxDB and Grafana on an RPi for a dashboard that integrated other data sources. Was your goal purely getting data, and not so much the presentation?

My purpose is financial. I want to reduce my electrical bills. To that purpose, pretty graphs aren’t particularly useful.

We have somewhat unusual power pricing, with different costs for electricity during peak (3:00 PM to 8:00 PM) and non-peak periods. In addition, during peak periods, we have a “demand” charge which is based on the highest one-hour power draw during the month. The demand charge is pretty significant; if the water heater runs during one afternoon it can boost my bill by $50. I have all the big loads on timers, but it never fails that once every couple of months, something runs when it shouldn’t and I get hit with a big bill.

So, my goal is to, in real time, monitor the loads in my house and text my phone when something is running during peak hours when it shouldn’t. Retrospectively, I want to be able to look at the peak hour last month and see what was running; I want to be able to say “How much does having a pool cost?”.

What I want could be handled by InfluxDB and Grafana with a couple of add-ons; but one of the recurring themes on these forums is people daunted by the complexity of the task of installing those. I understand that; I have a Raspberry Pi under the desk with InfluxDB installed, sucking data from my two Iotawatts, but when I got to the Grafana stage I just threw up my hands and said “there’s got to be a better way”.

So what I have is a small module that doesn’t do any of what I want (yet), except for the basics of communicating with the Iotawatt and pulling out data. Everyone who wants to use it will have to take it from there to do what they want, based on the software tools that they’re used to using.

I understand all that. By all means program a solution to fit your needs.

I’m about as Linux illiterate as they come. I rely on my son for help when I get into trouble. That said, starting from scratch, it took me about an hour to google installation tutorials for influx and grafana and install them. They are working great.

But grafana won’t solve your problem. I’d recommend using PVoutput. You don’t need to upload generation. It works just fine uploading only usage, it’s free, and it’s easy to setup on IoTaWatt.

More importantly, PVoutput has the ability to specify complex tariffs. So you could potentially get accurate cost data.

IoTaWatt is a data collection tool. That the Graph+ output is pretty doesn’t mean it’s not useful and accurate. Your right that it’s not designed to convey the costs associated with your time-of-use based tariff. It does provide a convenient way to get a download of, say, hourly kWh over the month as you indicate you want to analyze. That CSV download is easily plugged into a spreadsheet to do cost analysis, or sucked into a python engine.

I’ll be interested in how you finally resolve your austerity quest.

Thanks, overeasy.
What I’ve found out is that you’ve made it extremely trivial to get all kinds of great data out of the IotaWatt, but it wasn’t obvious to me that it’s really as easy as it actually is.

Besides, I looked at this as a great way to learn Python while getting some useful work done while locked down at home. Now, if I could just figure out why I can’t find my iotawatts using “iotawatt.local”. Maybe I’ll have to upgrade from Win7.

Sounds like a particular predatory electricity supplier with the pricing.

Well, a few years ago the electric utility spent millions trying to influence the election for our Corporation Commission, which is the governmental body that…(wait for it)…sets electric rates.
But, if one can more-or-less eliminate electric usage during peak time, this rate is much cheaper than the alternative rate that has the same cost all day long. Roughly 90% of my usage is off-peak.

Changes the battery dynamic, even without PV. If the desired effect is to reduce peak-time demand, it appears to be working in your case. That can translate into big capital savings in generation capacity and distribution infrastructure or conversely, big expenses for same, so maybe there is some justification.

1 Like

KIlroySmith, Did you post your python code? I would love to get it. I looked in the main repo and did not see anything promising.