Collect Inverter data from Solarman API

Everybody. Happy New Year!
Thank you Pentar! I have the sensor active in HA.
When I try to put them in the energy dashborad, the entity is not in the list. When i search why this is, it looks like the sensor has no unique ID. Therefore I will not see this in the list.

I have tried to put a ‘unique_id’ to the yaml file, but that gives an error. I also have the idea that the sensor is not registering anything. Should I mark it somewhere that I want the data to be registered?

Thanks in advance!

I understand it is not possible to add SOLARMAN data to the energy dashboard. This is the page with more information:

Maybe someone else knows how to configure the entity correctly so it will provide the statistics?

it is possible, take a look at the templates here:

in particular state_class: total_increasing and state_class: measurement are relevant

This is next level, so not sure what to do with it. At Supported platforms I only see Linux, how about a Raspberry Pi?

raspberry Pi is supported by linux/arm/v7

All, I have dealt with this within Domoticz when Trannergy did switch over to their new API. Figuring out a solution, I created a python script which is extracting the information you guys seems to discuss in this trail. Being Domoticz tired, I try to switch over to HA. The solution as described in this trail is good, but will stop working when the access token expires…and it will expire. Nevertheless, is the script as attached been able to be connected to a sensor so it will work ik HA?

import http.client, urllib.request, json, hashlib
from datetime import datetime

# Trannergy account details
apiSite = "api.solarmanpv.com"
appID = ""  # Change to your own appID, to be provided from Trannergy/Solarman
appSecret = ""  # Change to your own appSecret, to be provided from Trannergy/Solarman
email = ""  # Change to your own account name/mail address
password = b""  # Change password to your own, maintain the b in front of the password as password need to be binary

conn = http.client.HTTPSConnection(apiSite)
password = hashlib.sha256(password).hexdigest()

# domoticz settings
domoticz_host = "x.x.x.x"  # ip adress of the domoticz host
domoticz_port = "8080"
domoticz_url = "json.htm"
domoticz_ActualPower = "111"  # idx of new device

# Request access token, manaul chapter/routine 2.1
payload = json.dumps({
    "appSecret": appSecret,
    "email": email,
    "password": password
})
headers = {
    "Content-Type": "application/json"
}
conn.request("POST", f"/account/v1.0/token?appId={appID}&language=en", payload, headers)
res = conn.getresponse()
data = json.loads(res.read())
accesstoken = data["access_token"]
print(f"Accesstoken : {accesstoken}")

# Request current power + lastupdate time + stationID, manual chapter/routine 4.4
payload = json.dumps({
    "page": 1,
    "size": 20
})
headers = {
    "Content-Type": "application/json",
    "Authorization": "bearer " + accesstoken
}
conn.request("POST", "/station/v1.0/list?language=en", payload, headers)
res = conn.getresponse()
data = json.loads(res.read())
stationID = data["stationList"][0]["id"]
currentpower = data["stationList"][0]["generationPower"]
lastupdatetime = datetime.fromtimestamp(data["stationList"][0]["lastUpdateTime"])
print(f"Current Power :{currentpower}W")
print(f"Last update time :{lastupdatetime}")
print(f"StationID : {stationID}")

# Request deviceID + deviceSN, manual chapter/routine 4.2
payload = json.dumps({
    "deviceType": "INVERTER",
    "page": 1,
    "size": 10,
    "stationId": stationID
})
headers = {
    "Content-Type": "application/json",
    "Authorization": "bearer " + accesstoken
}
conn.request("POST", "/station/v1.0/device?language=en", payload, headers)
res = conn.getresponse()
data = json.loads(res.read())
deviceID = data["deviceListItems"][0]["deviceId"]
deviceSN = data["deviceListItems"][0]["deviceSn"]
print(f"Device serial : {deviceSN}")
print(f"Device ID : {deviceID}")

# Total generated power, manual chapter/routine 3.3
payload = json.dumps({
    "deviceSn": deviceSN,
    "deviceId": deviceID
})
headers = {
    "Content-Type": "application/json",
    "Authorization": "bearer " + accesstoken
}
conn.request("POST", "/device/v1.0/currentData?language=en", payload, headers)
res = conn.getresponse()
data = json.loads(res.read())
totalgenpower = float(data["dataList"][16]["value"]) * float(1000.0)
print(f"Total generated power : {totalgenpower}W")

