Code behorende bij video thuisbatterij
Dashboard
Opmerking: de enige reden om de price er tweemaal in te zetten is omdat door een bug de eerste price niet op een mobiel zichtbaar is.
type: custom:apexcharts-card
graph_span: 24h
header:
title: Energy prices and diff
show: true
span:
start: day
now:
show: true
label: Now
yaxis:
- id: first
decimals: 2
- id: second
decimals: 2
series:
- entity: sensor.average_electricity_price_today
yaxis_id: first
name: Price
stroke_width: 3
float_precision: 2
opacity: 1
color: yellow
show:
header_color_threshold: true
data_generator: |
return entity.attributes.prices.map((entry) => {
return [new Date(entry.time), entry.price];
});
- entity: sensor.nordpool_kwh_nl_eur_3_100_0
data_generator: |
return entity.attributes.raw_today.map((start, index) => {
return [new Date(start["start"]).getTime(), entity.attributes.raw_today[index]["value"]];
});
yaxis_id: first
type: area
name: Price
float_precision: 1
opacity: 0.5
stroke_width: 2
- entity: sensor.nordpool_diff_triangle_10_normalize_max_min
yaxis_id: second
name: Diff
show:
header_color_threshold: true
float_precision: 3
stroke_width: 2
}
Automations
als voorbeeld, worden aangemaakt via userinterface
- id: '1679660134211'
alias: Nordpool Diff Battery A 0.4-1.0
description: ''
trigger:
- platform: time_pattern
seconds: '34'
condition:
- condition: numeric_state
entity_id: sensor.nordpool_diff_triangle_10_normalize_max_min
above: 0.4
below: 1
action:
- service: mqtt.publish
data:
qos: '1'
topic: Sofar/set/charge
payload: '600'
mode: single
- id: '1679660225527'
alias: Nordpool Diff Battery C -0.2 - 0.2
description: ''
trigger:
- platform: time_pattern
seconds: '38'
condition:
- condition: numeric_state
entity_id: sensor.nordpool_diff_triangle_10_normalize_max_min
above: -0.2
below: 0.2
action:
- service: mqtt.publish
data:
qos: '1'
topic: Sofar/set/charge
payload: '0'
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- service: mqtt.publish
data:
qos: '1'
topic: Sofar/set/standby
payload: 'true'
mode: single
- id: '1679660360654'
alias: Nordpool Diff Battery D -0.2- -0.4
description: ''
trigger:
- platform: time_pattern
seconds: '40'
condition:
- condition: numeric_state
entity_id: sensor.nordpool_diff_triangle_10_normalize_max_min
above: -0.4
below: -0.2
action:
- service: mqtt.publish
data:
qos: '1'
topic: Sofar/set/discharge
payload: '400'
mode: single
- id: '1679680191477'
alias: Nordpool Diff Battery E -0.42- -1.0
description: ''
trigger:
- platform: time_pattern
seconds: '40'
condition:
- condition: numeric_state
entity_id: sensor.nordpool_diff_triangle_10_normalize_max_min
above: -1.1
below: -0.4
action:
- service: mqtt.publish
data:
qos: '1'
topic: Sofar/set/discharge
payload: '600'
mode: single