Code Monkey home page Code Monkey logo

monitormate's Introduction

MonitorMate

A monitoring system for the Outback Power Mate3. It processes the data stream, reformats it for logging, charting, and display on a web server.

How software works?

The software is divided in three parts:

  • Python script for receive and manage Mate3 datastream.
  • PHP scripts for database records and query’s.
  • HTML/JavaScript webpage for visual representation.

monitormate.py

Gets and process datastream to send status to a webserver. This script can work standalone and show devices status in command line. Use the following options:

python monitormate.py –help

Usage: monitormate.py [options]
Options:
	-h, --help
		show this help message and exit
	-p PORT, --port=PORT
		Port to listen
	-g, --get-status
		Get all devices status
	-f, --fxmodifier
		Doubles voltage and divide current in 230V FX inverters
	-s, --show-devices
		Show connected devices to Mate3
	-c, --continuous
		Print data continuously
	-d DEVICE_ADDRESS, --device-address=DEVICE_ADDRESS
		Show specific device status
	-i TIME_INTERVAL, --interval=TIME_INTERVAL
		Time interval between reads in seconds. Use with -c
	-j, --json
		Prints json formatted string with all devices status to stdout
	-n, --datetime
		Include date and time and send to url. Use with -u.
	-u URL, --send-json-url=URL
		Send json via POST to specified url
	-t TOKEN, --token=TOKEN
		Include security token and send to url. Use with -u.
	-r IP_PORT, --repeat-mate=IP_PORT
		Re-send Mate3 datastream to specified ip and port in format IP:PORT

regstatus.php

Gets a json string with devices status and record it in the database.

getstatus.php

Gets data from database an returns a json string.

monitormate.html / monitormate.js

Visual representation of devices status and history. Works with getstatus.php for history and with matelog for “real time” status.

config.php

Configuration file. Contains database connection parameters, record interval, security token and time zone.

monitormate.sh

Init-style script for running monitormate automaticaly as a daemon. See your specific OS/distributions documentaiton for setting up daemons.

Installation and Execution

  1. Download monitormate and extract it.
  2. Rename the config files to config.php and labels.js (remove .sample)
  3. Edit the config and labels files to your liking.
  4. Use database.sql to create tables in your MySQL database. (I suggest phpAdmin to import)
  5. Copy the “Web Server” directory content to your web server.
  6. copy the "Data Stream Host" directory content to your host computer (if it's not the one you're using)
  7. Run monitormate.py on the host with the correct parameters.

Optionally, if you want it to run as a daemon on Linux (assumes Debian-style, modify as necessary):

  1. Copy monitormate.sh to /etc/init.d
  2. Edit monitormate.sh with the proper paths and arguments for your system.
  3. Run "sudo update-rc.d monitormate.sh defaults" to have monitormate automatically run in the background at boot time.

Example:

python monitormate.py -p2700 -u http://www.YOURSERVER.com/regstatus.php -i5 -t YOURTOKEN -c

Go to http://YOURSERVER/monitormate.html, maybe you have to wait a little depending your record interval.

You can send data stream directly to your remote server and run monitormate.py on it.

Time interval on monitormate.py only affects to “real time”. Interval for database record is in config.php.

You can use the -r parameter to resend datastream to other computer or to send to the same using other port and use again the python script to see status in command line.

monitormate's People

Contributors

jepefe avatar instanttim avatar jeperez9 avatar

Stargazers

Yehuda Taylor avatar Pedro Semeano avatar Armando Lüscher avatar Ewan Douglas avatar

Watchers

 avatar Joe Chop avatar

monitormate's Issues

Negative accumulated shunt values?

I've got Shunt A on my inverter, which runs net negative most days (unless I ran the generator a lot.) However, I've never seen negative values for on the page. I checked the database, again no negative values. My mate3 shows a negative value though.

I've looked at your sample site as well, looks like your inverter is on Shunt C... it's zero right now when I looked but judging from the chart it should certainly be negative.

Note: I know this zero's out when the charge params are met, but I see it zero all day long.

Can't remove a device

It looks like that, within a single day, if you remove a device it breaks for the duration of that one day.

Looks like in getting the full_day_data it ends up iterating all the devices. But if that device is no longer connected or functioning later in the day then the javascript throws an error as it iterates through the array.

Looks like this happens in the "for" loops for any of the daily charts, depending on which device(s) have been removed from the system.

Charge Params Met

I'm just noticing that my system has never logged a "yes" for charge params set. I see the days since full resetting to 0.0 when i reach full charge and my FNDC/MATE3 shows that the parameters are met. Is it possible there something wrong in the python side of things?

Staggering of column charts breaks clickable charts (a bit)

To stagger the columns in the historical charts I shifted the time
stamps forward and backward. I tried some Flot plugins that did the same thing without modifying the timestamps and they didn't work well. So as it is, the production column is in the previous day so if you click on tuesday's production column the daily charts will change to show monday. The tooltips reflect this incorrect information.

So when using Flot, I suppose I should give up on the side-by-side columns. I've already corrected this in my fork using Highcharts since it supports staggered columns.

Jesús, what do you think?

screen_shot_2014-01-20_at_10_15_39_am-6

FNDC's SOC has a leading zero in it when it is less than 100.

This is on-disk in the matelog file, I believe it's coming over in the JSON feed that way as well. The python script collecting the data from the Mate needs to be checked, perhaps the mate is even sending that percentage as three digits even though other SOC data showing in the summary doesn't have leading zeros.

Broken charge mode

Somehow I broke the "show charge mode" feature. I haven't looked at it for too long, but it wasn't apparent to me how it was supposed to work.

NOTE: this issue is only in the "instanttim" branch right now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.