This is my card, I have a Fronius Symo 3-phase inverter. At the big red dot I have 3x PZEM004t CT-clamp meters. (importance is that this also could be in the grid entry point, but then the below ± operations must be modified accordingly.)
- platform: template
scan_interval: 15
sensors:
house_pac:
value_template: >- ### House power, I have 3 phase power line, *PAC is for Power AC ###
{{ (( states('sensor.ac1_power') | int ) + ( states('sensor.ac2_power') | int ) + ( states('sensor.ac3_power') | int )) }}
grid_pac:
value_template: >- ### Calculated power grid, sensor.solar_pac is the output of my Fronius inverter, I have this entity defined in MODBUS config ###
{{ ( states('sensor.house_pac') | int ) - ( states('sensor.solar_pac') | int ) }}
grid_solar_pac:
value_template: >- ### This is to not to go negative, as this is an absolute value and makes no sense if we're getting power into solar generator ###
{% if (states('sensor.solar_pac') | int ) >= ( states('sensor.house_pac') | int ) %}
{{ ((states('sensor.solar_pac') | int ) - ( states('sensor.house_pac') | int )) | int }}
{% else %}
{{ 0 | int }}
{% endif %}
grid_cons_pac:
value_template: >- ### Same here, because we need grid-to-house, and house is not generating anything ###
{% if (states('sensor.solar_pac') | int ) >= ( states('sensor.house_pac') | int ) %}
{{ 0 | int }}
{% else %}
{{ (( states('sensor.house_pac') | int ) - (states('sensor.solar_pac') | int )) | int }}
{% endif %}
house_solar_pac:
value_template: >- ### Solar generation consumed by house ###
{{ ((states('sensor.solar_pac') | int ) - ( states('sensor.grid_solar_pac') | int )) | int }}
I was very abscent from the forum for a while seems to me you all got fronius working. I have added some new features and have started with the visual configuration, but it’s a slow process. Hopefully this will be better next month.
Hi @markpurcell, are you able to share your code? i’m having an issue where my solar is feeding both the house and grid at the same rate (Solar & Grid values should be half or what they are - image below has the correct values) - i feel that i’m missing something:
So the Solar and the House are both feeding the grid which should not be the case, only the solar should be feeding the gird. The house should only be getting power from the grid only if the solar is below the house usage.
Solar feeds the house & grid, house is also feeding the grid which is incorrect
config:
name: test
type: 'custom:tesla-style-solar-power-card'
generation_to_house_entity: sensor.modbus_sma_pv_power
generation_to_grid_entity: sensor.modbus_sma_pv_power
grid_to_house_entity: sensor.power_total
Solar feeds the house and excess power goes to the grid
You need to use some templates to ensure you don’t get negative values:
When grid_to_house is positive you are importing to grid, however if it is negative you need to set it to zero and set that value to generation_to_grid.
Here are some of my template rules, which you will need to modify for sma.
# This is used for Telsa Solar / Consumption power distribution card
# https://community.home-assistant.io/t/custom-solar-power-card-the-tesla-style-almost/220705/95
# sensor used to show power flow from Panels to Grid, but shows a negative at night
solaredge_template_panels_2_grid_day:
friendly_name: 'Panels 2 Grid during daylight'
value_template: >-
{{ (states('sensor.solaredge_solar_power') | float -
states('sensor.solaredge_power_consumption') | float ) | round(2) }}
unit_of_measurement: 'kW'
device_class: "power"
# shows the current grid power being fed from the grid to the house and doesn't allow it to show a negative number only positive numbers
solaredge_template_curent_grid_consumption:
friendly_name: 'Consumption'
unit_of_measurement: kW
device_class: power
value_template: >-
{% if states('sensor.solaredge_grid_power')|float < 0 %}
0
{% else %}
{{ states('sensor.solaredge_grid_power') }}
{% endif %}
# sensor used to show power flow from Panels to Grid and doesn't allow it to show a negative number only positive numbers
solaredge_template_panels_2_grid:
friendly_name: 'Panels 2 Grid'
unit_of_measurement: 'kW'
device_class: "power"
value_template: >-
{% if states('sensor.solaredge_template_panels_2_grid_day') | float > 0 %}
{{ states('sensor.solaredge_template_panels_2_grid_day') }}
{% else -%}
0
{% endif %}
# shows the solar power being fed to the house and doesn't allow it to show a negative number only positive numbers
solaredge_template_curent_solar_consumption:
friendly_name: 'Solar 2 House'
unit_of_measurement: kW
device_class: power
value_template: >-
{% if states('sensor.solaredge_template_panels_2_grid_day') | float > 0 %}
{{ states('sensor.solaredge_power_consumption') }}
{% else -%}
{{ (states('sensor.solaredge_power_consumption')| float - states('sensor.solaredge_grid_power')| float) }}
{% endif %}
Hi everyone…disclaimer, i am a home assistant user and reasonably technical but in no way a dev.
Got a new solaredge SE6000H inverter, panels, optimisers, solaredge immersion diverter and solaredge modbus. Get all the stats i need on the app but its via cloud with 15min refresh. Just set up TCP Modbus as i thought getting info from the inverter real time would be great…(want to set up some node red to turn on/off boiler hot water in favour of solar excess via immersion diverter to make use of excess energy), however i dont see any metrics from my modbus box…only the inverter. The kind of thing i am looking for is export to grid, grid consumption etc…(all visible on my app) but not via TCP modbus. Am i being stupid or is this a genuine limitation? any help would be great. thanks
Its ok, answered my own question in the end, realised i had not ticked the Meter 1 option in the solaredge TCP modbus integration setup…now got access to lots more information. thanks anyway
Sadly that is not as easy as it should and I won’t be adding more appliances for now. Maybe you want to group them with templates and show groups like “appliances” and “climate”
Hey what a really great work!
I got stuck with my configuration and cannot figure out my mistake: My PV is an LG ESS HOME System. It serves four main values via MQTT: Load_power (sum of all house consumption), PV_Total_Power (like name says), GRID_Power (like name says), Battery_DC_Power (like name says). But additionally I have to cope with “directions” telling me if the value is from or to house, from or to battery, from or to grid.
Since the directions come as 0 or 1, I tried calculating as simple as possible with template sensors.
But even the simplies configuration seems to be incorrect: In the evening (PV is zero, battery is empty) I simply have GRID buying.
So I assume, that the numbers beneath the bubbles house and grid show exactly the same vaule?
GRID bubble shows 573Wh, HOUSE bubble shows 5,7kWh. The numbers are relating 1:10.
What am I doing wrong?
Hi All,
I am no doubt missing something really simple here but I am not getting any solar generation data displaying on the card - it is always 0. I would really appreciate some help.
On your home assistant go to: /developer-tools/state when you have some sun and do a screenshot of the result when you type in the entity ‘sensor.powerwall_solar_now’ you should get a result. Otherwise you do have a powerwall installed correctly but the sensor name is not preceded by powerwall but by something else. At least it seems like that from the error. You can find your entities there and you might just need to change the name of powerwall to whatever it is called on your installation. This is an error I have not seen yet though.