Delbz
(Marcus)
January 19, 2020, 12:33am
1
Hi,
How can I report this value as a positive (it’s always negative) in the card? Is there some code I could use in the card config?
I wish to use the dual gauge card once I can show the value as a positive to compare neatly with solar generation.
entity: sensor.fronius_house_load
max: 100
min: -10
name: House Using
severity:
green: -1
red: -6
yellow: -2
theme: default
type: gauge
VDRainer
(🍻)
January 19, 2020, 12:50am
2
You need a template sensor for it.
sensor:
- platform: template
sensors:
fronius_house_load_pos:
value_template: "{{ states('sensor.fronius_house_load') | abs }}"
or maybe
value_template: "{{ (states('sensor.fronius_house_load') | int) | abs }}"
2 Likes
tom_l
January 19, 2020, 12:54am
3
@VDRainer Use |float
not |int
. It has fractions of kW.
3 Likes
Absolute right!
My PV sensors report Watts,
Sorry, @Delbz .
Delbz
(Marcus)
January 19, 2020, 1:36am
5
Thank you very much.
It looks great now.
1 Like
Maco65
(Maciek)
February 12, 2020, 3:47pm
6
@Delbz
Your Card looks very nice.
Can you share the final code how to achieve it ?
Delbz
(Marcus)
February 12, 2020, 10:20pm
7
Sure.
Add dual gauge and mini graph plugins from HACS.
Dual gauge
inner:
colors:
- color: var(--label-badge-green)
value: 30
- color: var(--label-badge-yellow)
value: 10
- color: var(--label-badge-red)
value: 0
entity: sensor.fronius_day_energy
label: Gen
max: 80
min: 0
outer:
colors:
- color: var(--label-badge-red)
value: 40
- color: var(--label-badge-yellow)
value: 20
- color: var(--label-badge-blue)
value: 0
entity: sensor.energy_consumption
label: Used
title: Energy (kWh)
type: 'custom:dual-gauge-card'
Mini Graph
entities:
- color: '#27ae60'
entity: sensor.fronius_panel_status
name: Solar Gen
- color: '#e74c3c'
entity: sensor.fronius_house_load_pos
name: House Usage
show_state: true
- aggregate_func: min
color: gray
entity: binary_sensor.night
name: Night Time
show fill: true
show legend: false
show_line: false
show_points: false
show_state: true
smoothing: false
y_axis: secondary
hours_to_show: 72
name: Solar & Consumption
points_per_hour: 1
show:
extrema: true
labels: false
labels_secondary: false
smoothing: false
state_map:
- label: Day
value: 'off'
- label: Night
value: 'on'
type: 'custom:mini-graph-card'
1 Like
Delbz
(Marcus)
February 12, 2020, 10:25pm
8
I have updated this since I originally posted so the above code makes it now look like this
3 Likes
paulau
February 13, 2020, 10:49am
9
@Delbz These look great. Are you able to share how you are populating sensor.energy_consumption
?
Delbz
(Marcus)
February 14, 2020, 5:50am
10
Sure - from the fronius_inverter integration.
- platform: fronius_inverter
ip_address: 192.168.0.xxx
powerflow: True
power_units: kW
units: kWh
monitored_conditions:
- ac_power
- day_energy
- year_energy
- total_energy
- ac_current
- ac_voltage
- ac_frequency
- dc_current
- dc_voltage
- grid_usage
- house_load
- panel_status
Delbz
(Marcus)
February 15, 2020, 1:42am
11
Actually I was mistaken.
It’s from the PVOutput integration.
sensor:
- platform: pvoutput
system_id: xxx
api_key: xxx
scan_interval: 150
- platform: template
sensors:
power_consumption:
value_template: >
{% set pc = state_attr('sensor.pvoutput', 'power_consumption') %}
{{ '0' if pc == 'NaN' else pc }}
friendly_name: 'Using'
unit_of_measurement: 'Watt'
energy_consumption:
value_template: "{{ '{:.1f}'.format(state_attr('sensor.pvoutput', 'energy_consumption')|float/1000) }}"
friendly_name: 'Used'
unit_of_measurement: 'kWh'
power_generation:
value_template: >
{% set pg = state_attr('sensor.pvoutput', 'power_generation') %}
{{ '0' if pg == 'NaN' else pg }}
friendly_name: 'Generating'
unit_of_measurement: 'Watt'
energy_generation:
value_template: >
{% set eg = state_attr('sensor.pvoutput', 'energy_generation') %}
{{ '0' if eg == 'NaN' else '{:.2f}'.format(eg|float/1000) }}
friendly_name: 'Generated'
unit_of_measurement: 'kWh'
kika
August 23, 2023, 6:27pm
12
Thanks for your hint @VDRainer .
I have the same challenge as tom.
Added your code in Templates
But i dont know how to call actual_grid_export_value_template
Its not available as entity, how can i call it for an automation?
Is actual_grid_export_value_template per default a “global variable” ?
1 Like