pv_opt icon indicating copy to clipboard operation
pv_opt copied to clipboard

Support Request for Latest Solarman Integration

Open Pyinthesky99 opened this issue 1 year ago • 27 comments

Numerous Entities are inconsistent with the original version of Solarman.

Pyinthesky99 avatar Oct 11 '24 09:10 Pyinthesky99

Solarman at https://github.com/StephanJoubert/home_assistant_solarman doesnt look like its being actively supported.

There is a fork at https://github.com/davidrapan/ha-solarman which is active, however when applying a Solis related yaml file the sensor names are different.

The largest change is that there were previously separate entities for hours and minutes for the charge/discharge time registers but these are now combined into a single entity. A new inverter def of SOLIS_SOLARMAN_V2 has therefore been created to allow these entities to be read. This is being developed on branch "Patch2" on my Pv_opt fork.

Re writes, the previous SOLARMAN integration used "call_service/solarman" to write directly to a modbus register, which would mean hours and minutes would still be written separately. This servce (now called action in HA) exists in the new Solarman integration but it is unknown whether it will work in the same way if provided with a modbus register address. If not a different method will need to be found to write to the mode control, the charge/discharge current values and the charge/discharge start and end times - direct writes to the entities may work.

stevebuk1 avatar Oct 11 '24 11:10 stevebuk1

Apologies, had to rush out this morning so opened this issue and went. Was going to flesh-out the opening comment on my return but you have a far better understanding of the issues and have done a better job. Have un-hashed the lines in config.yaml but still getting in pv_opt.log 15:54:38 ERROR: id_timed_charge_current : Neither the entities listed in the YAML sensor.solis_timed_charge_current nor the system default of number.solis_timed_charge_current_limit exist in HA. error.log pv_opt.log config.yaml11-10-24.txt

Pyinthesky99 avatar Oct 11 '24 15:10 Pyinthesky99

I'd forgotten that whilst I've been keeping a master config yaml up to date, I haven't sent it to you for inclusion.

Just make your entries in Solarman_v2 say this

id_timed_charge_current: number.{device_name}_timed_charge_current

id_timed_discharge_current: number.{device_name}_timed_discharge_current

I.e both say number, not sensor.

stevebuk1 avatar Oct 11 '24 15:10 stevebuk1

Set to number and we now have idle with Read Only Mode set to off.

Last line of pv_opt.log... 16:32:47 INFO: No charge/discharge windows planned . Nothing to do.

Pyinthesky99 avatar Oct 11 '24 15:10 Pyinthesky99

Hurrah! Ok, so now run for 24 hours. This will log what's going to be written but without actually doing any writes. Hopefully there will be some charge windows scheduled, but that depends on Agile rates and amount of solar expected.

On Fri, 11 Oct 2024, 16:36 Pyinthesky99, @.***> wrote:

Set to number and we now have idle with Read Only Mode set to off.

Last line of pv_opt.log... 16:32:47 INFO: No charge/discharge windows planned . Nothing to do.

— Reply to this email directly, view it on GitHub https://github.com/fboundy/pv_opt/issues/273#issuecomment-2407665375, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASVRJMHBJKPLJ6QILQM55HLZ27V7HAVCNFSM6AAAAABPYP72SSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBXGY3DKMZXGU . You are receiving this because you commented.Message ID: @.***>

stevebuk1 avatar Oct 11 '24 15:10 stevebuk1

Hurrah indeed! Thanks for your help so far. Couldn't change 'Loading Configuation' in the 24 hours you have off?!! :-) Sunny day today but not great tomorrow apparently.

Pyinthesky99 avatar Oct 11 '24 15:10 Pyinthesky99

BTW the problem with my Status of Battery Charge and Discharge is that the entity sensor.solis_battery_power that I used in configuration.yaml to provide Charge and Discharge never goes to a negative! There doesn't seem to be a direct replacement in Solarman for the entity used to generate battery_input_energy/battery_output_energy in the standard dashboard.

Pyinthesky99 avatar Oct 11 '24 16:10 Pyinthesky99

Mmmm I was thinking afterwards that the number is always positive so it cant deduce charge or discharge. I guess you could read the text that says charge/discharge, add the appropriate sign and then run the template, but I suspect it's not worth it. Pv opt doesn't use it so it's just dashboard related. One for the future perhaps!

On Fri, 11 Oct 2024, 17:03 Pyinthesky99, @.***> wrote:

BTW the problem with my Status of Battery Charge and Discharge is that the entity sensor.solis_battery_power that I used in configuration.yaml to provide Charge and Discharge never goes to a negative! There doesn't seem to be a direct replacement in Solarman for the entity used to generate battery_input_energy/battery_output_energy in the standard dashboard.