# uploading values to domoticz
url = f"http://{domoticz_host}:{domoticz_port}/{domoticz_url}?type=command&param=udevice&idx={domoticz_ActualPower}" \
      f"&nvalue=0&svalue={currentpower};{totalgenpower} "
#urllib.request.urlopen(url)
print(url)

@lechk82

unfortunately I have tried several methods running with docker-compose.

On my synology it tells me:

ERROR:root:Error on start: 'dataList'

On my raspberry pi 4 it tells me:

ERROR:root:Error on start: Expecting value: line 1 column 1 (char 0)

Also running as Python gives me the same error.

ERROR:root:Error on start: Expecting value: line 1 column 1 (char 0)

When running as single instance:

Traceback (most recent call last):
  File "run.py", line 225, in <module>
    main()
  File "run.py", line 217, in main
    single_run(args.file)
  File "run.py", line 119, in single_run
    config = load_config(file)
  File "run.py", line 22, in load_config
    config = json.load(config_file)
  File "/usr/lib/python3.8/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I have the same issue with ‘dataList’

➜  solarman-mqtt git:(main) ✗ sudo python3 run.py -d
INFO:root:Starting daemonized with a 300 seconds run interval
ERROR:root:Error on start: 'dataList'
➜  solarman-mqtt git:(main) ✗

and the config file is:

➜  solarman-mqtt git:(main) ✗ cat config.json
{
  "name": "HomePV",
  "url": "api.solarmanpv.com",
  "appid": "my app id from mail",
  "secret": "secret from mail",
  "username": "[email protected]",
  "passhash": "hash password",
  "stationId": 1******,
  "inverterId": 21******,
  "loggerId": 203******,
  "debug" : false,
  "mqtt":{
    "broker": "10.0.0.15",
    "port": 1883,
    "topic": "solarmanpv",
    "username": "*******",
    "password": "********"
  }
}#                                                                                                                                                               ➜  solarman-mqtt git:(main) ✗

Dose anyone have the same problem , or just me and @dannyplace

I was able to use the info above to created sensors for each item pulled by the API. I created them in the new template format so you can use them in the Energy module.

Sensor.yaml

### Solarman API ###
- platform: rest
  resource: https://api.solarmanpv.com/device/v1.0/currentData?appId=xxxxxxxxxxxxxxx&language=en&=
  method: POST
  name: solarman_invert
  scan_interval: 600
  headers:
    Authorization: bearer yyyyyyyyyyyyyyyyyy
    Content-Type: application/json
  payload: '{  "deviceSn": "<serial number of my invertor>"}'
  json_attributes:
      - dataList
  value_template: 'OK'

- platform: rest
  resource: https://api.solarmanpv.com/device/v1.0/currentData?appId=xxxxxxxxxxxxxxx&language=en&=
  method: POST
  name: solarman_logger
  scan_interval: 600
  headers:
    Authorization: bearer yyyyyyyyyyyyyyyyyy
    Content-Type: application/json
  payload: '{  "deviceSn": "<serial number of my logger>"}'
  json_attributes:
      - dataList
  value_template: 'OK'

template.yaml

- sensor:
####### SolarMan Logger ######    
  - name: "{{ state_attr('sensor.solarman_logger','dataList')[0].name }}"
    #unit_of_measurement:  
    state: "{{ state_attr('sensor.solarman_logger','dataList')[0].value }}"
    unique_id:  solarman_logger_sn1
#
  - name: "{{ state_attr('sensor.solarman_logger','dataList')[1].name }}"
    #unit_of_measurement:  
    state: "{{ state_attr('sensor.solarman_logger','dataList')[1].value }}"
    unique_id:  solarman_logger_mduv1
#
  - name: "{{ state_attr('sensor.solarman_logger','dataList')[2].name }}"
    unit_of_measurement:  s
    state: "{{ state_attr('sensor.solarman_logger','dataList')[2].value }}"
    unique_id:  solarman_logger_work_tim1
