homeassistant-solcast icon indicating copy to clipboard operation
homeassistant-solcast copied to clipboard

Support multiple rooftops ?

Open B-Hartley opened this issue 3 years ago • 10 comments

As SolCast are stopping tuning, they are offering up to two rooftops per accounts to allow for split arrays. How difficult would it be for your component to take two RoofTop IDs, get forecasts for both and add them together?

Or to allow you component to be setup twice with different info, I could then add it together myself.

Thanks, Bruce.

B-Hartley avatar Mar 16 '21 15:03 B-Hartley

Hi Bruce, from software architecture view I would go with the second solution, as some of the users might have two completelly different PV system to be observed. I guess the API limit is valid for both RoofTops, that might need some refactoring of the code ...

I am currently busy with a wast colleaction schedule integration, thus do not have time for the solcast integration right now.

dannerph avatar Mar 16 '21 19:03 dannerph

No problem. So can two sessions of your integration be added in it’s current form. could I make copies of it and change one to solcast2 or something.

B-Hartley avatar Mar 16 '21 20:03 B-Hartley

As a temporary fix, I've made a copy of thecustom component under the domain "solcastx" and that way I can run two separate instances and add them together. If anyone else wants to do that and needs a hand, let me know.

B-Hartley avatar Mar 23 '21 15:03 B-Hartley

These instructions were helpful in creating a duplicate component: https://community.home-assistant.io/t/how-can-i-create-a-custom-component-by-copying-another/120455

nonlinearsugar avatar Apr 16 '21 14:04 nonlinearsugar

Yes, that's pretty much what I did. Thanks

B-Hartley avatar Apr 16 '21 15:04 B-Hartley

thanks for this - worked for me

monkeydust avatar Apr 26 '21 16:04 monkeydust

This was the template sensor I created to combine the two separate estimates, and the gauge. Does anyone know how to include the "Tomorrow" and "The day after tomorrow" attributes?

#Add to configuration.yaml
sensor:
  - platform: template
    sensors:
      solcast_forecast_total:
        friendly_name: "Solcast Forecast - Total"
        value_template: "{{ states('sensor.solcast_forecast') | float + states('sensor.solcast_forecast_2') | float }}"
        unit_of_measurement: "kWh"
        unique_id: "FpE8m3GmgBsQ"


#Add to Dashboard
type: sensor
entity: sensor.solcast_forecast_total
graph: line

nonlinearsugar avatar Apr 26 '21 17:04 nonlinearsugar

It would be........

sensor:
  - platform: template
    sensors:
      solcast_forecast_tomorrow_total:
        friendly_name: "Solcast Forecast Tomorrow - Total"
        value_template: "{{ state_attr('sensor.solcast_forecast','Tomorrow') | float + state_attr('sensor.solcast_forecast_2','Tomorrow') | float }}"
        unit_of_measurement: "kWh"
        unique_id: "xxxxxxxxxxxxx"

B-Hartley avatar Apr 27 '21 15:04 B-Hartley

As a temporary fix, I've made a copy of thecustom component under the domain "solcastx" and that way I can run two separate instances and add them together. If anyone else wants to do that and needs a hand, let me know.

I want to say: great stuff that you already did this. I have an east-west solar configuration on my roof and use two sites for it in Solcast. I would like to add them together and also limit them to the max output of my inverter (I know the Python math for that :))

I have copied the "solcast" custom component folder and renamed it "solcastx", I have also changed the latter manifest.json. I have the following in my configuration.yaml:

solcast: api_key: XXXXX resource_id: EAST api_limit: 20 disable_ssl_check: False disable_automatic_forecast_fetching: False disable_automatic_history_fetching: False

solcastx: api_key: XXXXX resource_id: WEST api_limit: 20 disable_ssl_check: False disable_automatic_forecast_fetching: False disable_automatic_history_fetching: False

However, upon adding an entity in the dashboard, it only sees "sensor.solcast_forecast" entity but not the "x" variants.

What am I doing wrong?

EDIT: In addition to editing manifest.json, I also edited the "domain" in init.py to "solcastx", now it seems that I do have "sensor.solcast_forecast_2"!

Aereau avatar May 27 '21 11:05 Aereau

There's a bit more to it than that. You have to actually change the code inside the custom component. Take a look at my solcastx custom component.

https://github.com/B-Hartley/bruces_homeassistant_config/tree/main/custom_components/solcastx

Strangely, I'm not acutally using it, as my tuned rooftop is still working and still tuning. So I haven't had the need to switch to the split rooftop setup.

B-Hartley avatar May 29 '21 07:05 B-Hartley