— Reply to this email directly, view it on GitHub https://github.com/fboundy/pv_opt/issues/273#issuecomment-2407709867, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASVRJMBOPJ4JNAG5CKIFC33Z27ZDPAVCNFSM6AAAAABPYP72SSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBXG4YDSOBWG4 . You are receiving this because you commented.Message ID: @.***>

stevebuk1 avatar Oct 11 '24 19:10 stevebuk1

Anticipated it would be re-calculating every 10 mins, nothing in pt_opt.log since 16:32 yesterday.

Pyinthesky99 avatar Oct 12 '24 12:10 Pyinthesky99

Yes it should be recalculating every 10 mins, please post error.log and pv_opt.log. is the status still Idle?

stevebuk1 avatar Oct 12 '24 12:10 stevebuk1

Status is indeed still idle error.log pv_opt.log

Pyinthesky99 avatar Oct 12 '24 12:10 Pyinthesky99

Not entirely sure what's wrong. Can you change back to read only using the dashboard toggle and check it runs every 10 mins.

stevebuk1 avatar Oct 12 '24 13:10 stevebuk1

Toggled to Read-Only at 14:42 and it cycled around to Idle (Read Only). Waited to 14:55 and no more cycles or update to pv_opt.log config.yaml.txt error.log pv_opt.log solis.py.txt

Pyinthesky99 avatar Oct 12 '24 14:10 Pyinthesky99

Nothing to do with Solarman then. Do an edit to config.yaml and see if the restart then sorts it.

stevebuk1 avatar Oct 12 '24 14:10 stevebuk1

edit?

Pyinthesky99 avatar Oct 12 '24 15:10 Pyinthesky99

Guess any edit, have done.

Pyinthesky99 avatar Oct 12 '24 15:10 Pyinthesky99

Yes, any edit. Just a carriage return will do.

If you don't get a reoptimise on the 10 minute time turnover (i.e 10, 20, 30, 40, 50, 00) then try an appdeamon reboot.

stevebuk1 avatar Oct 12 '24 15:10 stevebuk1

Didn't seem too keen after auto-restart after edit so did a Developer Tools Restart and we have now had at least one 10min recalculate. It had come up with a plan after switching to Read only at 14:00 today which wasn't too realistic but has now come up with a decent plan, presumably as tomorrow's rates are out. Will see what it's like after another day? Will probably do some 'manual' charging overnight. Thanks again

Pyinthesky99 avatar Oct 12 '24 15:10 Pyinthesky99

Ok if you are getting 10 min recalculates in read only mode, set it to false and check we are still getting 10 minute recalcs, let me know if not otherwise try the 24 hours again?

Feel free to set the inverter to whatever you want, it won't affect the testing we are doing.

On Sat, 12 Oct 2024, 16:35 Pyinthesky99, @.***> wrote:

Didn't seem too keen after auto-restart after edit so did a Developer Tools Restart and we have now had at least one 10min recalculate. It had come up with a plan after switching to Read only at 14:00 today which wasn't too realistic but has now come up with a decent plan, presumably as tomorrow's rates are out. Will see what it's like after another day? Will probably do some 'manual' charging overnight. Thanks again

— Reply to this email directly, view it on GitHub https://github.com/fboundy/pv_opt/issues/273#issuecomment-2408603511, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASVRJMFWPKSXFS3T5OCSFNTZ3E6TNAVCNFSM6AAAAABPYP72SSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBYGYYDGNJRGE . You are receiving this because you commented.Message ID: @.***>

stevebuk1 avatar Oct 12 '24 16:10 stevebuk1

It has actually changed things slightly, I set the Inverter manually and the cycle now stops with Updating Inverter rather than continuing to Idle. I assume the script effectively uses just the first of the three charge and discharge time settings available manually? I had set manually using the first two pairs. Only the first shows on my Dashboard with the start/stop entities... image I have just reset the Inverter to charge using the second and third pair and it now cycles around to Idle. image

Pyinthesky99 avatar Oct 12 '24 16:10 Pyinthesky99

Thanks for the update. Despite me just saying that what the inverter is set to shouldn't matter, it does in some way because if the inverter start and end times are different and there is no charge plan, it will be trying to reset them to be the same.

If they are the same it doesn't need to write and so will go to idle, but if it does need to match them up it will attempt the writes and its either getting stuck (as they are disabled) so the start/end times remain different, or there's another problem. Can you post pv_opt.log and error.log so I can see.

stevebuk1 avatar Oct 12 '24 18:10 stevebuk1

You are quite right that Pv_opt only uses the first set of registers: contiguous slots are joined together and as the inverter recalculates every 10 mins it will just programme later slots slightly in advance of when needed, so theres no need to use the 2nd and 3rd slots

stevebuk1 avatar Oct 12 '24 18:10 stevebuk1

error.log pv_opt.log

Still humming away nicely!