#
  - name: "{{ state_attr('sensor.solarman_logger','dataList')[3].name }}"
    unit_of_measurement:  s
    state: "{{ state_attr('sensor.solarman_logger','dataList')[3].value }}"
    unique_id:  solarman_logger_offset_tim1
#
  - name: "{{ state_attr('sensor.solarman_logger','dataList')[4].name }}"
    unit_of_measurement:  Min
    state: "{{ state_attr('sensor.solarman_logger','dataList')[4].value }}"
    unique_id:  solarman_logger_send_period1
#
  - name: "{{ state_attr('sensor.solarman_logger','dataList')[5].name }}"
    unit_of_measurement:  s
    state: "{{ state_attr('sensor.solarman_logger','dataList')[5].value }}"
    unique_id:  solarman_logger_collect_period1
#
  - name: "{{ state_attr('sensor.solarman_logger','dataList')[6].name }}"
    #unit_of_measurement:  
    state: "{{ state_attr('sensor.solarman_logger','dataList')[6].value }}"
    unique_id:  solarman_logger_max_conn_n1
#
  - name: "{{ state_attr('sensor.solarman_logger','dataList')[7].name }}"
    #unit_of_measurement:  
    state: "{{ state_attr('sensor.solarman_logger','dataList')[7].value }}"
    unique_id:  solarman_logger_sgits1
#
  - name: "{{ state_attr('sensor.solarman_logger','dataList')[8].name }}"
    unit_of_measurement:  s
    state: "{{ state_attr('sensor.solarman_logger','dataList')[8].value }}"
    unique_id:  solarman_logger_hea_f1
#
  - name: "{{ state_attr('sensor.solarman_logger','dataList')[9].name }}"
    #unit_of_measurement:  
    state: "{{ state_attr('sensor.solarman_logger','dataList')[9].value }}"
    unique_id:  solarman_logger_iv_curve
#
  - name: "{{ state_attr('sensor.solarman_logger','dataList')[10].name }}"
    #unit_of_measurement:  
    state: "{{ state_attr('sensor.solarman_logger','dataList')[10].value }}"
    unique_id:  solarman_logger_bath_command
#
  - name: "{{ state_attr('sensor.solarman_logger','dataList')[11].name }}"
    #unit_of_measurement:  
    state: "{{ state_attr('sensor.solarman_logger','dataList')[11].value }}"
    unique_id:  solarman_logger_s_r_u_p
#
  - name: "{{ state_attr('sensor.solarman_logger','dataList')[12].name }}"
    #unit_of_measurement:  
    state: "{{ state_attr('sensor.solarman_logger','dataList')[12].value }}"
    unique_id:  solarman_logger_safi
