Solar-log integration with SolarLog 50?

To read the daily production of my PV panels, I use a Solarlog 50.

Instruction:
“Before being able to use the integration, you have to activate the open JSON interface on your Solar-Log device. This can be activated from the Configuration | System | Access control menu of your Solar-Log device.”

However, there is no option to set the ‘open JSON interface’ in my SolarLog 50.
and yes, I set a password and refreshed the web page.
Can I conclude that this integration does not support the SolarLog 50?

Until now I used the PV-output.org method, but I think that the native SolarLog integration looks better.

Edit: the manual of the SolarLog 50 doesn’t mention anything about the JSON interface while the SolarLog 250 and above does. So apparently the SolarLog 50 doesn’t support JSON.

Did you find a solution for this? I also have a Solar-Log 50. I know it does not have a JSON interface. Did you look at scraping the web interface?

1 Like

Its not supported, at least when I checked with them three years ago I got that answer from the support centre. I see no technical reason for it, more a marketing topic.

I did a small POC where the data can be extracted. Its just a POC, and I am not a coder

#!/usr/bin/env python3

import json
import requests

sess = requests.Session()
login_response = sess.post(‘http://IPadress of Solarlog/login’, data={‘u’: ‘user’, ‘p’: ‘Your password’})

print(login_response.status_code)
token = login_response.cookies[‘SolarLog’]

print(token)

cookies = {
‘banner_hidden’: ‘false’,
‘SolarLog’: token,
}

headers = {
‘User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Firefox/102.0’,
‘Accept’: ‘/’,
‘Accept-Language’: ‘en-GB,en;q=0.5’,
# ‘Accept-Encoding’: ‘gzip, deflate’,
‘Content-Type’: ‘application/x-www-form-urlencoded; charset=UTF-8’,
‘X-Requested-With’: ‘XMLHttpRequest’,
‘Origin’: ‘http://IPadress of Solarlog’,
‘Connection’: ‘keep-alive’,
‘Referer’: ‘http://IPadress of Solarlog/’,
# Requests sorts cookies= alphabetically
# ‘Cookie’: ‘banner_hidden=false; SolarLog=/+WODFA/bqvQ8TuEbr9qtcbBU+YPyrftFmUnizgRLTg=’,
}

data = ‘token=’+token+’;{“701”:null,“794”:{“0”:null}}’ # date and time

response = sess.post(‘http://IPadress of Solarlog/getjp’, cookies=cookies, headers=headers, data=data)

print(response.text)

data=‘token=’+token+’;;{“867”:{“0”:null}}’ # Seems to be the time series
response = sess.post(‘http://IPadress of Solarlog/getjp’, cookies=cookies, headers=headers, data=data)

print(response.text)

data=‘token=’+token+’;{“782”:null}’ # Contains the current usage and production
response = sess.post(‘http://IPadress of Solarlog/getjp’, cookies=cookies, headers=headers, data=data)

print(response.text)

could you point me in the right direction how to use the script in HA.

I have installe AppDeamon ond put the script in the right folder but getting an error:
No app description found for: /config/appdaemon/apps/solar-log.py - ignoring

Hello, thank you for the script. Unfortunately, it doesn’t work for me with the Solar-Log-50. I suspect that the user login fails. The last useful information returned is a status code 200… but I can’t find anywhere what it means. After that, the script terminates with an error message that I can’t interpret very well due to my lack of Python knowledge.

The Command Line output ist the following:

200
Traceback (most recent call last):
File “/root/logger.py”, line 10, in
token = login_response.cookies[“SolarLog”]
File “/usr/lib/python3/dist-packages/requests/cookies.py”, line 328, in getitem
return self._find_no_duplicates(name)
File “/usr/lib/python3/dist-packages/requests/cookies.py”, line 399, in _find_no_duplicates
raise KeyError(‘name=%r, domain=%r, path=%r’ % (name, domain, path))
KeyError: “name=‘SolarLog’, domain=None, path=None”

In Line 10: token = login_response.cookies[“SolarLog”]

I think the “200” is the output of the “print(login_response.status_code)”

my solar log works with an german UI, so the attribute u=user ist always correct? Are there more possibilities like “Installateur” or “Installatuer/PM”

thenks for your support
Jan

My suspicion is that the Solar-Log-50 is a stripped-down device that only sends data to a web server of the manufacturer. However, I can imagine that it may be possible to somehow access this data locally and display it in Home Assistant. If there are any hints or ideas on how to achieve this, that would be great! Thank you.

Status 200, should be the html code for success, see Status codes in HTTP

It looks like you have a an issue to login, now I have a German version also and for me this works. So I don’t think that is the issue.
I am using the normal “Benutzer” account, I don’t have the passwords for the other accounts. Why that seems not to work for you, I don’t know. What is the user account that you are using when you log into the web interface? I can recommend using the web developer tools under firefox.
It seems to be
“user” = Benutzer
"admin"Installateur
installer=Installateur/PM

So if you have the password for one of the other accounts you would use admin or installer in the script and I would expect it to log in.

A few weeks ago I was playing around with this again. I still don’t have an idea what I want to do, but I had it post the power consumption ([‘782’][‘0’]) every 5 seconds to a the mosquito broker on the home assistant. Then on another PC I had grafana listening and plotting the power consumption. It was sort of cool, but I did not go further. The current power generation from the panels is in [‘782’][‘1’].

The only issue I have found so far, is that if one logs in to the web interface then that “logs out” the python script.

I have not really made up my mind around if I want to go with a polling of the data every 5 seconds, or maybe poll the 867 every hour, which seems to give some thing like

{‘867’: {‘0’: [[‘00:00:00’, [0, 0, 0, 1540, 0, 0]], [‘00:05:00’, [0, 131, 0, 1577, 0, 0]], [‘00:10:00’, [0, 258, 0, 1524, 0, 0]], [‘00:15:00’, [0, 383, 0, 1510, 0, 0]], [‘00:20:00’, [0, 502, 0, 1435, 0, 0]], [‘00:25:00’, [0, 620, 0, 1417, 0, 0]], [‘00:30:00’, [0, 734, 0, 1365, 0, 0]], [‘00:35:00’, [0, 848, 0, 1368, 0, 0]], [‘00:40:00’, [0, 962, 0, 1378, 0, 0]], [‘00:45:00’, [0, 1071, 0, 1303, 0, 0]], [‘00:50:00’, [0, 1171, 0, 1211, 0, 0]], [‘00:55:00’, [0, 1270, 0, 1192, 0, 0]], [‘01:00:00’, [0, 1372, 0, 1229, 0, 0]], [‘01:05:00’, [0, 1482, 0, 1313, 0, 0]], [‘01:10:00’, [0, 1584, 0, 1234, 0, 0]], [‘01:15:00’, [0, 1685, 0, 1207, 0, 0]]…

I expect that if one looks a bit more into that, then one can save a bit of traffic.

For me it’s all about what what one wants really. I have a number if ideas, mostly around optimising my heat pump and how that works with the power consumption and solar production.
But then I lack the time and perseverance to dig into this, so it stays as a POC at the moment. If someone else find time to work, I would be happy to support

Best
Johan

I think they have mostly tried to position the same HW with different SW. We call it product positioning.
I see no logical reason why you can have a web server running, a browser requesting the data and displaying it and not have an API that just delivers the same data in almost the same format…

What is it that you would like to have into home assistant?

thanks for your answer… some weeks later found time to play a bit with the script. Because I’ve absolutely no idea what you doing with the python script I’m a bit in struggle. I tried to get an usefull output from the script but I think I failed. Just always an return code that seems to be saying login works fine, but afte that no data. Just some output on the command line I’ve posted before. Meanwhile I tried it with all the users, installer, admin, always got a 200 as return.

I was in touch with solar logs support, they said to me that there is no JSON support with solar log 50

A colleage said, maybe I have an issue with th ’ ´ " because when I just copy paste the script it doesn't work at all since I replaced all ´and with ".

What I want to see in Home Assistant is the production of my PV. I think it is the

“The current power generation from the panels is in [‘782’][‘1’].”

I think you’re right with waht you’re writing, nearly the same hardware delivering the data in almost the same format. Just because of compability within the company that makes absoluty sense.

The problem is that the ‘SolarLog’ cookie could not be found in the response. This could have different reasons, for example if the cookie was not set or if the name of the cookie is different.

So your script seems to be failing here

login_response.cookies[‘SolarLog’]

What if you print the cookie before. Maybe they have renamed the token from SolarLog to something else.
My understanding is that when you login, you are given a token as part of a login_response. That token is then needed to post the queries.