Starting a new thread as this was getting lost in the Hints, Tips & Troubleshooting thread.
Post details of your integration with Home Assistant etc.
Thanks. Would be good to put all of this info in a sticky/modify the first post with all the links.
I spent a bit of time updating my previous Web scraper to use pysolarmanv5, and now thabks to you pointing it out see reklamos has done exactly this (and better than I had!). My scraper was publishing to influxdb, so may add this as an option to his version.
Next step is the HA integration of all this. Currently I have my solar details in a grafana dashboard, but no HA integration at all.
It depenend what you want to see/do in HA. I am pulling close to ~100 registers as I want to see them in Grafana but in HA I just need couple of them for automation. In my implementation I use Prometheus instead of InfluxDB and also metrics are published to mqtt. HA pulls the few mettrics that it needs from mqtt.
Really nice work! Am away for a few days, but when I get back I'm going to set up your .yaml and tinker with it.
I've shared code for Solar Forecasting, battery charging and EDDI and Inverter monitoring, on GitHub: https://github.com/connesha/home-energy-mgr-ext-main
There's a good deal of information in the README for getting setup and running it. It was written over the past month or so, and has been running in some form during that period. So far it has provided what I wanted for my setup. If anyone tries it out and has issues, let me know.
There were a few enquiries about this post (#78) on Forecasting and Charging, so this is all the code behind it, and a few basic Home Assistant integrations.
There are lots of people on here with more advanced setups, done in different ways. This runs outside HA by design; others run within HA, but that's not the model I'm going with for now at least. Hopefully it's of some use to those getting setup.
It is a Work-In-Progress, and all the usual disclaimers that come with that. It is my first python programming, and first programming of any sort in about 10 years, so that's my excuses out of the way for the parts that are not so pythonic ;-)
Parts are built on top of code shared previously in this forum by @Jonathan, @reklamos and @garo, so thanks to them for also sharing.
Also, some parts are following ideas discussed with @bullit_dodger and @graememk
Works fine but does need the time of use to be turned on so can’t discharge at the same time - #AnotherOne who would really like the time of use settings to be exposed in the pvsolarmanv5 please @Jonathan but very very handy indeed thank you. I’ll have more of a look when I get time.
OK, so working off your code, my local copy now has InfluxDB working, with the following changes:
@reklamos - if you are interested in picking these up I can create a pull-request.
Also, could you share the homeassistant config you have for the subset MQTT published values you display?
See register 43110; https://www.scss.tcd.ie/coghlan/Elios4you/RS485_MODBUS-Hybrid-BACoghlan-201811228-1854.pdf
I shall indeed many thanks
I publish single json topic to MQTT instead of individual ones, this makes it faster and cleaner. I noticed with my testings before that if I do individual topics for each metric I was getting inconsistent behaviour from MQTT as it was not able to process topics fast enough. This is even more relevant to people running on RPI. But probable majority will not run into this since not all are pulling 1000s of metrics.
in configuration.yaml I have sensor: !include devices/sensors.yaml and then in devices/sensors.yaml I define my MQTT sensors that I want to pull to HA like this:
configuration.yam
sensor: !include devices/sensors.yaml
devices/sensors.yaml
- platform: mqtt state_topic: "solis/METRICS" unique_id: "sensor.today_generated" value_template: "{{ (value_json.today_generated | float) /10}}" name: "Generated Today" device_class: energy unit_of_measurement: "kWh" state_class: measurement
I didn't change the mqtt publish, except add optional authentication details, so still a single topic. Was just wondering if you've some HA code for arranging the panels to display the relevant info nicely. I'm new to HA so what I have looks a bit rough
I do not have anything special, I use tesla-style-solar-power-card in HA as that shows everyting I need in one place.
My card config is below but you'll need to adjust them based on your entity names.
type: custom:tesla-style-solar-power-card grid_consumption_entity: sensor.meter_power_in_modified house_consumption_entity: sensor.total_load_power_modified grid_to_house_entity: sensor.meter_power_in_modified grid_to_battery_entity: sensor.grid_to_battery_power_in_modified generation_to_grid_entity: sensor.meter_power_out_modified generation_to_battery_entity: sensor.battery_power_in_modified generation_to_house_entity: sensor.solar_to_house_power_modified battery_to_house_entity: sensor.battery_power_out_modified battery_extra_entity: sensor.battery_capacity_soc appliance1_consumption_entity: sensor.bypass_load_power appliance1_icon: mdi:server-network generation_icon: mdi:solar-power house_extra_entity: sensor.house_load_today generation_extra_entity: sensor.generated_today grid_extra_entity: sensor.imported_today grid_entity: sensor.meter_power_in_modified house_entity: sensor.total_load_power_modified generation_entity: sensor.total_solar_output_power battery_entity: sensor.battery_capacity_soc
You're using it wrong, all sensors need to be positive, never negative: https://github.com/reptilex/tesla-style-solar-power-card#templates-for-missing-sensors-or-for-negative-sensors
I know, but I see no reason why I should not use it when it works for me. I have not seen any disadvantages on having negative value on battery.
Thanks, have this working now. Bit of messing as had to install the add-on manually as I can't get HACS (my install is 2021.3 and 2021.9 or newer is needed for HACS), but once that was done it was just adding the mqtt sensors linked to the right values.
It's great to see the live values (or at worst 30 seconds old!) as solis cloud was at least 5-10 mins stale at the best of times.
So I've got the latest and greatest from https://github.com/StephanJoubert/home_assistant_solarman and have the config:
solarman: name: Solis inverter_host: 192.168.0.130 inverter_port: 8899 inverter_serial: <snip> inverter_mb_slaveid: 1 scan_interval: 30 lookup_file: solis_hybrid.yaml
But, I'm getting nothing, no entities and nothing in the logs. Any idea why? Manually trying the example from pysolarmanv5 works fine with the serial and IP (static).
Since 20e3280, config is via the UI. Docs need a tidy up ahead of next release.
20e3280
I saw that commit message, where in the UI? Can't find it in my integration.
Configuration -> Devices and Services -> Integrations -> Set up a new integration -> Solarman
How do you guys enable/disable grid charging of the battery? python I assume? What registers do you set? Can you share that code pls.
Is there an easy way to trigger that directly from HA Nodered and not have to mess with sending mqtt messages to the pi that's running the python code?
Has anyone here managed to get pysolarmanv5 code to run directly from nodered?
Ah, there it is. Weirdly it wasn't there last night after installing both manually and via HACS and post-restart. It's working great now, cheers for putting the changes in for that integration. Do you have any more features planned for it?
https://github.com/NosIreland/solismod works with nodered. Nodered published to mqtt and solismod pushes to solis.
Sweet, so is this ready for prime time now?
Do I still need a pi/docker/etc to run the python code or is it all runnable from within nodered now? Including the code that polls the registers I mean
To-do list is broadly as follows;
Pull requests welcome. 🙂
See post #278 above. BIT01 controls the timed charge mode. You'll need to read 43110 first to confirm what the value is first before XORing with 0x2 to set.
Cool, are you doing batch reads currently? I've tried cranking up the update rate and it's choking on anything faster than every 10 seconds which is surprising as I can read many more registers every 2 seconds from the SolaX inverter no problem.
Looks like it! Going to start hooking things up but I think this is it.
Yuo need to run python code somewhere. You can run it directly in the OS where you have HA/Nodered or you can run it as container. I have everything conatinerized as it makes it easier but do what works best for you.
Running HA OS so not sure if it's possible to add docker to it. Nodered is an addon of HA OS.So maybe this won't work for me, not a linux master or anything, in fact it's my least favorite OS 😁
Yes, but the Solis registers are a bit all over the place. The 50 or so sensors that are extracted as based on three reads requests of 100 registers each.
30 seconds polling is more than enough for my needs, so I haven't investigated much further, but I suspect the lag is introduced by the WiFi dongle. It doesn't help however, that the baud rate is only 9,600. @reklamos might be able to confirm the source of the slowness as he was previously reading directly off the RS485 port (bypassing the WiFi dongle).
You can run the script on windows or in docker on windows machine also. I actually write and test code on windows.
@mp3guy how many registers are you trying to read? Are you reading them in blocks or looping through each? As @Jonathan mentioned baud rate is only 9600. I am reading total of 129 registers devided in 8 blocks. It takes ~3-4s to do that but there is also overhead of formating, presenting and publishing. I would say the whole read is probably closer to 2s. I've read in some unoficial document that you should not exceed 100 registers in one go on solis modbus. My largest block has 34 registers.
https://github.com/StephanJoubert/home_assistant_solarman/blob/4d23fe8d25569efa4476b7c3e762f727712f4d9a/custom_components/solarman/inverter_definitions/solis_hybrid.yaml#L6 this set of three reads of 100 each, as Jonathan mentioned