SAJ solar power

Python and python framework
Post Reply
nood
Posts: 21
Joined: Sunday 26 July 2015 13:33
Target OS: Raspberry Pi
Domoticz version:
Contact:

SAJ solar power

Post by nood » 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.

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&param=udevice&idx='+IDX+'&nvalue=0&svalue='+POWER+';'+ENERGYCALC)
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.

thorian
Posts: 31
Joined: Tuesday 29 September 2015 19:50
Target OS: Raspberry Pi
Domoticz version: 2.2563
Location: Poland
Contact:

Re: SAJ solar power

Post by thorian » Thursday 11 October 2018 14:15

Depending on what you actually got - the SAJ Suntrio has all the needed data here: http://IP_OF_SAJ_SUNTRIO/real_time_data.xml

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests