<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://altpwr.net/index.php?action=history&amp;feed=atom&amp;title=MorningStar_Logging</id>
	<title>MorningStar Logging - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://altpwr.net/index.php?action=history&amp;feed=atom&amp;title=MorningStar_Logging"/>
	<link rel="alternate" type="text/html" href="http://altpwr.net/index.php?title=MorningStar_Logging&amp;action=history"/>
	<updated>2026-10-09T11:50:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.2</generator>
	<entry>
		<id>http://altpwr.net/index.php?title=MorningStar_Logging&amp;diff=349&amp;oldid=prev</id>
		<title>Chewie: add steps to get Grafana graphs</title>
		<link rel="alternate" type="text/html" href="http://altpwr.net/index.php?title=MorningStar_Logging&amp;diff=349&amp;oldid=prev"/>
		<updated>2021-09-11T18:52:56Z</updated>

		<summary type="html">&lt;p&gt;add steps to get Grafana graphs&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 18:52, 11 September 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l26&quot; &gt;Line 26:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 26:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  );&amp;lt;/nowiki&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  );&amp;lt;/nowiki&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Install [https://github.com/dodo5522/tsmppt60_driver/ this guy's python module]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Install [https://github.com/dodo5522/tsmppt60_driver/ this guy's python module]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Install [https://grafana.com/ Grafana]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Install [https://grafana.com/ Grafana]&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, and the SQLite Data Source plugin&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* create TSMPPT.py to use the python module to get the results (where the x's are the IP address):&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* create TSMPPT.py to use the python module to get the results (where the x's are the IP address):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;nowiki&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;nowiki&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l86&quot; &gt;Line 86:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 86:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Use Grafana to create a dashboard and then graph the values you want:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Use Grafana to create a dashboard and then graph the values you want:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Add the datasource:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:Grafana-DataSources.png|thumb|600px|center|Screenshot showing Grafana Datasources menu and configured SQLite database]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Create a dashboard, and add a new widget:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:Grafana-TSMPPT-examplegraph.png|thumb|600px|center|Example graph showing array output]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;After adding all the sections you want, you can get something looking like this:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:Grafana-TSMPPT.png|thumb|600px|center]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:Grafana-TSMPPT.png|thumb|600px|center]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Feel free to contact [[User:Chewie|Chewie]] with questions or sugestions&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Feel free to contact [[User:Chewie|Chewie]] with questions or sugestions&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Chewie</name></author>
		
	</entry>
	<entry>
		<id>http://altpwr.net/index.php?title=MorningStar_Logging&amp;diff=346&amp;oldid=prev</id>
		<title>Chewie: Recording and graphing MorningStar Charge Controllers</title>
		<link rel="alternate" type="text/html" href="http://altpwr.net/index.php?title=MorningStar_Logging&amp;diff=346&amp;oldid=prev"/>
		<updated>2021-09-09T12:40:17Z</updated>

		<summary type="html">&lt;p&gt;Recording and graphing MorningStar Charge Controllers&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The larger [https://www.morningstarcorp.com/products/tristar-mppt/ MorningStar Charge Controllers] allow logging via MODBUS and MODBUS/tcp to their windows-based GUI.&lt;br /&gt;
This is ok, but doesn't save it in a particularly cross-platform format.&lt;br /&gt;
There is also a hardware device to allow SNMP polling, but this adds &amp;gt;£100 to the installation.&lt;br /&gt;
Using my TSMPPT 60, [https://github.com/dodo5522/tsmppt60_driver/ this guy's python module], cron and [https://grafana.com/ Grafana], I was able to reliably log data to an SQLite DB and make some nice shiny graphs.&lt;br /&gt;
&lt;br /&gt;
There will be more efficient ways to do the following, but this works and is stable.&lt;br /&gt;
&lt;br /&gt;
* Create your DB. I am using 1 table per array to keep things separate, but you might want to add a field for array name if you want all controllers to be logged in the same table. In SQLite, paste the following:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
 CREATE TABLE 'Array1' (&lt;br /&gt;
	'time' text PRIMARY key, &lt;br /&gt;
	'BatteryVoltage' REAL,&lt;br /&gt;
	'TargetVoltage' REAL,&lt;br /&gt;
	'HeatSinkTemp' int,&lt;br /&gt;
	'BatteryTemp' int,&lt;br /&gt;
	'LEDState' int,&lt;br /&gt;
	'ChargeState' int,&lt;br /&gt;
	'KWHours' int,&lt;br /&gt;
	'AmpHours' REAL,&lt;br /&gt;
	'ChargeCurrent' REAL,&lt;br /&gt;
	'OutputPower' REAL,&lt;br /&gt;
	'ArrayVoltage' REAL,&lt;br /&gt;
	'ArrayCurrent' REAL,&lt;br /&gt;
	'SweepVoc' REAL,&lt;br /&gt;
	'SweepPmax' REAL&lt;br /&gt;
 );&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
* Install [https://github.com/dodo5522/tsmppt60_driver/ this guy's python module]&lt;br /&gt;
* Install [https://grafana.com/ Grafana]&lt;br /&gt;
* create TSMPPT.py to use the python module to get the results (where the x's are the IP address):&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!/usr/bin/python3&lt;br /&gt;
import tsmppt60_driver as ts&lt;br /&gt;
import json&lt;br /&gt;
print(json.dumps(ts.SystemStatus(&amp;quot;xxx.xxx.xxx.xxx&amp;quot;).get(False)))&amp;lt;/nowiki&amp;gt; &lt;br /&gt;
&lt;br /&gt;
* Use something like the following script to query the values returned by the above and then add it to the database created earlier. Note that it uses a temporary file (but can be called anything and put anywhere you like that's writeable)&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
cd /home/xxxxxxx/bin&lt;br /&gt;
polldate=( $(date --iso-8601=seconds))&lt;br /&gt;
db=&amp;quot;array.db&amp;quot;&lt;br /&gt;
table=&amp;quot;Array1&amp;quot;&lt;br /&gt;
./TSMPPT.py | jq &amp;gt; TSMPPT.json&lt;br /&gt;
BatteryVoltage=( $(cat TSMPPT.json | jq '.&amp;quot;Battery Voltage&amp;quot;.value'))&lt;br /&gt;
TargetVoltage=( $(cat TSMPPT.json | jq '.&amp;quot;Target Voltage&amp;quot;.value'))&lt;br /&gt;
HeatSinkTemp=( $(cat TSMPPT.json | jq '.&amp;quot;Heat Sink Temperature&amp;quot;.value'))&lt;br /&gt;
BatteryTemp=( $(cat TSMPPT.json | jq '.&amp;quot;Battery Temperature&amp;quot;.value'))&lt;br /&gt;
LEDState=( $(cat TSMPPT.json | jq '.&amp;quot;LED State&amp;quot;.value'))&lt;br /&gt;
ChargeState=( $(cat TSMPPT.json | jq '.&amp;quot;Charge State&amp;quot;.value'))&lt;br /&gt;
KWHours=( $(cat TSMPPT.json | jq '.&amp;quot;Kilowatt Hours&amp;quot;.value'))&lt;br /&gt;
AmpHours=( $(cat TSMPPT.json | jq '.&amp;quot;Amp Hours&amp;quot;.value'))&lt;br /&gt;
ChargeCurrent=( $(cat TSMPPT.json | jq '.&amp;quot;Charge Current&amp;quot;.value'))&lt;br /&gt;
OutputPower=( $(cat TSMPPT.json | jq '.&amp;quot;Output Power&amp;quot;.value'))&lt;br /&gt;
ArrayVoltage=( $(cat TSMPPT.json | jq '.&amp;quot;Array Voltage&amp;quot;.value'))&lt;br /&gt;
ArrayCurrent=( $(cat TSMPPT.json | jq '.&amp;quot;Array Current&amp;quot;.value'))&lt;br /&gt;
SweepVoc=( $(cat TSMPPT.json | jq '.&amp;quot;Sweep Voc&amp;quot;.value'))&lt;br /&gt;
SweepPmax=( $(cat TSMPPT.json | jq '.&amp;quot;Sweep Pmax&amp;quot;.value'))&lt;br /&gt;
&lt;br /&gt;
echo $polldate&lt;br /&gt;
echo BatteryVoltage: $BatteryVoltage&lt;br /&gt;
echo TargetVoltage: $TargetVoltage&lt;br /&gt;
echo HeatSinkTemp: $HeatSinkTemp&lt;br /&gt;
echo BatteryTemp: $BatteryTemp&lt;br /&gt;
echo LEDState: $LEDState&lt;br /&gt;
echo ChargeState: $ChargeState&lt;br /&gt;
echo KWHours: $KWHours&lt;br /&gt;
echo AmpHours: $AmpHours&lt;br /&gt;
echo ChargeCurrent: $ChargeCurrent&lt;br /&gt;
if [ &amp;quot;$ChargeCurrent&amp;quot; = &amp;quot;-0&amp;quot; ] &lt;br /&gt;
	then&lt;br /&gt;
	ChargeCurrent=0	&lt;br /&gt;
	echo ChargeCurrent: $ChargeCurrent&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
echo OutputPower: $OutputPower&lt;br /&gt;
echo ArrayVoltage: $ArrayVoltage&lt;br /&gt;
echo ArrayCurrent: $ArrayCurrent&lt;br /&gt;
echo SweepVoc: $SweepVoc&lt;br /&gt;
echo SweepPmax: $SweepPmax&lt;br /&gt;
&lt;br /&gt;
sqlite3 array.db &amp;quot;INSERT INTO $table(time, BatteryVoltage, TargetVoltage, HeatSinkTemp, BatteryTemp, LEDState, ChargeState, KWHours, AmpHours, ChargeCurrent, OutputPower, ArrayVoltage, ArrayCurrent, SweepVoc, SweepPmax) VALUES ('$polldate', $BatteryVoltage, $TargetVoltage, $HeatSinkTemp, $BatteryTemp, $LEDState, $ChargeState, $KWHours, $AmpHours, $ChargeCurrent, $OutputPower, $ArrayVoltage, $ArrayCurrent, $SweepVoc, $SweepPmax);&amp;quot; &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Schedule it in a user cron. I run it every minute:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
*/1 * * * * ~/bin/TSMPPT2sqlite &amp;gt; ~/bin/TSMPPT2sqlite.log&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Grafana to create a dashboard and then graph the values you want:&lt;br /&gt;
[[File:Grafana-TSMPPT.png|thumb|600px|center]]&lt;br /&gt;
Feel free to contact [[User:Chewie|Chewie]] with questions or sugestions&lt;/div&gt;</summary>
		<author><name>Chewie</name></author>
		
	</entry>
</feed>