# extra values to show as text above icons
battery_extra_entity: sensor.battery_charge
house_extra_entity: sensor.current_temperature
generation_extra_entity: sensor.percent_cloud_coverage
grid_extra_entity: sensor.monthly_feed_in
The problem with increasing the font size is that everything has to be rearrenged and since this is a pixel calculated card itâs a nightmare to do that. I tried just making the text bigger but the text just goes beyond the bubbles.
Does anyone have some template sensors for figuring out where your power is going from each source to match the way the card is supposed to be configured?
What logic do you want to know? The entities required are very clear. generation_to_grid is what goes from solar to grid, generation_to_house is what goes from solar to your consumption. What is unclear to you? The way they are added or subtracted? Your question is not very clear.
Youâre a legend mate!! I spent a fair bit of time but couldnât display correct values (if I fixed one thing, then the other broke). With your code (after changing the sensor entities), it works so good so far.
Edit: My inverter is Fronius Primo 8.2 kW.
Iâm not sure why youâre confusing my question as asking for additional clarification on what your entities mean. Itâs not. Youâve done a great job naming them in such a way thatâs very clear what they are. But as I pointed out in the GH issue, what Iâm looking for help with is the template logic you need to have to get the correct number showing for each one of the entities your card requires as an input.
For example, my system doesnât tell me how much of my solar generation is generation_to_battery_entity vs generation_to_house_entity vs generation_to_grid_entity. I just get one number that is total generation.
Thatâs exactly what Iâve been trying to do, but canât nail the logic. Whenever I make a template sensor that works correctly for the current scenario, I look at it later that day or the next day and itâs broken. Itâs a game of whack-a-mole and Iâm not winningâŠ
What makes my installation more complex is the batteries and TOU offsetting I use. Before 12 I run the house on the grid and send all PV to charge the batteries, after 12 it stops using the grid and uses a combination of solar and battery to support the house until 9.
Hereâs an example of my sensor:
- name: "Powerflow Solar to House"
state: >-
{% set solar = states('sensor.solark_pv1_input_power') | int(0) %}
{% set grid = states('sensor.solark_grid_external_total_power') | int(0) %}
{% set house = states('sensor.solark_load_power') | int(0) %}
{% set battery = states('sensor.solark_battery_power') | int(0) %}
{% set battery_charging = states('sensor.powerflow_battery_charge') | int(0) %}
{% set battery_discharging = states('sensor.powerflow_battery_discharge') | int(0) %}
{% if solar > 10 %}
{% if ( solar - battery_charging ) / solar < 0.1 and grid > 20 %}
{{ grid }}
{% elif grid < 50 %}
{{ solar - battery_charging }}
{% else %}
{{ solar }}
{% endif %}
{% else %}
0
{% endif %}
device_class: power
unit_of_measurement: W
Hi Andrew, did you have any luck with the stock powerwall templates on the github and âgrid to batteryâ and âbattery to gridâ sensors? any help would be appreciated.
These are the templates I am using for my system (without battery). Let me know if you are able to use them in your setup.
Explanation:
The grid consumption must be multiplied by -1 because the active_power_2 sensor from the huawei_solar integration is negative when importing and positive when exporting, whereas for the solar power card you need it the other way around.
the grid_feed_in sensor represents the PV output to grid, so it is equal to active_power_2 when exporting, but needs to be set to 0 when importing from grid.
the solar_consumption sensor is
equal to the output power of the inverter when active_power_2 is positive (you are importing, so you consume all the PV power)
the difference between the inverter output power and the export value (your are exporting, so you consume less then the production)
grid_consumption:
friendly_name: Power imported from grid
device_class: power
unit_of_measurement: W
value_template: >-
{{ states('sensor.active_power_2') |multiply (-1) }}
grid_feed_in:
friendly_name: PV output to grid
device_class: power
unit_of_measurement: W
value_template: >-
{% if states('sensor.active_power_2')|float > 0 %}
{{ states('sensor.active_power_2') |float }}
{% else %}
{{ 0 }}
{% endif %}
solar_consumption:
friendly_name: PV power self consumption
device_class: power
unit_of_measurement: W
value_template: >-
{% if states('sensor.active_power_2')|float < 0 %}
{{ states('sensor.active_power')|float }}
{% else %}
{% set self_consumption = states('sensor.active_power') |float - states('sensor.active_power_2') |float %}
{{ self_consumption }}
{% endif %}
maybe this is ok for who use charge Luna2000 from grid?
# sensor grid to battery
- platform: template
sensors:
grid_to_battery:
friendly_name: "Grid to Battery"
unit_of_measurement: "W"
value_template: >-
{% set ap2 = states('sensor.active_power_2') | int %}
{% set bdd = states('sensor.charge_discharge_power') | int %}
{% set ip = states('sensor.input_power') | int %}
{% set ap1 = states('sensor.active_power') | int %}
{% if ap2 < 0 and bdd > 0 and ip <= 0 and ap1 > 0 %}
{{ (-1 * ap) | int }}
{% else %}
{{ (0) }}
{% endif %}
# extra values to show as text above icons
#battery_extra_entity: sensor.solax_x1h_batpower
#house_extra_entity: sensor.kitchen_thermostat_current_temperature
generation_extra_entity: sensor.openweathermap_cloud_coverage
#grid_extra_entity: sensor.smart_meter_electricity_import_today
# optional appliances with consumption and extra values
appliance1_consumption_entity: sensor.psl_247045_current_energy_2
appliance1_extra_entity: sensor.i3_120_charging_status
#appliance2_consumption_entity: sensor.heating_consumption
#appliance2_extra_entity: sensor.heating_operation
âââ
My solar (yellow sun icon value) uses the sesnor âsensor.solax_pv_total_power_2â this is the total my PV is producing in real time, that works fine.
However it then messes with the blue House icon value. The blue house icon should be showing the load of what the house is using in real time. This should use the sensor âsensor.solax_house_loadâ but there is no where to put that sensor in the above code?
Happy to buy someone a beer who can help/program.
Presume the blue house icon is just taking the solar now reading and not the actual âhouse loadâ
As you can see the realtime House load read house is different from the blue icon
I think the calc its doing is SOLAR GEN + GRID IN = blue house logo value, but the house load is way higher but its not aware of that because no sensor for it used in the above code. How can i code in the house load sensor??