Pyinthesky99 avatar Oct 12 '24 20:10 Pyinthesky99

Excellent!

This is your latest charge plan:

21:40:15     INFO: Optimal forced charge/discharge slots:
21:40:15     INFO:   12-Oct 23:30 BST - 13-Oct 00:30 BST  Power:  5000W  SOC:   38% ->   86%  
21:40:15     INFO:   13-Oct 03:00 BST - 13-Oct 04:30 BST  Power:  5000W  SOC:   79% ->  100%  
21:40:15     INFO:   13-Oct 05:00 BST - 13-Oct 05:30 BST  Power:   300W  SOC:   99% ->  100%  <=
21:40:15     INFO:   13-Oct 06:00 BST - 13-Oct 06:30 BST  Power:   300W  SOC:   99% ->  100%  <=

Agile has some excellent prices tonight I note, and Pv_opt is doing a good job of saying 'run from battery in the slightly more expensive slots' (04:30 to 5:00 and then 05:30 to 06:00).

I do expect it will run into problems at 23:30 when it tries to load the first charge plan, but this is what I'm after in the logs.

stevebuk1 avatar Oct 12 '24 21:10 stevebuk1

Thought I would check at 23:20 on Charge Schedule and Status was on updating inverter again, it had gone from nothing to do to "23:20:15 INFO: Disabling inverter timed discharge" in the log. So just as you said. Log looks like it thinks it has set the charge?

Status at 23:40

image

These are current logs, will send updated logs in the morning.

error.log pv_opt.log

Pyinthesky99 avatar Oct 12 '24 22:10 Pyinthesky99

Cycling back to idle this morning. error.log pv_opt.log

I guess all three pairs of timings have to be empty for a 'clean' 24hr cycle of optimization. Are the other two sets of times and Allow Charging from Grid available as entities?

Pyinthesky99 avatar Oct 13 '24 09:10 Pyinthesky99

Are the other two sets of times and Allow Charging from Grid available as entities?

Guess that's one for David Rapin.

Pyinthesky99 avatar Oct 13 '24 16:10 Pyinthesky99

Are the other two sets of times and Allow Charging from Grid available as entities?

They aren't in the default "Solis_hybrid.yaml" provided on the SolarMan repo. I note they aren't also part of the source file used to create the yaml file (https://www.scss.tcd.ie/Brian.Coghlan/Elios4you/RS485_MODBUS-Hybrid-BACoghlan-201811228-1854.pdf). However, they are certainly accessible as the Solax integration provides them. If you fancied having a play, you can get the modbus register numbers from the Solax integration here: https://github.com/wills106/homeassistant-solax-modbus/blob/main/custom_components/solax_modbus/plugin_solis.py, e.g search for "timed_charge_start_hours_2" within this file.

stevebuk1 avatar Oct 13 '24 21:10 stevebuk1

Thanks for the info, Steve. Not much of a Charge Plan for tonight!

Pyinthesky99 avatar Oct 13 '24 21:10 Pyinthesky99

I guess all three pairs of timings have to be empty for a 'clean' 24hr cycle of optimization.

Pv_opt only uses the first pair of charge start/end times and doesn't try to read the other two pairs. It runs clean if there is no charge windows that require setting, as the code can now load the values from Solarman to see if charge start and charge end are the same. If they are different, it will try and set them, but the setting process is still based on hours and minutes separately so the entities currently aren't found.

Separately to this is functionality of the inverter storage mode. This does have a single entity but it currently expects a number and is getting a string. Again, this is only checked when a charge window approaches.

Pv_opt has been written carefully to minimise the number of actual write operations to the inverter. The inverter itself will use non-volatile memory to store all these settings, and these memory locations have a limited number of reads and writes. Pv_opt therefore always reads the value to ensure it actually needs writing to before commanding the write and this is done at the very lowest level of code, which isnt particularly aware of what is actually being read/written. The reads are done from entities but the writes are done using modbus register numbers. Most of the other Solis integrations generally have a one2-one mapping between entities and Modbus registers which makes this easy, but the new Solarman definitions have changed this, e.g hours and minutes are now in a single entity.

I think the quickest way of getting this up and running will be a different approach for the 3 categories of 1) time registers, 2) inverter mode control and 3) current (charge rate) registers:

  1. Change solis_hybrid.yaml such that the new Solarman integration provides separate hours and minutes entities, as per the old.
  2. Update Pv_opt to deal with Solarmans storage control register providing strings rather than numbers (this is quite similar to Solax anyway)
  3. Current registers I think will work as is.

I guess what I'm really saying is this isn't going to be a quick job and we are probably looking at several weeks. If you are happy to continue then we will start with 1) and I'll create a new solis_hybrid.yaml file for use with Solarman.

stevebuk1 avatar Oct 13 '24 21:10 stevebuk1