Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Solar PV Monitoring/Automation Thread

Options
1293032343570

Comments

  • Registered Users Posts: 6,079 ✭✭✭championc


    You could add a relay board to an Eddi, with PT1000 sensor to read temps.

    But what does the Tesla thing do ??



  • Registered Users Posts: 1,080 ✭✭✭silver_sky


    I've been playing around a bit with the met eireann forecast and finally got it roughly where I want. Will see how that goes now.

    Each night after generation has stopped, the accuracy (estimate vs generation) is updated on a sensor. Then I have a statistics sensor getting the 7 day mean of that accuracy. Finally, that 7 day accuracy is now being brought back into the script.

    Other changes include the time restrictions which are to avoid wiping out the today forecast when running the forecast for tomorrow. I usually call the forecast for today at 1am and then tomorrow at 8pm.

    import datetime
    from weatherforecast import WeatherForecast
    
    
    @service
    def meteireann_solarforecast():
        weather = WeatherForecast(53.54321, -6.12345)
        weather.load_weather_data()
    
        accuracy = float(state.get('sensor.solar_forecast_accuracy_7_day')) /100
    
    
        arrayMultiplier = 0.187*23.104/1000 # panelEfficiency * panelArea(m2) / 1000 (to kWh)
    
    
        today = round(weather.get_radiation_for_date_total(datetime.date.today()) * arrayMultiplier * accuracy,1)
        tomorrow = round(weather.get_radiation_for_date_total(datetime.date.today() + datetime.timedelta(days=1)) * arrayMultiplier * accuracy,1)
    
    
        current_time = (datetime.datetime.now().strftime("%H:%M"))
    
    
        if "00:00" < current_time < "07:59": 
            state.set("sensor.meteireann_solarforecast_today", today,{'friendly_name':'Met Éireann Solar Today','icon':'mdi:solar-power','unit_of_measurement':'kWh','device_class':'energy'})
            state.set("sensor.meteireann_solarforecast_tomorrow", tomorrow,{'friendly_name':'Met Éireann Solar Tomorrow','icon':'mdi:solar-power','unit_of_measurement':'kWh','device_class':'energy'})
        elif "08:00" < current_time < "23:59": 
            state.set("sensor.meteireann_solarforecast_tomorrow", tomorrow,{'friendly_name':'Met Éireann Solar Tomorrow','icon':'mdi:solar-power','unit_of_measurement':'kWh','device_class':'energy'})
    


  • Registered Users Posts: 1,716 ✭✭✭poker--addict


    Tesla thing; https://www.tsmart.co.uk/videos

    basically a replacement element and thermostat, or you can just buy the thermostat and smart head piece. From there you can set desired temperature and or times remotely.

    The Shelly might do the same thing or close enough if a fairly accurate temp can be retrieved by its externally probe.


    Eddi is a difference beast, and 4x or 5x the price.

    😎



  • Registered Users Posts: 68 ✭✭Niceday20


    I am also using @Jonathan met eireann script, but I have been running it every hour. This shows me that the forecasts are updated around 06:00/12:00/18:00/24:00 UTC (subtract 1 hour for summer time) if you are trying to get the "Latest" prediction.

    Will have a look at your script as well. 👍️

    As @bullit_dodger says on the daily PV production thread, tomorrow looks terrible in the West as well = 1.76kWh on 4.8kWp system.



  • Registered Users Posts: 1,080 ✭✭✭silver_sky


    That's good to know on the time for the updates to the forecast. Yeah, my forecast for tomorrow is rotten. It's showing 1.3kWh on my 4.5kWp~ SW system. I guess I'll be charging tonight.



  • Advertisement
  • Registered Users Posts: 3,373 ✭✭✭randombar


    I might have asked this in the wrong post, has anyone built the sofar2mqtt with MAX3485?

    Trying to figure out if I can use the Tx/Rx pre soldered pins or is there something else on the board I need to wire to.



  • Registered Users Posts: 2,474 ✭✭✭bullit_dodger


    It's improved marginally. I was computing under 2Kwhr for tomorrow, but I see it's jumped to a whopping 2.2kwhr now. Yaah, "Go solar!" - LOL



  • Registered Users Posts: 1,080 ✭✭✭silver_sky


    My forecast for tomorrow has crept up from 1.3 to 1.8kWh 😅



  • Registered Users Posts: 68 ✭✭Niceday20


    Mine has changed to. Up from 1.73kWh to 1.97kWh on 4.8kWp,

    but not at the times I stated above. This update was around 10am, rather than the more normal 05:00/11:00/17:00/23:00 Summer time that I have seen before



  • Registered Users Posts: 1,716 ✭✭✭poker--addict


    wow, that forecast is surprisingly accurate. That really is not what I would have expected. I am religious about checking the weather!

    😎



  • Advertisement
  • Registered Users Posts: 1,080 ✭✭✭silver_sky


    I updated my timed charging automation last night so it calculates the charge rate in amps based on the battery state of charge and voltage. Intention is to fill the cheap rate time rather than charge to 100% in a short time.

    However, it seems that the actual charge added was about a third extra than the calculation so it ran over the allotted time. It's a PureDrive II 5kWh DC battery that I have. I worked out the amount to charge based on difference between 100% and SOC and 5000 for the battery size.

    Am I missing something? losses? battery bigger than 5kWh? bit of everything?



  • Registered Users Posts: 2,257 ✭✭✭SD_DRACULA


    Are you using @connesha code a few pages back?

    The only thing I can think of is to check the values of the battery voltage, max Wh, min % SOC, total Wh, usable Wh, etc



  • Registered Users Posts: 1,080 ✭✭✭silver_sky


    No, using my own. Basically getting the difference between current SOC and my target then multiplying by battery size (5000) and dividing by voltage to get amps. Rounding off to zero decimal places and multiplying by 10 to convert to the deciamps that the Solis wants.

    I can't find anything about usable capacity on the PureDrive DC batteries. If I look at the discharge kWh and % change in SOH, then it matches up with 5000Wh. The charging kWh and % change in SOH don't match.



  • Registered Users Posts: 2,257 ✭✭✭SD_DRACULA


    I assume you drain that down to 10% which would mean 4500wh usable.

    This is the script I use with Home Assistant and it is very accurate, maybe 1-2% higher charge than I set it to but but close enough that it doesn't bother me (cannot complain about more usable power)

    set_night_charge:
      alias: "Set Night Charge"
      icon: mdi:flash
      variables:
        charge_voltage: 53
        charge_hours: 9
        night_usage_wh: 3500
        battery_capacity_wh: 20480
        lower_soc_limit: 15
        now_soc: "{{ states('sensor.solar_battery_soc') }}"
        target_soc: "{{ states('input_number.grid_charge_to_soc') }}"
        soc_to_wh: "{{ (battery_capacity_wh / 100) | int }}"
        now_battery_usable_wh: "{{ ((now_soc - lower_soc_limit) * soc_to_wh) | int }}"
        target_battery_usable_wh: "{{ ((target_soc - lower_soc_limit) * soc_to_wh )| int }}"
        energy_storage_mode: >-
          {% if (now_battery_usable_wh - night_usage_wh) > target_battery_usable_wh and is_state('input_boolean.force_always_charge', 'off') %}
            49
          {% else %}
            51
          {% endif %}
        charge_needed_wh: "{{ target_battery_usable_wh - (now_battery_usable_wh) }}"
        current_needed_a: "{{ ((charge_needed_wh/charge_hours) / charge_voltage) }}"
        current_needed_deci_amps: >-
          {% if current_needed_a < 0.1 %}
            0
          {% elif current_needed_a > 1000 %}
            1000
          {% else %}
            {{ (current_needed_a * 10 ) | int }}
          {% endif %}
      sequence:
        - service: script.inverter_set_energy_storage_mode
          data:
            storage_mode: "{{ energy_storage_mode }}"
        - delay:
            seconds: 30
        - service: script.inverter_set_charge_current
          data:
            current_da: "{{ current_needed_deci_amps }}"
    

    You'd want to plug in your version of these values:

    charge_voltage: 53
        charge_hours: 9
        night_usage_wh: 3500
        battery_capacity_wh: 20480
        lower_soc_limit: 15
    


  • Registered Users Posts: 6,079 ✭✭✭championc


    Can you use a different approach - charge and watch the SOC% constantly, and simply stop charging when the SOC% reaches your target level ?

    I do this with Node-Red and my ME3000, telling it to charge overnight until SOC hits xx%.



  • Registered Users Posts: 2,257 ✭✭✭SD_DRACULA



    That was my initial thought as well but with working out the charge Amps you get a lower and longer charge rate which is better for the batteries anyway and the added bonus is that this way the car can get charged during the night period without having to mess with pausing the battery as all is running from grid.



  • Registered Users Posts: 1,080 ✭✭✭silver_sky


    This is essentially what I've been doing. I'm setting it to charge until it reaches my input target. The change now is that I'm also trying to get it to spread the charging over the cheap tariff hours (2-5am) rather than at the start.

    The issue I'm seeing is that it's taking approx 1.25-1.3x the kWh to charge vs discharge, so it ran over and took until about 5.45am to charge.

    Are these normal losses?


    Here's my automation for anyone interested

    alias: Solis - Timed Charge
    description: ""
    trigger:
      - platform: time
        at: "02:00:00"
    condition:
      - condition: state
        entity_id: input_boolean.solis_timed_charge
        state: "on"
    action:
      - service: script.inverter_write_holding_register
        data:
          register_addr: 43141
          register_value: >-
            {{ ((((states('input_number.time_charge_soc') | int -
            states('sensor.solis_battery_soc') | int) /100 *
            5000/100*states('sensor.solis_battery_soh') | int ) /
            states('sensor.solis_battery_voltage') | int) /
            states('input_number.solis_timed_charge_hours') | int) | round(0) *10 }}
      - delay:
          hours: 0
          minutes: 0
          seconds: 15
          milliseconds: 0
      - service: script.inverter_write_holding_register
        data:
          register_addr: 43110
          register_value: 51
      - wait_for_trigger:
          - platform: template
            value_template: >-
              {{ states('sensor.solis_battery_soc')|float >
              states('input_number.time_charge_soc')|float -1 }}
      - service: script.inverter_write_holding_register
        data:
          register_addr: 43141
          register_value: 0
      - delay:
          hours: 0
          minutes: 0
          seconds: 15
          milliseconds: 0
      - service: script.inverter_write_holding_register
        data:
          register_addr: 43110
          register_value: 49
    mode: single
    
    
    


  • Registered Users Posts: 1,080 ✭✭✭silver_sky


    Could it be that usable is 5kWh and gross is 6.2kWh? I can't see net/gross specs anywhere on it - just 5kWh. With 10,000 cycles and 1C charging & discharging it must have a buffer of some sort surely?



  • Registered Users Posts: 188 ✭✭connesha


    You've got a bug in there @SD_DRACULA .

    See this line:

          {% elif current_needed_a > 1000 %}
    

    It should be comparing to 100, not 1000, as that variable is Amps. You run the risk of setting up to 1000A (10000 deciAmps) in the subsequent else block the way it is there, which is in unknown territory for the Solis. That whole if-else block acts as a safety-clamp to keep within the register ranges, as well as converting from Amps to deciAmps.


    See original post here with the correct value:


    Other than that, glad to hear that its working well for you.



  • Registered Users Posts: 1,716 ✭✭✭poker--addict


    what data bank /forecast specifically are you all using for the sunlight forecast. I don’t see what might be relevant on met.ie?

    😎



  • Advertisement
  • Moderators, Home & Garden Moderators Posts: 5,902 Mod ✭✭✭✭graememk




  • Registered Users Posts: 2,257 ✭✭✭SD_DRACULA


    Nice spot, thanks for that, fixed. I'm sure that register has min-max values (you'd hope) and it wouldn't accept 1000A 🤣

    Maybe that was in there in the original post and was fixed later? I don't think I messed around with anything other than the values at the top.



  • Registered Users Posts: 1,080 ✭✭✭silver_sky


    I bumped the battery size in my calculation up to 6250 and it seems to be closer. My charge started at 2am and finished at 4.41am. I was aiming for 5am so at least it's under that time. I may drop it down slightly and see how that goes. Certainly the 5kWh PureDrive is more than 5kWh gross.

    I also revised my automation to avoid errors. Now, if the target is lower than the current state of charge it will set the amps to 0 rather than calculate a negative value. Also I've set a lower level as I found it wouldn't accept below around 4A. So, the range it will work in 5-50A. It will calculate the appropriate charge amps based on the target % and time allowed. Both of these are set from a card. I may automate the target.



  • Registered Users Posts: 19 viewofthehill


    Hi all,

    I had solar installed at the start of August and have been spending the last number of weeks looking at the reports from the Solarman smart app. I have also been following along here to see what others are doing regarding automation etc. and have been convinced to spend some time at it. I started at the start of this thread and am trying initially to get the Home Assistant Solarman integration working. I have the integration showing on Home assistant but it is not giving any information. I've tried using pysolarmanv5 to query my inverter (I have a solarman data logging stick with a Sofar HYD 6000 EP inverter) but I am not getting any information back from any of the input registers (30000+) and getting a CRC error when trying to read the holding registers (40000+).

    Sorry for the basic question but is there something I am doing wrong or does pysolarmanv5 not work with Sofar inverters? I don't think i'm using a newer logger as the serial number is 10 digits beginning in 235. From memory the firmware on the logger begins with LSW3 and not some of the firwares mentioned earlier in this thread. Has anyone managed to get this working on a Sofar inverter or knows if the mapping is the same/similar to that in the TCD pdf.

    I would be grateful for any advice, hints or tips at this point.



  • Moderators, Home & Garden Moderators Posts: 5,902 Mod ✭✭✭✭graememk


    I haven't got the pysolarmanv5 to work on my me3000, but it seems others have got the solarman intergration running.

    The sofar registers are completely different (well on its rs485 connection)

    Have a peek here

    https://www.facebook.com/groups/2477195449252168/?ref=share

    It's the Facebook group for the sofar automation.



  • Moderators, Home & Garden Moderators Posts: 5,902 Mod ✭✭✭✭graememk


    Finally starting to automate overnight charging of the Solis Hybrid.

    I'm looking into using pyscript to have some basic scripts to

    a) Change the Charge hour from 9 to 0 if I want to disable or enable overnight discharge

    b) second script to set the Charge Amps to say 50, and then set it to 0 when the soc is reached.


    @Jonathan

    I cant seem to get the pysolarmanv5 imported.. I have the option checked in the pyscript settings to auto import

    from pysolarmanv5 import PySolarmanV5
    
    @service
    def Cottage_ChargeHour(hour=None):
    	
    	if hour is not None:
    	  modbus = PySolarmanV5("10.1.1.107", 123456789)
    	  modbus.write_holding_register(43145, value= hour) ##Charge Hour
    	  log.info(modbus.read_holding_registers(register_addr=43145, quantity=1)) 
    

    I know I'm missing something but not sure what.


    The error is :

    • Exception in </config/pyscript/CottageHybridChargeHour.py> line 2: from pysolarmanv5 import PySolarmanV5 ^ ModuleNotFoundError: No module named 'pysolarmanv5'




  • Moderators, Home & Garden Moderators Posts: 5,902 Mod ✭✭✭✭graememk


    Urgh, Sorry.. I should have read your instructions.. RTFM!

    I skipped the printf bit



  • Moderators, Home & Garden Moderators Posts: 5,902 Mod ✭✭✭✭graememk


    Wanted to get it done tonight, so brute forced it...

    but Didnt see any examples on how to pass variables into it from automation.. is it as simple as letting it autocomplete and then just putting the variable in brackets.. I have seen how to do it on the python side so that bit I know.

    eg Pyscript Python scripting: cottage_chargeamps500(Chargeamps)



  • Moderators, Education Moderators, Home & Garden Moderators Posts: 8,120 Mod ✭✭✭✭Jonathan


    You got it.

    For anyone else following along, you need to create a requirements.txt file, containing the names of the required python packages, one per line:

    pysolarmanv5
    umodbus
    


    A more complete example with yaml annotation is below. This will generate the actions dialog in the automation and developer UI.

    from pysolarmanv5 import PySolarmanV5
    
    @service
    def inverter_setchargecurrent(current=None):
       """yaml
    name: Solis Hybrid Set Charge Current
    description: Solis Hybrid Set Charge Current
    fields:
     current:
        description: Charge Current (Amps)
        required: true
        example: 12.5
        default: 12.5
        selector:
          number:
            min: 0
            max: 100
            step: "any"
            mode: box
            unit_of_measurement: "A"
    """
       if 0<=current<=100:    
           modbus = PySolarmanV5("192.168.1.200", 1234567890)
           modbus.write_holding_register(register_addr=43141, value=int(current*10))
       else:
           log.error("inverter_setcurrent_charge: Incorrect parameters")
           return False
    

    Pass the argument as you would any service:

    service: pyscript.inverter_setchargecurrent
    data:
     current: 12.5
    


  • Advertisement
  • Moderators, Home & Garden Moderators Posts: 5,902 Mod ✭✭✭✭graememk


    Great thanks. The automation worked perfectly last night.



Advertisement