Mate Computer Interface

The computer nut and control freak that I am, it only made sense to get the Mate interface for my Outback system. In fact, one of the main reasons I chose Outback in the first place is that they have documented their interface protocol so others could implement it.

The Mate has a standard serial port, but the port is powered by the computer connecting to it, not the Mate itself. This means some USB-serial adapters may not work.

I have written a few Python scripts to interface with the Mate. They each do things a little differently, as my system and desires evolved. They are below with a description should anyone be interested. Just realize I don't write code like this for a living! There is precious little error-handling and I'm sure plenty else "wrong" with it. That said, they work fine for my needs!

These are all written for Linux, I run them on a Debian system. They ought to be usable on other systems, perhaps with a little tweaking. The only module that isn't part of the standard Python distribution is pySerial.

Simple Display and Logger

FM-80 and FN-DC display/logger - My first program saves data to CSV files and displays live data on a curses-based screen. It is very specific to the system setup at that time - an FM-80 and Flexnet-DC, no inverter. (I was running a 12V system then.)

No idea how portable this is, not sure if curses is even available for other platforms.

This particular version has a problem. It will lock up after a while - around a week or two of operation. I believe it is due to the way I saved data to files, opening then closing the savefile every time I wanted to make an entry. Running out of file handles? I didn't spend much time on that problem, as I pretty quickly moved on to the next revision.

Mate class and XML feed to JACE

When I was rewriting from the previous version, I tried to make the Mate-specific portion as generic as possible. I don't have a wide variety of hardware available to test with, but in theory the Mate class ought to be able to pick up any configuration of Outback hardware and supply the data, whether the Mate is directly connected to one device or a 10-port hub has been fully loaded.

The Mate class supplies a list of dictionaries containing the latest data from all devices. The list consists of 10 slots - one for each port of a 10-port hub. Each slot contains a dictionary consisting of all the parameters supplied by whatever device is found at that location. If nothing is found, the slot contains None.

At this point the class doesn't run automatically in the background, a method has to be called to cause it to read the latest data from the Mate. This can pose a problem, as the Mate doesn't wait for the computer to say it's ready, it just emits strings of data at one-second intervals. If the update method isn't called at least that fast then the dictionary data gets behind. Another option is to flush the serial buffer before each read, but then you are effectively dropping data unread.

Mate plaintext class - 100411 - This is the first version and stores the data in "plaintext" for easy (human) reading. It also doesn't have the code to send commands back to the inverter as that was added later.

Mate enumerated class - 100411 - With this version I changed to enums so I could easily pass data into my home automation panel.

JACE XML feed - 100411 - This interfaces with the home automation panel using oBIX ("Open Building Information Exchange") which is just another way of saying XML. This class is hard-coded to my specific setup, it accesses specific points in my JACE and only passes values I cared about.

Connecting the Mate and JaceXML scripts together is a very simple script. It loops continuously, polling the Mate as fast as possible (the read will block until the next string from the Mate so it doesn't load the system) and every 5 seconds it will update the Jace.

Updated Mate class and SQLite Logging

More recently I decided I wanted longer historical data than the Jace keeps. I have added code to log data to an SQLite DB on the monitoring computer as well as pass data to the Jace. This meant one notable change to the Mate class, it now supplies ints and floats for the numeric data instead of strings.

Mate enum class - 111021 - Updated for logging directly on the computer. Added returns to the getXX and scan functions to let the caller know which device was just updated. That way the caller can check just that device instead of the entire list. It also stores numeric values as ints and floats instead of strings.

JACE XML feed - 111021 - Minor update to cast numbers back to strings for shipment to my Jace. Didn't want to redo everything in the Jace...

Logging program - 111021 - This was the "very simple script" above, now greatly expanded to also log to an SQLite DB. It logs on time or deltas. If nothing changes, all data is written every 10 minutes (or whatever is set), if for a given device a value changes by more than the set min delta then that device is logged. Note it doesn't log every possible value, just the ones for which I wanted to keep records.

This latest revision has been running for about 2 1/2 months, and the SQLite DB is 16MB. Considering the very detailed data available over that time, I find the size to be no problem at all. I plan to eventually have some compacting / rotating where particularly old data is filtered down to the essentials and archived. I also plan to add some web-based charting to make use of the data.