#
####### SolarMan Invertor ######
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[0].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[0].value }}"
    unique_id:  solarman_invert_sn1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[1].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[1].value }}"
    unique_id:  solarman_invert_hwv1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[2].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[2].value }}"
    unique_id:  solarman_invert_m_s_v
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[3].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[3].value }}"
    unique_id:  solarman_invert_v_s_v
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[4].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[4].value }}"
    unique_id:  solarman_invert_s_m_v
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[5].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[5].value }}"
    unique_id:  solarman_invert_comm_cpu_swv1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[6].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[6].value }}"
    unique_id:  solarman_invert_dv1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[7].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[7].value }}"
    unique_id:  solarman_invert_dv2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[8].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[8].value }}"
    unique_id:  solarman_invert_dc1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[9].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[9].value }}"
    unique_id:  solarman_invert_dc2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[10].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[10].value }}"
    unique_id:  solarman_invert_dp1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[11].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[11].value }}"
    unique_id:  solarman_invert_dp2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[12].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[12].value }}"
    unique_id:  solarman_invert_av1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[13].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[13].value }}"
    unique_id:  solarman_invert_av2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[14].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[14].value }}"
    unique_id:  solarman_invert_av3
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[15].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[15].value }}"
    unique_id:  solarman_invert_ac1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[16].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[16].value }}"
    unique_id:  solarman_invert_ac2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[17].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[17].value }}"
    unique_id:  solarman_invert_ac3
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[18].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[18].value }}"
    unique_id:  solarman_invert_t_ac_op
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[19].name }}"
    unit_of_measurement:  Hz
    state: "{{ state_attr('sensor.solarman_invert','dataList')[19].value }}"
    unique_id:  solarman_invert_a_fo1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[20].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[20].value }}"
    unique_id:  solarman_invert_vog_o1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[21].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[21].value }}"
    unique_id:  solarman_invert_vog_o2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[22].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[22].value }}"
    unique_id:  solarman_invert_vog_o3
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[23].name }}"
    unit_of_measurement: kWh
    state: "{{ (state_attr('sensor.solarman_invert','dataList')[23].value | float) | round(2) }}"
    unique_id:  solarman_invert_et_ge0
    device_class: energy
    state_class: total_increasing
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[24].name }}"
    unit_of_measurement: kWh
    state: "{{ state_attr('sensor.solarman_invert','dataList')[24].value }}"
    unique_id:  solarman_invert_etdy_ge1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[25].name }}"
    unit_of_measurement:  kW
    state: "{{ state_attr('sensor.solarman_invert','dataList')[25].value }}"
    unique_id:  solarman_invert_actpv
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[26].name }}"
    unit_of_measurement:  mA
    state: "{{ state_attr('sensor.solarman_invert','dataList')[26].value }}"
    unique_id:  solarman_invert_dcp_c1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[27].name }}"
    unit_of_measurement:  mA
    state: "{{ state_attr('sensor.solarman_invert','dataList')[27].value }}"
    unique_id:  solarman_invert_dcp_c2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[28].name }}"
    unit_of_measurement:  mA
    state: "{{ state_attr('sensor.solarman_invert','dataList')[28].value }}"
    unique_id:  solarman_invert_dcp_c3
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[29].name }}"
    unit_of_measurement:  mV
    state: "{{ state_attr('sensor.solarman_invert','dataList')[29].value }}"
    unique_id:  solarman_invert_dcp_v1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[30].name }}"
    unit_of_measurement:  mV
    state: "{{ state_attr('sensor.solarman_invert','dataList')[30].value }}"
    unique_id:  solarman_invert_dcp_v2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[31].name }}"
    unit_of_measurement:  mV
    state: "{{ state_attr('sensor.solarman_invert','dataList')[31].value }}"
    unique_id:  solarman_invert_dcp_v3
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[32].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[32].value }}"
    unique_id:  solarman_invert_pcc_ac1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[33].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[33].value }}"
    unique_id:  solarman_invert_pcc_ac2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[34].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[34].value }}"
    unique_id:  solarman_invert_pcc_ac3
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[35].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[35].value }}"
    unique_id:  solarman_invert_apo_t_l1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[36].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[36].value }}"
    unique_id:  solarman_invert_r_p_t
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[37].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[37].value }}"
    unique_id:  solarman_invert_l_ap1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[38].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[38].value }}"
    unique_id:  solarman_invert_l_ap2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[39].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[39].value }}"
    unique_id:  solarman_invert_l_ap3
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[40].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[40].value }}"
    unique_id:  solarman_invert_st_pg1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[41].name }}"
    unit_of_measurement:  Hz
    state: "{{ state_attr('sensor.solarman_invert','dataList')[41].value }}"
    unique_id:  solarman_invert_pg_f1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[42].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[42].value }}"
    unique_id:  solarman_invert_pg_pt1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[43].name }}"
    unit_of_measurement: kWh
    state: "{{ (state_attr('sensor.solarman_invert','dataList')[43].value | float) | round(2) }}"
    unique_id:  solarman_invert_t_gc1
    device_class: energy
    state_class: total_increasing

  - name: "{{ state_attr('sensor.solarman_invert','dataList')[44].name }}"
    unit_of_measurement: kWh
    state: "{{ (state_attr('sensor.solarman_invert','dataList')[44].value  | float) | round(2)}}"
    unique_id:  solarman_invert_et_pu1
    device_class: energy
    state_class: total_increasing

  - name: "{{ state_attr('sensor.solarman_invert','dataList')[45].name }}"
    unit_of_measurement: kWh
    state: "{{ state_attr('sensor.solarman_invert','dataList')[45].value }}"
    unique_id:  solarman_invert_t_gc_tdy1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[46].name }}"
    unit_of_measurement: kWh
    state: "{{ state_attr('sensor.solarman_invert','dataList')[46].value }}"
    unique_id:  solarman_invert_etdy_pu1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[47].name }}"
    unit_of_measurement:  mA
    state: "{{ state_attr('sensor.solarman_invert','dataList')[47].value }}"
    unique_id:  solarman_invert_clk1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[48].name }}"
    unit_of_measurement:  KΩ
    state: "{{ state_attr('sensor.solarman_invert','dataList')[48].value }}"
    unique_id:  solarman_invert_n_iinfo1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[49].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[49].value }}"
    unique_id:  solarman_invert_v_busneg1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[50].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[50].value }}"
    unique_id:  solarman_invert_e_cuse1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[51].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[51].value }}"
    unique_id:  solarman_invert_e_cuse2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[52].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[52].value }}"
    unique_id:  solarman_invert_e_cuse3
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[53].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[53].value }}"
    unique_id:  solarman_invert_e_puse_t1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[54].name }}"
    unit_of_measurement: kWh
    state: "{{ (state_attr('sensor.solarman_invert','dataList')[54].value  | float) | round(2)}}"
    unique_id:  solarman_invert_et_use1
    device_class: energy
    state_class: total_increasing
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[55].name }}"
    unit_of_measurement: kWh
    state: "{{ state_attr('sensor.solarman_invert','dataList')[55].value }}"
    unique_id:  solarman_invert_etdy_use1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[56].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[56].value }}"
    unique_id:  solarman_invert_b_st1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[57].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[57].value }}"
    unique_id:  solarman_invert_bcid
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[58].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[58].value }}"
    unique_id:  solarman_invert_bca
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[59].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[59].value }}"
    unique_id:  solarman_invert_b_p1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[60].name }}"
    unit_of_measurement:  AH
    state: "{{ state_attr('sensor.solarman_invert','dataList')[60].value }}"
    unique_id:  solarman_invert_bcap1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[61].name }}"
    unit_of_measurement:  "%"
    state: "{{ state_attr('sensor.solarman_invert','dataList')[61].value }}"
    unique_id:  solarman_invert_b_hlt_exp1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[62].name }}"
    unit_of_measurement: kWh
    state: "{{ (state_attr('sensor.solarman_invert','dataList')[62].value | float) | round(2)}}"
    unique_id:  solarman_invert_t_cg_n1
    device_class: energy
    state_class: total_increasing
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[63].name }}"
    unit_of_measurement: kWh
    state: "{{ (state_attr('sensor.solarman_invert','dataList')[63].value | float) | round(2)}}"
    unique_id:  solarman_invert_t_dcg_n1
    device_class: energy
    state_class: total_increasing
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[64].name }}"
    unit_of_measurement: kWh
    state: "{{ state_attr('sensor.solarman_invert','dataList')[64].value }}"
    unique_id:  solarman_invert_etdy_cg1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[65].name }}"
    unit_of_measurement: kWh
    state: "{{ state_attr('sensor.solarman_invert','dataList')[65].value }}"
    unique_id:  solarman_invert_etdy_dcg1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[66].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[66].value }}"
    unique_id:  solarman_invert_b_typ1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[67].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[67].value }}"
    unique_id:  solarman_invert_p_bap1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[68].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[68].value }}"
    unique_id:  solarman_invert_vtr1_bap1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[69].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[69].value }}"
    unique_id:  solarman_invert_cr1_bap1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[70].name }}"
    unit_of_measurement:  "%"
    state: "{{ state_attr('sensor.solarman_invert','dataList')[70].value }}"
    unique_id:  solarman_invert_soc_bap1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[71].name }}"
    unit_of_measurement:  "%"
    state: "{{ state_attr('sensor.solarman_invert','dataList')[71].value }}"
    unique_id:  solarman_invert_soh_bap1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[72].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[72].value }}"
    unique_id:  solarman_invert_cycle_t_bap1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[73].name }}"
    unit_of_measurement:  ℃
    state: "{{ state_attr('sensor.solarman_invert','dataList')[73].value }}"
    unique_id:  solarman_invert_t_bap1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[74].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[74].value }}"
    unique_id:  solarman_invert_p_bap2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[75].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[75].value }}"
    unique_id:  solarman_invert_vtr_bap2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[76].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[76].value }}"
    unique_id:  solarman_invert_cr_bap2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[77].name }}"
    unit_of_measurement:  "%"
    state: "{{ state_attr('sensor.solarman_invert','dataList')[77].value }}"
    unique_id:  solarman_invert_soc_bap2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[78].name }}"
    unit_of_measurement:  "%"
    state: "{{ state_attr('sensor.solarman_invert','dataList')[78].value }}"
    unique_id:  solarman_invert_soh_bap2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[79].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[79].value }}"
    unique_id:  solarman_invert_cycle_t_bap2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[80].name }}"
    unit_of_measurement:  ℃
    state: "{{ state_attr('sensor.solarman_invert','dataList')[80].value }}"
    unique_id:  solarman_invert_t_bap2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[81].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[81].value }}"
    unique_id:  solarman_invert_bms_s_p0
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[82].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[82].value }}"
    unique_id:  solarman_invert_bms_s_p1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[83].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[83].value }}"
    unique_id:  solarman_invert_bms_s_a0
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[84].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[84].value }}"
    unique_id:  solarman_invert_bms_s_a1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[85].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[85].value }}"
    unique_id:  solarman_invert_bms_s_t1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[86].name }}"
    unit_of_measurement:  ℃
    state: "{{ state_attr('sensor.solarman_invert','dataList')[86].value }}"
    unique_id:  solarman_invert_t_mdu1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[87].name }}"
    unit_of_measurement:  ℃
    state: "{{ state_attr('sensor.solarman_invert','dataList')[87].value }}"
    unique_id:  solarman_invert_spat
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[88].name }}"
    unit_of_measurement:  ℃
    state: "{{ state_attr('sensor.solarman_invert','dataList')[88].value }}"
    unique_id:  solarman_invert_t_rdt2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[89].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[89].value }}"
    unique_id:  solarman_invert_systim1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[90].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[90].value }}"
    unique_id:  solarman_invert_bc1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[91].name }}"
    unit_of_measurement:  Min
    state: "{{ state_attr('sensor.solarman_invert','dataList')[91].value }}"
    unique_id:  solarman_invert_ge_t_today
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[92].name }}"
    unit_of_measurement:  Min
    state: "{{ state_attr('sensor.solarman_invert','dataList')[92].value }}"
    unique_id:  solarman_invert_ge_t_total
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[93].name }}"
    unit_of_measurement:  h
    state: "{{ state_attr('sensor.solarman_invert','dataList')[93].value }}"
    unique_id:  solarman_invert_t_w_hou1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[94].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[94].value }}"
    unique_id:  solarman_invert_boot_count_down
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[95].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[95].value }}"
    unique_id:  solarman_invert_bus_v1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[96].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[96].value }}"
    unique_id:  solarman_invert_v_buspos1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[97].name }}"
    unit_of_measurement:  W
    state: "{{ state_attr('sensor.solarman_invert','dataList')[97].value }}"
    unique_id:  solarman_invert_arp
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[98].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[98].value }}"
    unique_id:  solarman_invert_rc
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[99].name }}"
    unit_of_measurement:  V
    state: "{{ state_attr('sensor.solarman_invert','dataList')[99].value }}"
    unique_id:  solarman_invert_tv
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[100].name }}"
    unit_of_measurement:  A
    state: "{{ state_attr('sensor.solarman_invert','dataList')[100].value }}"
    unique_id:  solarman_invert_tc
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[101].name }}"
    unit_of_measurement:  ℃
    state: "{{ state_attr('sensor.solarman_invert','dataList')[101].value }}"
    unique_id:  solarman_invert_cat
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[102].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[102].value }}"
    unique_id:  solarman_invert_inv_st1
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[103].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[103].value }}"
    unique_id:  solarman_invert_arc
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[104].name }}"
    unit_of_measurement:  "%"
    state: "{{ state_attr('sensor.solarman_invert','dataList')[104].value }}"
    unique_id:  solarman_invert_aol
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[105].name }}"
    unit_of_measurement:  kΩ
    state: "{{ state_attr('sensor.solarman_invert','dataList')[105].value }}"
    unique_id:  solarman_invert_ipv
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[106].name }}"
    unit_of_measurement:  mA
    state: "{{ state_attr('sensor.solarman_invert','dataList')[106].value }}"
    unique_id:  solarman_invert_ilcl
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[107].name }}"
    unit_of_measurement:  mA
    state: "{{ state_attr('sensor.solarman_invert','dataList')[107].value }}"
    unique_id:  solarman_invert_dcitv2
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[108].name }}"
    unit_of_measurement:  mA
    state: "{{ state_attr('sensor.solarman_invert','dataList')[108].value }}"
    unique_id:  solarman_invert_dcitv3
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[109].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[109].value }}"
    unique_id:  solarman_invert_dci_s
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[110].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[110].value }}"
    unique_id:  solarman_invert_dci_t
