just to confirm you only have quotes around “myserial”
appId and token are without quotes.
just to confirm you only have quotes around “myserial”
appId and token are without quotes.
hey,
Yes only quotes on mySerial, others don’t have quotes in the code
Then the only difference I see is that I do not have the force_update line… and my scan _interval is 360.
I do not think they update values more often than 5 minutes.
Can you see anything in the logs? Rebooted HA?
fixed it , tnx for the help.
seems like the actie nfig wasn’t the one I had in my notepad
Hi,
i saw in the openAPI documentation there is a way to push data to the inverter (send a time-of-use command for the battery for example) with this method : https://globalapi.solarmanpv.com/device/v1.0/remoteControl
I try to use it but in this method we need to send a “controlCode” and i can’t find it, is anyone know where i could find this code ?
Hi there,
These sensors work for me, after setting up. But, and here is the question, when trying to add them to the energy dashboard, it won’t take the sensors Total charging & total discharging. Is it because there is no class set to these sensors ?
Kr,
Bart
Everything is working for me so far except I want to read historical data from the solarman api and display it elsewhere but it keeps throwing errors and I cannot find out why.
Hope anybody might be able to help
Am I the only one to whom it STOPPED working? I had it for few months and now I’m getting:
{
"code": "2101010",
"msg": "appId insufficient allowance",
"success": false,
"requestId": "cae59aa1eea2c55a"
}
using curl on :
https://globalapi.solarmanpv.com/account/v1.0/token?appId=<my_appid>&language=en
and I’m not able to obtain a TOKEN anymore.
I had that a few months ago… email to support got it resolved…
OK, I’ve emailed them and they have fixed it. Thanks anyway
Here is a script that generates the sensors for the currentData API:
Go to https://reqbin.com/curl
Execute this script (replace your variables)
curl --request POST \
--url 'https://globalapi.solarmanpv.com/device/v1.0/currentData?appId=*YOUR_APP_ID*&language=en&=' \
--header 'Authorization: bearer *YOUR_ACCESS_TOKEN*' \
--header 'Content-Type: application/json' \
--data '{
"deviceSn": "SP1XXX"
}'
Copy the entire returned content from from the curl post and insert it here:
const solarmanApi = /* paste here
{
"code": null,
"msg": null,
"success": true,
...
*/ ;
const dataList = solarmanApi.dataList;
let sensors = "- sensor:\n";
dataList.forEach((item) => {
let name = "Solarman " + item.name.trim();
let unique_id =
"solarman_" + item.name.toLowerCase().trim().replace(/[^\w]/gi, "_");
let device_class = "";
let state_class = "";
if (item.unit) {
if (item.unit.toLowerCase().includes("wh")) {
device_class = "energy";
state_class = "total_increasing";
} else if (item.unit.toLowerCase().includes("w")) {
device_class = "power";
state_class = "measurement";
} else if (item.unit.toLowerCase().includes("v")) {
device_class = "voltage";
state_class = "measurement";
} else if (item.unit.toLowerCase().includes("a")) {
device_class = "current";
state_class = "measurement";
} else if (item.unit.toLowerCase().includes("%")) {
device_class = "battery";
state_class = "measurement";
} else if (item.unit.toLowerCase().includes("c")) {
device_class = "temperature";
state_class = "measurement";
} else if (item.unit.toLowerCase().includes("hz")) {
device_class = "frequency";
state_class = "measurement";
}
}
sensors += ` - name: "${name}"
unique_id: "${unique_id}"\n`;
if (item.unit) {
sensors += ` unit_of_measurement: "${item.unit}"\n`;
}
if (device_class) {
sensors += ` device_class: ${device_class}\n`;
}
if (state_class) {
sensors += ` state_class: ${state_class}\n`;
}
sensors += ` state: "{{ state_attr('sensor.solarman_inverter_data', 'dataList') | selectattr('key', 'eq', '${item.key}') | map(attribute='value') | first }}"
`;
});
copy(sensors);
Copy the replaced code and paste the entire code in Chrome Console (F12 > Console). Hit enter.
Sensors are now copied to your clipboard. You can paste them e.g. in /templates/solarman_base.yaml
My HA Setup:
configuration.yaml
sensor: !include_dir_merge_list sensors
template: !include_dir_merge_list templates
/sensors/solarman.yaml
- platform: rest
resource: https://globalapi.solarmanpv.com/device/v1.0/currentData?appId=*YOUR_APP_ID*&language=en&=
method: POST
name: solarman_inverter_data
scan_interval: 300
headers:
Authorization: !secret solarman_access_token
Content-Type: application/json
payload: '{ "deviceSn": "SP1XXX" }'
verify_ssl: false
json_attributes:
- dataList
value_template: "OK"
/templates/solarman_base.yaml
- sensor:
- name: "Solarman SN"
unique_id: "solarman_sn"
state: "{{ state_attr('sensor.solarman_inverter_data', 'dataList') | selectattr('key', 'eq', 'SN1') | map(attribute='value') | first }}"
...
Anyone getting api error today? Mine stopped working… reset my token, but getting “invalid token” now.
Oh a strange one, think maybe my token died prematurely, I made a hash of renewing it and then broke my sensors trying to fix what wasn’t broken Finally seem to have it working now again.
Mine stopped working too… how do you reset your token ? And how did you manage to get it working again ???
Thanks in advance !
Kr,
Bart
My token was expired too. This was because my solarpanels have been malfunctioning for 2 weeks. But the procedure is mentioned at post 153 of this thread. You need the access token and replace this with your current value at bearer in the config code.
Hi, has anyone downloaded archived data from Solarman to save in HA (MySQL)?
What is the deviceSn that you are using? I have my logger/inverter set up in pro.solarmanpv.com, and I can see data being genereated. But when I get to the step where I insert the access token and deviceSn, all I get is “device not found” error message. I have a serial for my logger and inverter, both giving the same error. Is there something I’m missing? Where do I find this deviceSn?
:SOLVED:
Hello Everyone!
I have been working on integrating my inverter for a few days now. But can’t seem to understand why the sensor data won’t display in home assistant. I tested everything via the Curls command and could see the data for the logger and the inverter.
I created a separate sensor for the both of them but only the data of the logger will display within home assistant.
I tried different methods where i tried to gain a part of the sensor by using the path configuration as displayed but it will only show that the state is unknown.
I think part of the problem might be the fact that there is a T at the start of the serial number of my inverter. But as far as I can tell the payload is read as a string so that shouldn’t be the issue.
payload: ‘{ “deviceSn”: T62060…etc.}’
The brand used is the Afore 6 kw, a sub-brand which uses the Solarman logger.
I honestly have no idea what I am doing wrong at the moment. I might want to try the Mqtt route, but am fairly unfamiliar with the process so the instructions are a bit unclear for me.
Thanks in advance!
EDIT: I was right and the system couldn’t read the Serial number. I put it between brackets “T62060…” and it could the number
After having the luxury of getting realtime data from my inverter via Modbus RTU since August, my inverter was replaced last week because it had an issue. Until I figure out how to pull real time data from the new inverter, I need to collect the data using the Solarman API. I thought this would be a simple thing to do, as I have done it before, and I was of the impression that the method still worked (I’m the writer of post 153).
However, I got stuck at step 6: using JSON Path Finder to find the appropriate value_jsons to bring into Home Assistant. As I only got an error message, I searched for an alternative that accepts the code from my earlier post:
curl --request POST \
--url 'https://globalapi.solarmanpv.com/device/v1.0/currentData?appId=APIID&language=en&=' \
--header 'Authorization: bearer ACCESSTOKEN' \
--header 'Content-Type: application/json' \
--data '{
"deviceSn": "SERIALNUMBER"
}'
I finally found out that the solution is to paste the code into Recbins Run Curl Commands Online and click “Run”. Then click JSON (placed above the window below where I pasted the code). Then you are able to find the appropriate value_jsons to bring into Home Assistant.
Dear all,
I guess I need some advise where to next look into, else I might give up.
I tried all 3 discussed ways to read data from my Deye Sun600 inverter but all seem to fail. mostly.
My Serial # of the inverter starts with 41***, so there seems to be totally different ModBus adresses used than the ones I can find ind various documents. If anyone has a documentions for those converters with 41*** serial numbers, I’d appraciate any guidance.
I managed to get the app ID, secret, all I need etc and was able to address the API with CURL, getting back the JSON response I need regarding available data the API provides.
Basically I only get a dataList which consists of 10 entities, such as device serial #, firmware version, …, MAC address, … and it ends with the WiFI SSID used.
Copying the CURL response into json path finder also only shows10 data points available. If I compare other’s API output this is frustrating. Somehow it seems to me the API does not reveal my energy data at all.
Clues??
{
"code": null,
"msg": null,
"success": true,
"requestId": "2bdf27ac36b7ed4a",
"deviceSn": "417######",
"deviceId": 2203####,
"deviceType": "COLLECTOR",
"deviceState": 1,
"collectionTime": 1709137950,
"dataList": [{
"key": "SENSOR_LI1",
"value": "5406",
"unit": null,
"name": "sensor List"
}, {
"key": "SN1",
"value": "417#######",
"unit": null,
"name": "Embedded Device SN"
}, {
"key": "MDUv1",
"value": "MW3_16U_5406_2.32-D1",
"unit": null,
"name": "Module Version No"
}, {
"key": "ESv1",
"value": "V1.1.00.11",
"unit": null,
"name": "Extended System Version"
}, {
"key": "SEND_PERIOD1",
"value": "5",
"unit": "Min",
"name": "Data Uploading Period"
}, {
"key": "COLLECT_PERIOD1",
"value": "60",
"unit": "s",
"name": "Data Acquisition Period"
}, {
"key": "max_conn_n1",
"value": "1",
"unit": null,
"name": "Max. No. of Connected Devices"
}, {
"key": "SGits1",
"value": "49",
"unit": null,
"name": "Signal Strength"
}, {
"key": "MDU_MAC_ADD1",
"value": "##########",
"unit": null,
"name": "Module MAC Address"
}, {
"key": "R_SSID",
"value": "#######",
"unit": null,
"name": "Router SSID"
}]
}
I’m hoping it’s just a small mistake?
I copied the following lines into my configuration.yaml, but get an error message on the template. What else do I need to do?
'# Solarman local logger
sensor:
- name: solarmanlocal_power_solar_now
platform: command_line
command: curl -s -u admin:admin http://192.168. 178.39/status.html | grep -E "\webdata_now_p(\s|$)" | cut -d'"' -f 2
unit_of_measurement: 'W'
scan_interval: 10
- name: solarmanlocal_power_solar_today
platform: command_line
command: curl -s -u admin:admin http://192.168. 178.39/status.html | grep -E "\webdata_today_e(\s|$)" | cut -d'"' -f 2
unit_of_measurement: 'kWh'
scan_interval: 60
- name: solarmanlocal_power_solar_total
platform: command_line
command: curl -s -u admin:admin http://192.168. 178.39/status.html | grep -E "\webdata_total_e(\s|$)" | cut -d'"' -f 2
unit_of_measurement: 'kWh'
scan_interval: 60
template:
sensor:
- name: "solarmanlocal_production_daily"
state: "{{ states('sensor.solarmanlocal_power_solar_total')}}"
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
unique_id: solarmanlocal_production_daily