I have followed this thread and failed. But had instant success with
[GitHub - hultenvp/solis-sensor: HomeAssistant integration for the Ginlong Solis PV Monitoring portal. This integration supports the current Platform v2.0 portal (m.ginlong.com) which supports Solis and Solarman PV inverter brands. Also supports new SolisCloud platform]
github.com
https://github.com/hultenvp/solis-sensor
The github site has instructions on how to install. Thank you hultenvp.
It also worked for me. After trying a lot I found this post and it is working now.
Hi
I installed this today but I donāt get any sensors coming upā¦how do I fix it?
Thanks for this, as a noob to home assistantā¦this is exactly what I needed and works really well!
I did try for around a day to get various other options working, however there is nothing simpler than your example which just requires adding a few lines of code to your config, job done!
I installed my Solis data logger today and thus ended up reading through all of this. I then found that my Web UI is entirely different again, and the code for configuration.yaml doesnāt work. The reason is that the new status.html response has the variable declarations as the code snippets looked for but the values are no longer set there, those declarations draw from an array that must be populated somewhereā¦anyway simple answer is that I discovered that the data is now exposed through inverter.cgi directly rather than scraping status.html. Much easier.
inverter.cgi responds with (xxx masking some of my serial number as Solis use that as their UID!):
060Exxxxxxxxxxxx;3D0023;E5;35.8;250;5.100000;d;NO;
And as such I now used the much simpler code:
sensor:
- platform: rest
resource: http://192.168.1.246/inverter.cgi
authentication: basic
username: admin
password: xxxxx
timeout: 2
unit_of_measurement: "W"
state_class: measurement
value_template: '{% if value|length < 25 %} {% set value = "0;0;0;0;0;0" %} {% endif %} {{ value.split(";")[4] }}'
device_class: energy
name: Solis PV Now
- platform: rest
resource: http://192.168.1.246/inverter.cgi
authentication: basic
username: admin
password: xxxxxx
timeout: 2
unit_of_measurement: "kWh"
state_class: total_increasing
value_template: '{% if value|length < 25 %} {% set value = "0;0;0;0;0;0" %} {% endif %} {{ value.split(";")[5] }}'
device_class: energy
name: Solis PV Today
scan_interval: 300
(edit: I realised that without state_class you canāt then use the data in the energy dashboards so added it. Note I have used total_increasing rather than total for the day value as I find my logger reports 0 sometimes. I might change it back to total if I find that the next non zero figure is huge as it means there is a bug in the portal. I might even exclude the sensor eventuallyā¦ymmv)
(edit 2: this is driving me mad as the logger is just all over the place so i might have to suck it up and use the solis cloud integration instead, but Iāll leave this here in case anyone can make it work for them). But I just found I canāt as SOlis cloud is not currently allowing new API keys to be made ā¦ grr
(edit 3 updated the code here rather than having outdated copies, see post below)
Right, having fought to understand what on earth is happening, it dawned on me that an early post talked about the need for a proxy when the inverter is off. Its a rainy day and my inverter kept turning off while I was testing it! This also resets the daily yield counter, stupidly, and hence I use the state_class total_increasing which allows for 0 resets and only considers increments to counters as change.
Furthermore I also discovered that when you set the stick up for the first time the password by default is 123456789 but when you reboot it (or, more fundamentally, the inverter turns off due to lack of sun then turns on again) the password changes to the password for the wifi network.
So I have edited the code above to include some Jinja code in the value template to fix when the response is incorrect, forcing the returned value to be 0, otherwise when the inverter is off HA shows the last received value instead of 0, skewing lots of usage calcs in the interim. It checks the response and if its less tan 25 characters long (a valid response is always more as the serial alone is 16 chars) then it replaces the variable with 0s separated by semicolons, thus meaning the resulting return call of value[4] or value[5] both return 0.
I have also updated the device class to energy so its accepted by the energy dashboard.
There is one last issue which is if HA reboots while the inverter is off, the sensor is not included in HA until the rest connection has at least one successful connection to the server. I donāt know what it will do tonight when the inverter turns off but I am hoping it returns 0.
Did you manage to find a solution to your āone last issueā Chris?
Iāve set my Mam & Dads system up using your solution as all others wouldnāt work with the latest Solis WiFi Stick (I have older sticks on my 3 systems so have managed other ways)
As you had pointed out, if HA is restarted during sundown the entities do not show until the inverter next powers up. I have no idea how to rectify this
I was also interested to see was other data was there so tried adding additional entries
0 = Inverter Serial Number
1 = Inverter Version
2 = Inverter Model
3 = Inverter Temperature
4 = Power Now
5 = Yield Today
6 = Total Yield
7 = ??
How can I divide number 5 by 10 in the yaml line
Sorry wasnāt watching for replies
Iām on my phone so I canāt test the code but to divide by 5 you probably need to just add /10 after the [5]
I havenāt fixed the other issue no, I have another question open that hasnāt been responded to yet. The code as is handled some error conditions but doesnāt set that last 0 we want when unavailable
Chris
OK, cheers Chris. Iāll try a bit more research and testing myself but unfortunately Iām pretty crap at it
Iāve also been using an appdaemon addon to scrape 2 of my inverters (I have 5, 3 Solis & 2 Samil Power)
that have a fairly recent version of the Solis Data logging WiFi stick (but not the very latest) that utilizes ā/status.htmlā could that be modified to utilize the ā/inverter.cgiā for the most current sticks or could the code that deals with NO SUN be adapted for your system?
else: # no sun, no power
entity = "sensor.solis_appdaemon_1_current_power"
self.set_state(entity, state = 0)
Brilliant, thanks so much for posting this. Not sure why Solis have made it so difficult for people to get their own solar production data. This solution worked perfectly for me, and the tip in one of your other posts about the password for the data logging stickās admin page being set to the same as the wifi network password was a godsend - I donāt think Iād have ever got round to guessing that!
Yeah I need to have a play. On another thread templates seem to be an answer. I have been flat out for a few weeks but once I get some downtime I want to fix this so Iāll post what I learn
Hi,
have anybody already tried to contact Modbus TCP Interface on Port 8899 from Solis key ?
Iām totally new with HomeAssistant, but in iobroker Iāve managed to fetch already a few parameter of the interface by contacting certain Modbus addresses.
I know, with the newly available solisCloud API there is maybe an easier way to fetch the data from the cloudā¦ But for a local solution, the modbus server is maybe the better way
But unfortunatly, Iāve no experiance now how to use modbus adapter in Home Assistent. Iāve tried already to extend my configuration.yaml by adding these lines:
modbus:
- type: tcp
name: āSolisā
close_comm_on_error: true
delay: 5
timeout: 5
host: 192.168.3.238
port: 8899
But this didnāt create any adapter on the interface, where I maybe can just add a few modbus addresses.
Maybe somebody else is now motivated to do further investigation together to create a nice solution.
Thanks
Method works fine, display correctly in HA GUI but I see errors in logs, any clue what could it be?:
Logger: homeassistant.helpers.entity
Source: helpers/template.py:1834
First occurred: 13:15:37 (9 occurrences)
Last logged: 13:18:37
Update for sensor.panels_current_power fails
Update for sensor.panels_energy_today fails
Update for sensor.panels_total_production fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 541, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 739, in async_device_update
raise exc
File "/usr/src/homeassistant/homeassistant/components/rest/entity.py", line 63, in async_update
self._update_from_rest_data()
File "/usr/src/homeassistant/homeassistant/components/rest/sensor.py", line 173, in _update_from_rest_data
value = self._value_template.async_render_with_possible_json_value(
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 625, in async_render_with_possible_json_value
return _render_with_context(self.template, compiled, **variables).strip()
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2007, in _render_with_context
return template.render(**kwargs)
File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1834, in regex_findall_index
return regex_findall(value, find, ignorecase)[index]
IndexError: list index out of range
Anybody tried to fetch real time data using http interface? Seems like numbers on inverter.cgi are updated every 5 minutes or so.