#
  - name: "{{ state_attr('sensor.solarman_invert','dataList')[111].name }}"
    #unit_of_measurement:  null
    state: "{{ state_attr('sensor.solarman_invert','dataList')[111].value }}"
    unique_id:  solarman_invert_dci_f
4 Likes

I think it is working now @bino!

@bino unfortunately it is still not working. So the sensors are working as an entity and I get output. But in the energy dashboard is tells me:

statistics_not_defined

  • sensor.template_solarman_invert_et_pu1

statistics_not_defined

  • sensor.template_solarman_invert_et_use1

Finally it is working. I had to modify some sensors in the template.yaml in order to get the right metrics.

1 Like

remove the “#” at the end or your config.json.
Besides, you can try GitHub - mpepping/solarman-mqtt: Send Solarman Smart PV inverter metrics to MQTT

Hi,

I have a second system “inverter”.
No idea how the “config.json” must be.

json error - dublicate key “name” …

{
  "name": "garage",
  "url": "api.solarmanpv.com",
  "appid": "xxxxxx",
  "secret": "xxxxxx",
  "username": "[email protected]",
  "passhash": "xxxxxxx",
  "stationId": xxxxxx,
  "inverterId": xxxxxx,
  "loggerId": xxxxxx,
  "debug" : false,
  "mqtt":{
    "broker": "aaaaaaaaaa",
    "port": 1883,
    "topic": "solarmanpv_garage",
    "username": "user",
    "password": "password"
  },
  "name": "west",
  "url": "api.solarmanpv.com",
  "appid": "xxxxx",
  "secret": "xxxxx",
  "username": "[email protected]",
  "passhash": "xxxxxxx",
  "stationId": yyyyy,
  "inverterId": yyyyy,
  "loggerId": yyyyy,
  "debug": false,
  "mqtt": {
      "broker": "aaaaaaaaa",
      "port": 1883,
      "topic": "solarmanpv_west",
      "username": "user",
      "password": "password"
  }
}

