Skip to content

Instantly share code, notes, and snippets.

@patrickscottbest
Last active October 2, 2022 23:55
Show Gist options
  • Save patrickscottbest/3ea7c799fea7f81c8d1d27d69d5af954 to your computer and use it in GitHub Desktop.
Save patrickscottbest/3ea7c799fea7f81c8d1d27d69d5af954 to your computer and use it in GitHub Desktop.
Renogy Wanderer - Serial Modbus Script (modified for Wanderer 10A)
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 7,
"links": [],
"panels": [
{
"cacheTimeout": null,
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"0": {
"text": "deactivated"
},
"1": {
"text": "activated"
},
"2": {
"text": "mppt"
},
"3": {
"text": "equalizing"
},
"4": {
"text": "boost"
},
"5": {
"text": "floating"
},
"6": {
"text": "current limiting"
}
},
"type": "value"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 6,
"x": 0,
"y": 0
},
"id": 3,
"interval": null,
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "none",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.1.4",
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"chargeState\"}",
"format": "time_series",
"instant": true,
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{myStr}}",
"refId": "A"
}
],
"title": "Charging State",
"type": "stat"
},
{
"cacheTimeout": null,
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#d44a3a",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 8
},
{
"color": "#299c46",
"value": 14
}
]
},
"unit": "volt"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 4,
"x": 6,
"y": 0
},
"id": 5,
"interval": null,
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.1.4",
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"pvVolts\"}",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"title": "Solar Volts",
"type": "stat"
},
{
"cacheTimeout": null,
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "amp"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 4,
"x": 10,
"y": 0
},
"id": 6,
"interval": null,
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "none",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.1.4",
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"pvAmps\"}",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"title": "Solar Amps",
"type": "stat"
},
{
"cacheTimeout": null,
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "watt"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 3,
"x": 14,
"y": 0
},
"id": 12,
"interval": null,
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "none",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.1.4",
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"pvWatts\"}",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"title": "Solar Power",
"type": "stat"
},
{
"cacheTimeout": null,
"datasource": null,
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "watth"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 3,
"x": 17,
"y": 0
},
"id": 25,
"interval": null,
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "none",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.1.4",
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"todayConsumPwr\"}",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "Lifetime Watt Hour Generation",
"refId": "A"
}
],
"title": "Lifetime Watt Hours Generated",
"type": "stat"
},
{
"cacheTimeout": null,
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"decimals": 2,
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "currencyUSD"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 3,
"x": 20,
"y": 0
},
"id": 26,
"interval": null,
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "none",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.1.4",
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"todayConsumPwr\"} /1000 * .12",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "Lifetime Watt Hour Generation",
"refId": "A"
}
],
"title": "Solar Power",
"type": "stat"
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 5
},
"hiddenSeries": false,
"id": 16,
"legend": {
"alignAsTable": true,
"avg": false,
"current": false,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.4",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"chargeState\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{myStr}}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Charging State",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1035",
"decimals": 0,
"format": "short",
"label": "state",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1036",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": false
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"cacheTimeout": null,
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#d44a3a",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 50
},
{
"color": "#299c46",
"value": 75
}
]
},
"unit": "percent"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 4,
"x": 12,
"y": 5
},
"id": 4,
"interval": null,
"links": [],
"maxDataPoints": 100,
"options": {
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": false,
"text": {}
},
"pluginVersion": "8.1.4",
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"SOC\"}",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"title": "Battery Charge %",
"type": "gauge"
},
{
"cacheTimeout": null,
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#d44a3a",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 12
},
{
"color": "#299c46",
"value": 12.2
}
]
},
"unit": "volt"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 4,
"x": 16,
"y": 5
},
"id": 27,
"interval": null,
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.1.4",
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"batVolts\"}",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"title": "Battery Volts",
"type": "stat"
},
{
"cacheTimeout": null,
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"max": 70,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#d44a3a",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 10
},
{
"color": "#299c46",
"value": 35
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 3,
"x": 20,
"y": 5
},
"id": 22,
"interval": null,
"links": [],
"maxDataPoints": 100,
"options": {
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showThresholdLabels": true,
"showThresholdMarkers": true,
"text": {}
},
"pluginVersion": "8.1.4",
"targets": [
{
"exemplar": true,
"expr": "wifi_quality{stat=\"quality\"}",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"title": "WIFI Quality",
"type": "gauge"
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"unit": "celsius"
},
"overrides": []
},
"fill": 0,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 10
},
"hiddenSeries": false,
"id": 19,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"options": {
"alertThreshold": false
},
"percentage": false,
"pluginVersion": "8.1.4",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"$$hashKey": "object:3149"
}
],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"sccTemp\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "Charge Controller",
"refId": "A"
},
{
"exemplar": true,
"expr": "node_hwmon_temp_celsius{alias=\"pi\"}",
"hide": false,
"interval": "",
"legendFormat": "Pi CPU",
"refId": "B"
},
{
"exemplar": false,
"expr": "weather{stat=\"temp\"}",
"hide": false,
"interval": "",
"legendFormat": "Outdoor Air",
"refId": "C"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Temps (C)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"transparent": true,
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1940",
"format": "celsius",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1941",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"cacheTimeout": null,
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 16,
"gradientMode": "opacity",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 3,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#d44a3a",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 50
},
{
"color": "#299c46",
"value": 75
}
]
},
"unit": "percent"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 13
},
"id": 17,
"interval": null,
"links": [],
"maxDataPoints": 100,
"options": {
"legend": {
"calcs": [],
"displayMode": "hidden",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"pluginVersion": "8.1.4",
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"SOC\"}",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"title": "Battery Charge %",
"type": "timeseries"
},
{
"aliasColors": {
"same time yesterday": "text",
"today": "green",
"yesterady": "#6e6c6cab"
},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 18
},
"hiddenSeries": false,
"id": 15,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.4",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"pvWatts\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "today",
"refId": "A"
},
{
"exemplar": true,
"expr": "(Renogy{mode=\"pvWatts\"} offset 1d)",
"hide": false,
"interval": "",
"legendFormat": "same time yesterday",
"refId": "B"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Solar Watts",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1638",
"format": "watt",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1639",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 20
},
"hiddenSeries": false,
"id": 1,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"rightSide": false,
"show": false,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.4",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"batVolts\"}",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Battery Voltage",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1260",
"decimals": 2,
"format": "volt",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1261",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
"today": "dark-green",
"yesterday": "text"
},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 25
},
"hiddenSeries": false,
"id": 7,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.4",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"pvVolts\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "today",
"refId": "A"
},
{
"exemplar": true,
"expr": " (Renogy{mode=\"pvVolts\"} offset 1d)",
"hide": false,
"interval": "",
"legendFormat": "yesterday",
"refId": "B"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Solar Volts",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1714",
"format": "volt",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1715",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 27
},
"hiddenSeries": false,
"id": 14,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"show": false,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.4",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"loadWatts\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Load Watts",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1336",
"format": "watt",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1337",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 32
},
"hiddenSeries": false,
"id": 13,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"show": false,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.4",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"pvAmps\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Solar Amps",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1488",
"format": "amp",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1489",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 8,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 34
},
"hiddenSeries": false,
"id": 20,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.4",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"todayChgPwr\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "Today Charge",
"refId": "A"
},
{
"exemplar": true,
"expr": "Renogy{mode=\"todayDischgPwr\"}",
"hide": false,
"interval": "",
"legendFormat": "Today Discharge",
"refId": "B"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Today's Watts",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1336",
"format": "watt",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1337",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"description": "",
"fill": 8,
"fillGradient": 7,
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 39
},
"hiddenSeries": false,
"id": 21,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.4",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"todayGenPwr\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "todays gen power",
"refId": "A"
},
{
"exemplar": true,
"expr": "Renogy{mode=\"todayConsumPwr\"}",
"hide": false,
"interval": "",
"legendFormat": "Lifetime Generated Power",
"refId": "B"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [
{
"$$hashKey": "object:3460",
"colorMode": "background6",
"fill": true,
"fillColor": "rgba(234, 112, 112, 0.12)",
"line": false,
"lineColor": "rgba(237, 46, 24, 0.60)",
"op": "time"
}
],
"timeShift": null,
"title": "Today's Watt-Hours",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1336",
"format": "watth",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1337",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"cacheTimeout": null,
"datasource": null,
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"max": 70,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#d44a3a",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 10
},
{
"color": "#299c46",
"value": 35
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 41
},
"id": 23,
"interval": null,
"links": [],
"maxDataPoints": 100,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"pluginVersion": "8.1.4",
"targets": [
{
"exemplar": true,
"expr": "wifi_quality{stat=\"quality\"}",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"title": "WIFI Quality Max 70",
"type": "timeseries"
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 46
},
"hiddenSeries": false,
"id": 8,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"show": false,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.4",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"sccTemp\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Controller Temperature (C)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1940",
"format": "celsius",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1941",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 48
},
"hiddenSeries": false,
"id": 24,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"show": false,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.4",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "pi_volts{stat=\"volts\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "volkts",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Pi Core Chip Volts",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1714",
"format": "volt",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1715",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 53
},
"hiddenSeries": false,
"id": 18,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"show": false,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.4",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "node_hwmon_temp_celsius{alias=\"pi\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Pi Chip Temp (C)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1940",
"format": "celsius",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1941",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 55
},
"hiddenSeries": false,
"id": 9,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"show": false,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.4",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "Renogy{mode=\"sccTemp\"} * 1.8 + 32",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Controller Temperature (F)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1864",
"format": "farenheit",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1865",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"refresh": "1m",
"schemaVersion": 30,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-7d",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "",
"title": "Backyard Electric Plant",
"uid": "000000001",
"version": 35
}
#!/usr/bin/bash
## 20211027 cron job to generate prom file for raspberry pi.
## cron job
# m h dom mon dow command
#* * * * * /home/pi/measure.bash
### PI Core Voltage
echo "pi_volts{stat=\"volts\"}" $(/opt/vc/bin/vcgencmd measure_volts | awk -F = {'print $2'} | head --bytes -2) > /var/lib/node_exporter/textfile_collector/corevoltage.prom
### WEATHER RELATED
echo "weather{stat=\"temp\"}" $(curl -s wttr.in/toronto?format="%t" | head --bytes -3) > /var/lib/node_exporter/textfile_collector/weather.prom
### WIFI RELATED
echo "wifi_quality{stat=\"quality\"}" $(/usr/sbin/iwconfig | grep Quality | awk -F = {'print $2'} | awk -F / {'print $1'}) > /var/lib/node_exporter/textfile_collector/wifi.prom
#!/usr/bin/env python3
# v0.4e 3/1/21 - Joe Elliott
# Updated 20211027 - Patrick Best - wanderer 10A. Remember that the serial has to be 5V compatible, and that the pinout 1-6 on the RJ12 is Rx,Tx,G nothing nothing nothing. You will fry the serial adapter if you hook it up to pins 4,5,6.
# If you encounter errors like - AttributeError: module 'serial' has no attribute 'Serial'
# pip3 uninstall pyserial
# pip3 uninstall serial
# pip3 uninstall minimalmodbus
# pip3 install pyserial
# pip3 install minimalmodbus
import minimalmodbus
import serial
import sys, os, io
import time
#debug = True
debug = False
sleepTime = 30
devName = '/dev/ttyUSB0'
if (len(sys.argv) > 1):
if (sys.argv[1] == "-d"):
debug=True
sleepTime = 2
print("sys.argv[0]: Debug: enabled")
renogy = minimalmodbus.Instrument(devName, 255)
#renogy = minimalmodbus.Instrument(devName, 1)
#renogy.serial.baudrate = 19200
#renogy.serial.baudrate = 2400
renogy.serial.baudrate = 9600
#renogy.serial.baudrate = 38400
renogy.serial.bytesize = 8
renogy.serial.parity = serial.PARITY_NONE
renogy.serial.stopbits = 2
renogy.serial.timeout = 3
renogy.debug = debug
#renogy.close_port_after_each_call=True
BATTERY_TYPE = {
1: 'open',
2: 'sealed',
3: 'gel',
4: 'lithium',
5: 'self-customized'
}
CHARGING_STATE = {
0: 'deactivated',
1: 'activated',
2: 'mppt',
3: 'equalizing',
4: 'boost',
5: 'floating',
6: 'current limiting'
}
if (debug): print(minimalmodbus._get_diagnostic_string())
if (debug):
# Print the details of the power meter here, also include the config needed to talk to the unit.
print('Details of the serial connection:')
print("Renogy:", renogy)
def readRenogy(fileObj):
try:
if (debug):
register = renogy.read_register(0x00A)
maxV = register >> 8
maxC = register & 0x00ff
if (debug): print("Max sys voltage:", float(maxV), "v")
if (debug): print("Max sys amps:", float(maxC), "a")
register = renogy.read_register(0x00B)
maxD = register >> 8
prodType = register & 0x00ff
if (debug): print("max discharge:", float(maxD), "a")
if (debug): print("sys type:", prodType, "00=controller 1=inverter")
register = renogy.read_register(0x100)
if (debug): print("Battery SOC:", float(register), "%")
valName = "mode=\"SOC\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {float(register)}"
print(dataStr, file=fileObj)
batVolts = renogy.read_register(0x101)
batVolts = batVolts/10
if (debug): print("Battery Voltage:", float(batVolts), "v")
valName = "mode=\"batVolts\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {batVolts}"
print(dataStr, file=fileObj)
register = renogy.read_register(0x102)
if (debug): print("Charging Amps:", float(register/100), "a")
if (False): # for chargers with remote temp sensors
register = renogy.read_register(0x103)
battery_temp_bits = register & 0x00ff
temp_value = battery_temp_bits & 0x0ff
sign = battery_temp_bits >> 7
battery_temp = -(temp_value - 128) if sign == 1 else temp_value
print("battery temp:", float(battery_temp), "C")
register = renogy.read_register(0x103)
controller_temp_bits = register >> 8
temp_value = controller_temp_bits & 0x0ff
sign = controller_temp_bits >> 7
devTemp = -(temp_value - 128) if sign == 1 else temp_value
if (debug): print("controller temp:", float(devTemp), "C")
valName = "mode=\"sccTemp\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {float(devTemp)}"
print(dataStr, file=fileObj)
loadWatts = renogy.read_register(0x106)
if (debug): print("Load watts:", loadWatts, "w")
valName = "mode=\"loadWatts\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {loadWatts}"
print(dataStr, file=fileObj)
register = renogy.read_register(0x107)
if (debug): print("PV volts:", float(register/10), "v")
valName = "mode=\"pvVolts\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {float(register/10)}"
print(dataStr, file=fileObj)
register = renogy.read_register(0x108)
if (debug): print("PV amps:", float(register/100), "a")
valName = "mode=\"pvAmps\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {float(register/100)}"
print(dataStr, file=fileObj)
pvWatts = renogy.read_register(0x109)
if (debug): print("PV watts:", pvWatts, "w")
valName = "mode=\"pvWatts\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {pvWatts}"
print(dataStr, file=fileObj)
register = renogy.read_register(0x10B)
if (debug): print("bat max volts:", float(register)/10, "v")
valName = "mode=\"maxBatV\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {float(register/10)}"
print(dataStr, file=fileObj)
register = renogy.read_register(0x10C)
if (debug): print("bat min volts:", float(register)/10, "v")
valName = "mode=\"minBatV\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {float(register/10)}"
print(dataStr, file=fileObj)
register = renogy.read_register(0x10F)
if (debug): print("todays charge power:", float(register)/1, "w")
valName = "mode=\"todayChgPwr\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {float(register/1)}"
print(dataStr, file=fileObj)
register = renogy.read_register(0x110)
if (debug): print("todays discharge power:", float(register)/1, "w")
valName = "mode=\"todayDischgPwr\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {float(register/1)}"
print(dataStr, file=fileObj)
register = renogy.read_register(0x120)
chargeStateNum = register & 0x00ff
chargeStateStr = CHARGING_STATE.get(chargeStateNum)
if (debug): print("Charge state:", chargeStateNum, chargeStateStr)
valName = "mode=\"chargeState\""
valName = "{" + valName + ", myStr=\"" + chargeStateStr + "\"}"
dataStr = f"Renogy{valName} {chargeStateNum}"
print(dataStr, file=fileObj)
register = renogy.read_register(0xE004)
batTypeStr = BATTERY_TYPE.get(register)
if (debug): print("Bat Type:", batTypeStr)
valName = "mode=\"batType\""
valName = "{" + valName + ", myStr=\"" + batTypeStr + "\"}"
dataStr = f"Renogy{valName} {register}"
print(dataStr, file=fileObj)
register = renogy.read_register(0x113)
if (debug): print("todays gen power:", float(register)/10, "w/h")
valName = "mode=\"todayGenPwr\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {float(register/10)}"
print(dataStr, file=fileObj)
register = renogy.read_register(0x114)
if (debug): print("todays consumed power:", float(register)/10, "w/h")
valName = "mode=\"todayConsumPwr\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {float(register/10)}"
print(dataStr, file=fileObj)
register = renogy.read_register(0x115)
if (debug): print("up days:", register, "days")
valName = "mode=\"upDays\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {register}"
print(dataStr, file=fileObj)
register = renogy.read_register(0x117)
if (debug): print("battery full cnt:", register, "#")
valName = "mode=\"batFullCnt\""
valName = "{" + valName + "}"
dataStr = f"Renogy{valName} {register}"
print(dataStr, file=fileObj)
register = renogy.read_register(0xE003)
sysV = register >> 8
recV = register & 0x00ff
if (debug): print("Sys bat voltage:", sysV, "v FF(255)==Auto")
if (debug): print("Recon bat voltage:", recV, "v")
register = renogy.read_register(0xE002)
if (debug): print("Bat capacity:", register, "ah")
register = renogy.read_register(0xE005)
if (debug): print("over voltage:", float(register/10), "v")
register = renogy.read_register(0xE006)
if (debug): print("charge voltage:", float(register/10), "v")
register = renogy.read_register(0xE007)
if (debug): print("equalize voltage:", float(register/10), "v")
register = renogy.read_register(0xE008)
if (debug): print("boost voltage:", float(register/10), "v")
register = renogy.read_register(0xE009)
if (debug): print("float voltage:", float(register/10), "v")
register = renogy.read_register(0xE00A)
if (debug): print("boost recovery voltage:", float(register/10), "v")
register = renogy.read_register(0xE00B)
if (debug): print("over discharge recovery voltage:", float(register/10), "v")
register = renogy.read_register(0xE00C)
if (debug): print("under voltage warn:", float(register/10), "v")
register = renogy.read_register(0xE00D)
if (debug): print("over discharge:", float(register/10), "v")
register = renogy.read_register(0xE00E)
if (debug): print("discharge warn voltage:", float(register/10), "v")
register = renogy.read_register(0xE012)
if (debug): print("Boost time:", register, "mins")
except IOError as e:
print(f"Failed to read from instrument {e}")
# Run the function to read the power meter.
while True:
if (debug): print("Opened new tmp file /home/pi/Renogy.prom.tmp")
file_object = open('/home/pi/Renogy.prom.tmp', mode='w')
# write data here
if (debug): print("\nReading Renogy Wanderer data...")
readRenogy(file_object)
file_object.flush()
file_object.close()
outLine = os.system('/bin/mv /home/pi/Renogy.prom.tmp /var/lib/node_exporter/textfile_collector/Renogy.prom')
time.sleep(sleepTime)
#systemd service for renogy script
#/etc/systemd/system/renogy.service
#sudo systemctl daemon-reload renogy
#sudo systemctl enable renogy
#sudo systemctl start renogy
[Unit]
Description=Start file for renogy
[Service]
ExecStart=/usr/bin/python3 /home/pi/renogy2.py
Restart=always
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment