Help for a beginner getting solar generation from Fronius Inverter

Hi,
I am wanting to read the current solar generation from my Fronius Inverter and display it in HA, then eventually i want to use this to decide if the Pool Pump should be allowed to activate.

First time looking at HA so much to learn, could anyone give me a rundown on how to do this for a beginner?

Thanks, any help appreciated.

1 Like

Same with me. Noticed there was a Fronius module some time ago but it was removed later on.

I am using the fronius api.

My configuration.yaml

sensor:
  - platform: rest
    resource: http://(Your solar IP)/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=1&DataCollection=CommonInverterData
    method: GET
    name: "Current Power"
    value_template: >-
      {% if is_state('sun.sun', 'above_horizon') %}
        {{ (value_json.Body.Data.PAC.Value /1000 | float / 10)|round(2) }}
      {% else %}
        Offline
      {% endif %}
    unit_of_measurement: 'KW'
    force_update: true
  - platform: rest
    resource: http://(Your solar IP)/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=1&DataCollection=CommonInverterData
    method: GET
    name: "Total Power Today"
    value_template: >-
      {% if is_state('sun.sun', 'above_horizon') %}
        {{ (value_json.Body.Data.DAY_ENERGY.Value /1000 | float / 10)|round(2) }}
      {% else %}
        Offline
      {% endif %}
    unit_of_measurement: 'KW'
    force_update: true
  - platform: rest
    resource: http://(Your solar IP)/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=1&DataCollection=CommonInverterData
    method: GET
    name: "Total Power This Year"
    value_template: >-
      {% if is_state('sun.sun', 'above_horizon') %}
        {{ (value_json.Body.Data.YEAR_ENERGY.Value /1000 | float / 10)|round(2) }}
      {% else %}
        Offline
      {% endif %}
    unit_of_measurement: 'MW'
    force_update: true
  - platform: rest
    resource: http://(Your solar IP)/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=1&DataCollection=CommonInverterData
    method: GET
    name: "Total Power Since Installed"
    value_template: >-
      {% if is_state('sun.sun', 'above_horizon') %}
        {{ (value_json.Body.Data.TOTAL_ENERGY.Value /1000 | float / 10)|round(2) }}
      {% else %}
        Offline
      {% endif %}
    unit_of_measurement: 'MW'
    force_update: true

Replace (Your solar IP) with your actual IP address of your Fronius. This will give you the sensors for the on the non Lovelace up the top, if you want them on a Lovelace card. I used the Entity card for lovelace and just chose each on from the dropdown.
The above also gives an output to 2 decimal places.

Hope this helps

Thank you this is great however I hate to sound silly but not sure how to implement this

I updated it with my inverter’s ip and added it to the yaml file but reloading home assistant I don’t see anything different? How do I see the inverter output?

Also, I have no idea what you are talking about with Lovelace
?
I have never used Home Assistant before so I need the dummies guide please


Lovelace is a new frontend for Home Assistant. If you haven’t enabled it in your configuration.yaml then go to:
http://{replace with you IP}:8123/lovelace, from there you can add cards etc via the 3 dots on the top right and choose “Configure UI”.

Otherwise you should see the output of the sensors in the non Lovelace frontend at the top, with the other sensors. Ensure you restart Home Assistant when you have changed you configuration.yaml.

Browsing to http://192.168.1.10:8123/lovelace gives a 404 error
?

I am not sure where you are saying I should see the output on the non-lovelace frontend, I have no sensors anywhere at the top.

What version of homeassistant are you running?

You can also try going to the info page under the dev tools part of the side menu and then clicking on ‘enable Lovelace ui’ or words to that effect

Hi,
Version 0.44.1.
There’s nothing on Dev Tools - Info, about Lovelace
?

Thanks for your help

WOW! that’s ridiculously old
 that’s why there is no Lovelace, it wasn’t even thought of back then

This was just installed
?
I have just typed pip3 install --upgrade homeassistant and now it doesnt open at all, may errors

2019-02-24 22:02:25 ERROR (MainThread) [homeassistant.loader] Unable to find component use_legacy_protocol
2019-02-24 22:02:46 ERROR (MainThread) [homeassistant.setup] Error during setup of component http
Traceback (most recent call last):
File “C:\Users\Owner\AppData\Local\Programs\Python\Python36\lib\site-packages\homeassistant\setup.py”, line 151, in async_setup_component
hass, processed_config)
File "C:\Users\Owner\AppData\Local\Programs\Python\Python36\lib\site-packages\homeassistant\components\http_init
.py", line 152, in async_setup
ssl_profile=ssl_profile,
File “C:\Users\Owner\AppData\Local\Programs\Python\Python36\lib\site-packages\homeassistant\components\http_init_.py”, line 210, in init
setup_cors(app, cors_origins)
File “C:\Users\Owner\AppData\Local\Programs\Python\Python36\lib\site-packages\homeassistant\components\http\cors.py”, line 21, in setup_cors
import aiohttp_cors
ModuleNotFoundError: No module named ‘aiohttp_cors’
2019-02-24 22:02:46 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of system_log. Setup failed for dependencies: http
2019-02-24 22:02:46 ERROR (MainThread) [homeassistant.setup] Setup failed for system_log: Could not set up all dependencies.
2019-02-24 22:02:46 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of auth. Setup failed for dependencies: http
2019-02-24 22:02:46 ERROR (MainThread) [homeassistant.setup] Setup failed for auth: Could not set up all dependencies.
2019-02-24 22:02:46 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of onboarding. Setup failed for dependencies: http
2019-02-24 22:02:46 ERROR (MainThread) [homeassistant.setup] Setup failed for onboarding: Could not set up all dependencies.
2019-02-24 22:02:46 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of api. Setup failed for dependencies: http
2019-02-24 22:02:46 ERROR (MainThread) [homeassistant.setup] Setup failed for api: Could not set up all dependencies.
2019-02-24 22:02:46 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of websocket_api. Setup failed for dependencies: http
2019-02-24 22:02:46 ERROR (MainThread) [homeassistant.setup] Setup failed for websocket_api: Could not set up all dependencies.
2019-02-24 22:02:46 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of frontend. Setup failed for dependencies: api, websocket_api, http, system_log, auth, onboarding
2019-02-24 22:02:46 ERROR (MainThread) [homeassistant.setup] Setup failed for frontend: Could not set up all dependencies.
2019-02-24 22:02:53 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.

Not sure why pip3 isn’t working for you.

Try the below instead.

This is how i inztalled home assistant.

I am running windows

Deleted old config.yaml file when opening get these errors

2019-02-24 23:03:39 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=20 from 2019-02-24 11:53:52.653500)
2019-02-24 23:03:42 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback _ProactorReadPipeTransport._loop_reading(<_OverlappedF
op_reading()]>)
Traceback (most recent call last):
File “C:\Users\Owner\AppData\Local\Programs\Python\Python36\lib\asyncio\events.py”, line 127, in _run
self._callback(*self._args)
File “C:\Users\Owner\AppData\Local\Programs\Python\Python36\lib\asyncio\proactor_events.py”, line 190, in _loop_reading
data = fut.result() # deliver data later in “finally” clause
File “C:\Users\Owner\AppData\Local\Programs\Python\Python36\lib\asyncio\futures.py”, line 238, in result
raise InvalidStateError(‘Result is not ready.’)
asyncio.base_futures.InvalidStateError: Result is not ready.
2019-02-24 23:03:58 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback _ProactorReadPipeTransport._loop_reading(<_OverlappedF
ed result=b’’>)
Traceback (most recent call last):
File “C:\Users\Owner\AppData\Local\Programs\Python\Python36\lib\asyncio\events.py”, line 127, in _run
self._callback(*self._args)
File “C:\Users\Owner\AppData\Local\Programs\Python\Python36\lib\asyncio\proactor_events.py”, line 188, in _loop_reading
self._closing)
AssertionError

I would suggest watching the following video.

Or the full writeup.

I have not installed hass on a Windows machine, but from what I have watched of the video it seems pretty straight forward.
Hass.io has some advantages over the bare homeassistant, easier updates and installation of addons.

If you have just started using homeassistant then a fresh install would be my suggestion. Remove your pip3 install of homeassistant then start from scratch.

Some small changes to the yaml, should now work better.

sensor:
  # Fronius - Production
  - platform: rest
    resource: http://<your fronius IP>/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=1&DataCollection=CommonInverterData
    method: GET
    name: "Current Power"
    value_template: >-
      {% if is_state('sun.sun', 'above_horizon') %}
        {{ (value_json.Body.Data.PAC.Value /1000 | int )|round(2) }}
      {% else %}
        0
      {% endif %}
    unit_of_measurement: kWh
    force_update: true
  - platform: rest
    resource: http://<your fronius IP>/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=1&DataCollection=CommonInverterData
    method: GET
    name: "Total Power Today"
    value_template: >-
      {% if is_state('sun.sun', 'above_horizon') %}
        {{ (value_json.Body.Data.DAY_ENERGY.Value /1000 | int )|round(2) }}
      {% else %}
        0
      {% endif %}
    unit_of_measurement: kWh
    force_update: true
  - platform: rest
    resource: http://<your fronius IP>/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=1&DataCollection=CommonInverterData
    method: GET
    name: "Total Power This Year"
    value_template: >-
      {% if is_state('sun.sun', 'above_horizon') %}
        {{ (value_json.Body.Data.YEAR_ENERGY.Value /1000000 | int )|round(2) }}
      {% else %}
        0
      {% endif %}
    unit_of_measurement: MWh
    force_update: true
  - platform: rest
    resource: http://<your fronius IP>/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=1&DataCollection=CommonInverterData
    method: GET
    name: "Total Power Since Installed"
    value_template: >-
      {% if is_state('sun.sun', 'above_horizon') %}
        {{ (value_json.Body.Data.TOTAL_ENERGY.Value /1000000 | int )|round(2) }}
      {% else %}
        0
      {% endif %}
    unit_of_measurement: 'MW'
    force_update: true

Screenshot_2019-02-26%20Home%20Assistant

Above is using the entities card for lovelace

2 Likes

OK.
I have installed VM Box as per the video and we have Home Assistant running !
Now adding your code to the configuration.yaml file still doesnt help me
?
How do we make it display the data?
Clicking the 3 dots doesnt obviously help me
?

Are you using lovelace as your frontend?
If you are using lovelace then you should see 3 dots at the top right, click it and choose customize UI. Then down the bottom right you will see a large + button, click it. You should see a number of cards to choose from, choose entities, then you can pick the solar stuff in the entities dropdowns.

Yes, when I click on the plus which is at the top, i get the screen below

No matter what drop down box i look through there is nothing referring to solar inverter?

Thats for the tabs, not the card. You should see a + sign down the bottom right for the cards. With a colored circle. Sorry can’t screenshot, at work.

On the video on that page you will see an orange buttom down the bottom right, that is what you click to add a card.