The less satisfying answer for now would be running an additional solarman-mqtt container, with a separate config for the second inverter.
You can always open an issue or pr on https://github.com/mpepping/solarman-mqtt.

Hi @tijnski ,

That’s exactly what I did. But would be “nice” with only one config.

Thanks…

what do you guys do when the token expires?

Hello guys, sorry if you might see my post in another group as well, I am trying to get some help and no one seems to know the answer. I’m trying to obtain my token from solarman, but I am getting the following:
{
“code”: “2101018”,
“msg”: “auth appId not found”,
“success”: false,
“requestId”: “e24a8a34f10be85a”
}
I am sure I put the correct data in the input, does anyone have any idea what could be wrong?
I’m running the following post command:

curl --request POST
–url ‘https://api.solarmanpv.com/account/v1.0/token?appId=&language=en&=’
–header ‘Content-Type: application/json’
–data ‘{
“appSecret”: “KEY_provided_by_solarman”,
“email”: “[email protected]”,
“password”: “hashed_password_of_my_solarman_account”
}’
Do I need to put the AppID as well?
Thanks.

Please look to my post, this is working like a charm in Domoticz but I’m missing the connect to HA

@PLnewbie Any chance you could explain how this works in Home Assistant? My token just expired and had to manually renew. I’ve looked at your code, but I wouldn’t know how to implement this within Home Assistant.