Hi @KlausB and @ingo.niehues
how did you create the utility meters for daily, monthly and yearly costs? Which entitie(s) did you use and with wich settings?
I could create the utility meters for daily, monthly and yearly consumption, but I’m struggling with the same for costs.
Ok, hat funktioniert, danke
Jetzt fehlen mir noch ein paar Sensoren, woher beziehe ich die?
sensor.tibber_aktueller_preis_ist_tageshochstpreis
states(“sensor.tibber_strompreisentwicklung_kw”)
states(“sensor.tibber_strompreisentwicklung_short”)
7
state_attr(“sensor.tibber_strompreisentwicklung_preise”,“text_eins”)
states(“sensor.tibber_strompreisentwicklung_fazit”)
Danke
Hi Alexander,
these sensors are “multiscraped”
You need Multiscrape-Integration (HACS)
And this YAML-Code Multiscrape-Sensors for price forecast
like @ingo.niehues wrote above on Jan 5
Regards
Jörg
Would it perhaps be possible for someone to put all the required code into a tibber.yaml and then simply call it from the configuration.yaml?
Hi, so this configuration is working for me now…
…and thanks to everyone for the great support!
Important:
After inserting the code, restart Home Assistant and not just reload the YAML configuration!
Code for /homeassistant/configuration.yaml:
sensor:
- platform: rest
name: Tibber Prices
unique_id: tibber_prices_level
resource: https://api.tibber.com/v1-beta/gql
method: POST
payload: '{ "query": "{ viewer { homes { currentSubscription { status priceInfo { current { total } today { total } tomorrow { total } } } } } }" }'
json_attributes_path: "$.data.viewer.homes[0].currentSubscription.priceInfo"
json_attributes:
- today
- tomorrow
value_template: "{{ value_json.data.viewer.homes[0].currentSubscription.priceInfo.current.total | float }}"
scan_interval: 30
headers:
Authorization: !secret tibber_token
Content-Type: application/json
User-Agent: REST
unit_of_measurement: EUR/kWh
Code for /homeassistant/secrets.yaml
tibber_token: abcdefghijklmnopqrstuvwxyz_1234567890 #Enter here your Tibber Access Token
ApexCharts-Kartenkonfiguration
type: custom:apexcharts-card
experimental:
color_threshold: true
all_series_config:
unit: Cent/kWh
apex_config:
grid:
show: true
borderColor: '#E0E0E0'
chart:
height: 150px
tooltip:
enabled: true
followCursor: false
x:
show: false
fixed:
enabled: true
header:
show: true
title: Strompreis
show_states: true
colorize_states: true
standard_format: false
graph_span: 48h
now:
show: true
color: 9E9E9E
span:
start: day
series:
- entity: sensor.tibber_prices
show:
in_header: before_now
name_in_header: false
color_threshold:
- value: 0
color: 4DD0E1
- value: 10
color: 26A69A
- value: 15
color: 4CAF50
- value: 20
color: 7CB342
- value: 25
color: FBC02D
- value: 30
color: EF6C00
- value: 40
color: B71C1C
type: line
curve: stepline
extend_to: false
stroke_width: 4
float_precision: 2
data_generator: |
const noon = new Date()
noon.setHours(0, 0, 0, 0)
const prices = entity.attributes.today.concat(entity.attributes.tomorrow);
const data = [];
for(let i = 0; i < prices.length; i++) {
data.push([noon.getTime() + i * 1000 * 3600, prices[i].total * 100])
}
return data;
Hi,
i have two questions about ApexChart configuration:
- Is it possible to display the time in the price?
If you operate the curve by touch, the lower display is somehow inconveniently placed.
- Is it possible to display the values on the curve in a way that doesn’t obscure them?
I have exactly the same question: I understand how to create the utility-meters helpers but I don‘t know how to configure them. E.g. for the 3 daily once’s- do I have to use the same template input sensor „sensor.tibber_daily_costs_per_kwh“ ?
Do I set meter reset cycle to daily?
Do I need to set the meter reset offset e.g. for weekly, monthly and yearly?
Set Net consumption to on?
Set Delta values to off?
Set Periodically resetting to on?
Set Sensor always available to off?
For me the correct input sensor per utility meter is the main question. Anyone an idea?
Hi Jonathan, I used your code, after searching for some benefits. But whatever I try there is no data from Tibber prices right now. Is your sensor working?
Try this code:
https://community.home-assistant.io/t/tibber-schedul-prices-upcoming-24-hours-prices/391565/113?u=neewieedo
Thanks, this works perfectly over here. Anyone has an idea how I can use that now to define the perfect time to e.g. start the remote controlled dishwasher? Basic idea would be to check for the lowest price in the next x hours and trigger an automation based on that.
But I struggle with iterating over the attributes in the automation engine as this is using ninja and not javascript. Has anyone done something like that before?
Hi Neewieedo,
I tried your code but for me it’s empty, the chart is loading, not data is coming. 2024.2.5 is the current version. I’ll check the rest sensors, tried the command with curl, looked good. Any idea what I can check?
Insert Tibber_Token in secrets.yaml ?
Restart Home Assistant after enter the code?
This
workes with following changes in the code:
x:
show: true
Did you manage it?
Hi,
with the following code the Chart works like this
type: custom:apexcharts-card
experimental:
color_threshold: true
all_series_config:
unit: Cent/kWh
apex_config:
dataLabels:
enabled: true
distributed: true
yaxis:
title: Strompreis
show: true
decimalsInFloat: 0
tickAmount: 5
grid:
show: true
borderColor: '#E0E0E0'
chart:
height: 210px
tooltip:
style:
fontSize: 14px
enabled: true
followCursor: false
x:
show: true
decimalsInFloat: 2
fixed:
enabled: true
offsetX: -10
offsetY: -50
header:
show: true
title: Strompreis
show_states: true
colorize_states: true
standard_format: false
graph_span: 48h
now:
show: true
color: 9E9E9E
span:
start: day
series:
- entity: sensor.tibber_prices
show:
in_header: before_now
name_in_header: false
legend_value: true
in_chart: true
in_brush: true
color_threshold:
- value: 0
color: 4DD0E1
- value: 10
color: 26A69A
- value: 15
color: 4CAF50
- value: 20
color: 7CB342
- value: 25
color: FBC02D
- value: 30
color: EF6C00
- value: 40
color: B71C1C
type: line
curve: stepline
extend_to: false
stroke_width: 4
float_precision: 2
data_generator: |
const noon = new Date()
noon.setHours(0, 0, 0, 0)
const prices = entity.attributes.today.concat(entity.attributes.tomorrow);
const data = [];
for(let i = 0; i < prices.length; i++) {
data.push([noon.getTime() + i * 1000 * 3600, prices[i].total * 100])
}
return data;
Hello, how is it possible to always write the prices with 4 decimal places in the entity even if there are zeros?
I tried that, but unfortunately it doesn’t work…
configuration.yaml:
value_template: '{{"{:.4f}".format(value_json.data.viewer.homes[0].currentSubscription.priceInfo.current.total | float) }}'
or show here with a Zero at the end:
Love it. Thanks a 1000 times.
I wanted to add a horizontal line for a threshold when I start charging the EV if the price falls below. I can draw a threshold in apex chart like this:
YAML
type: custom:apexcharts-card
experimental:
color_threshold: true
all_series_config:
unit: Cent/kWh
apex_config:
dataLabels:
enabled: true
distributed: true
yaxis:
title: Strompreis
show: true
decimalsInFloat: 0
tickAmount: 5
grid:
show: true
borderColor: '#E0E0E0'
chart:
height: 210px
tooltip:
style:
fontSize: 14px
enabled: true
followCursor: false
x:
show: true
decimalsInFloat: 2
fixed:
enabled: true
offsetX: -10
offsetY: -50
annotations:
yaxis:
- y: 26
borderColor: '#00E396'
label:
borderColor: '#00E396'
style:
color: '#fff'
background: '#00E396'
header:
show: true
title: Strompreis
show_states: true
colorize_states: true
standard_format: false
graph_span: 48h
now:
show: true
color: red
span:
start: day
series:
- entity: sensor.tibber_prices
show:
in_header: before_now
name_in_header: false
legend_value: true
in_chart: true
in_brush: true
color_threshold:
- value: 0
color: 4DD0E1
- value: 10
color: 26A69A
- value: 15
color: 4CAF50
- value: 20
color: 7CB342
- value: 25
color: FBC02D
- value: 30
color: EF6C00
- value: 40
color: B71C1C
type: line
curve: stepline
extend_to: false
stroke_width: 3
float_precision: 2
data_generator: |
const noon = new Date()
noon.setHours(0, 0, 0, 0)
const prices = entity.attributes.today.concat(entity.attributes.tomorrow);
const data = [];
for(let i = 0; i < prices.length; i++) {
data.push([noon.getTime() + i * 1000 * 3600, prices[i].total * 100])
}
return data;
card_mod:
style: |
ha-card {
box-shadow: 0px 0px;
background: none;
But how can I make the horizontal line depending on a input_number I have?
This isnt working
annotations:
yaxis:
- y: '{{states("input_number.solar_openwb_tibber_price_threshold")}}'
borderColor: '#00E396'
label:
borderColor: '#00E396'
style:
color: '#fff'
background: '#00E396'
For me it still works.