SAJ solar power
Posted: Thursday 29 March 2018 10:45
I made a phyton script so I can monitor my solar power production in Domoticz. I couldn't use the script from the forum viewtopic.php?t=10356 I think I have another wifi adapter.
If you want to test if this script will work before you install it, copy this link in your browser : http://*your local SAJ URL*/status/status.php
If you get a webpage with a list of numbers, you are good to go.
For this script you need to have the python requests library installed.
Make a dummy energy device and remember the IDX. Give your SAJ solarinverter a static IP in your router. replace the *** in the script with your values.
Save this script to your domoticz python folder and make a crontab to run this script. I run it every minute to get realtime power readings. If you only want daily power production you could go with less.
If you want to test if this script will work before you install it, copy this link in your browser : http://*your local SAJ URL*/status/status.php
If you get a webpage with a list of numbers, you are good to go.
For this script you need to have the python requests library installed.
Make a dummy energy device and remember the IDX. Give your SAJ solarinverter a static IP in your router. replace the *** in the script with your values.
Code: Select all
import requests
from requests.auth import HTTPBasicAuth
DOMOTICZ = 'http://***' #input your domoticz IP here
IDX ='***' #input your energy idx here
SAJ = 'http://***' #input your local SAJ IP here
SAJURL = SAJ + '/status/status.php'
file = requests.get(SAJURL, auth=HTTPBasicAuth('***', '***')) #input your login here between the ' '
print(file.status_code)
text = file.text
list = text.split(',')
POWER = list[23]
ENERGY = int(list[1])
ENERGYCALC = str(ENERGY * 10)
requests.get(DOMOTICZ+'/json.htm?type=command¶m=udevice&idx='+IDX+'&nvalue=0&svalue='+POWER+';'+ENERGYCALC)