Yes you can!
You need something like this:
hours_to_show: $fn () => (Date.now() - new Date().setUTCHours(0,0,0,0))/1000/60/60
Yes you can!
You need something like this:
hours_to_show: $fn () => (Date.now() - new Date().setUTCHours(0,0,0,0))/1000/60/60
Tried it but error:
ā¦Error: at [entities.0.on_legend_click]: Since [hours_to_show] is a $fn, it has to be defined before [entities.0.on_legend_click]ā¦
(actually a block of similar error entries)
With version 3.0 my to graphs arenāt seperated anymore. How can i fixed that?
Canāt find any documentation on that.
type: custom:plotly-graph
entities:
- entity: sensor.buienradar_temperature
name: Buiten
legendgroup: 1
showlegend: true
yaxis: y1
- entity: sensor.buienradar_humidity
name: Buiten
legendgroup: 1
showlegend: false
yaxis: y2
- entity: sensor.lumi_lumi_weather_temperature
name: Werkkamer
legendgroup: 2
showlegend: true
yaxis: y1
- entity: sensor.lumi_lumi_weather_humidity
legendgroup: 2
showlegend: false
yaxis: y2
- entity: sensor.lumi_lumi_weather_temperature_2
name: Garage
legendgroup: 3
showlegend: true
yaxis: y1
- entity: sensor.lumi_lumi_weather_humidity_2
legendgroup: 3
showlegend: false
yaxis: y2
- entity: sensor.room_temp_thermostat_opentherm_gateway
name: Woonkamer
legendgroup: 4
showlegend: true
yaxis: y1
layout:
dragmode: pan
margin:
t: 30
l: 45
r: 30
b: 50
showlegend: true
height: 650
legend:
bgcolor: rgba(0,0,0,0)
orientation: h
itemsizing: constant
font:
size: 10
grid:
rows: 2
columns: 1
roworder: top to bottom
yaxis:
title:
text: Temperature
yaxis2:
title:
text: Humidity
yaxes:
fixedrange: true
title: Climate
hours_to_show: 24
refresh_interval: 10
color_scheme:
- '#1f77b4'
- '#aec7e8'
- '#ff7f0e'
- '#ffbb78'
- '#2ca02c'
- '#98df8a'
- '#d62728'
Add this:
defaults:
yaxes:
side: left
overlaying: 'y'
visible: true
Sorry for breaking it, I reimplemented a lot of the code and it felt wrong to keep the redundant configurations.
No problem, the fix works!
You made a great new version with a lot of new options!
Thanks for your quick reply
Thanks!
I added a section at the bottom of the readme now with this and other tricks to cover the deprecated options:
Have you ever found a solution for this? Iām trying to do the same for future electricity prices.
I believe Iām almost there, however something is not working well with my date & time format.
These are the attributes Iām using:
today:
- total: 0.3207
startsAt: '2023-01-30T00:00:00.000+01:00'
level: VERY_CHEAP
- total: 0.2178
startsAt: '2023-01-30T01:00:00.000+01:00'
level: VERY_CHEAP
- total: 0.2065
startsAt: '2023-01-30T02:00:00.000+01:00'
level: VERY_CHEAP
- total: 0.1655
startsAt: '2023-01-30T03:00:00.000+01:00'
level: VERY_CHEAP
- total: 0.2637
startsAt: '2023-01-30T04:00:00.000+01:00'
level: VERY_CHEAP
- total: 0.5122
startsAt: '2023-01-30T05:00:00.000+01:00'
level: VERY_CHEAP
- total: 0.5319
startsAt: '2023-01-30T06:00:00.000+01:00'
level: VERY_CHEAP
- total: 0.5581
startsAt: '2023-01-30T07:00:00.000+01:00'
level: CHEAP
- total: 0.569
startsAt: '2023-01-30T08:00:00.000+01:00'
level: CHEAP
- total: 0.5633
startsAt: '2023-01-30T09:00:00.000+01:00'
level: CHEAP
- total: 0.5578
startsAt: '2023-01-30T10:00:00.000+01:00'
level: CHEAP
- total: 0.5379
startsAt: '2023-01-30T11:00:00.000+01:00'
level: CHEAP
- total: 0.5439
startsAt: '2023-01-30T12:00:00.000+01:00'
level: CHEAP
- total: 0.5327
startsAt: '2023-01-30T13:00:00.000+01:00'
level: CHEAP
- total: 0.527
startsAt: '2023-01-30T14:00:00.000+01:00'
level: CHEAP
- total: 0.5291
startsAt: '2023-01-30T15:00:00.000+01:00'
level: CHEAP
- total: 0.5342
startsAt: '2023-01-30T16:00:00.000+01:00'
level: CHEAP
- total: 0.5501
startsAt: '2023-01-30T17:00:00.000+01:00'
level: NORMAL
- total: 0.5526
startsAt: '2023-01-30T18:00:00.000+01:00'
level: NORMAL
- total: 0.5234
startsAt: '2023-01-30T19:00:00.000+01:00'
level: NORMAL
- total: 0.5133
startsAt: '2023-01-30T20:00:00.000+01:00'
level: NORMAL
- total: 0.5017
startsAt: '2023-01-30T21:00:00.000+01:00'
level: NORMAL
- total: 0.435
startsAt: '2023-01-30T22:00:00.000+01:00'
level: CHEAP
- total: 0.2773
startsAt: '2023-01-30T23:00:00.000+01:00'
level: VERY_CHEAP
tomorrow:
- total: 0.4939
startsAt: '2023-01-31T00:00:00.000+01:00'
level: NORMAL
- total: 0.4917
startsAt: '2023-01-31T01:00:00.000+01:00'
level: NORMAL
- total: 0.497
startsAt: '2023-01-31T02:00:00.000+01:00'
level: NORMAL
- total: 0.5072
startsAt: '2023-01-31T03:00:00.000+01:00'
level: NORMAL
- total: 0.5485
startsAt: '2023-01-31T04:00:00.000+01:00'
level: NORMAL
- total: 0.5643
startsAt: '2023-01-31T05:00:00.000+01:00'
level: NORMAL
- total: 0.7005
startsAt: '2023-01-31T06:00:00.000+01:00'
level: EXPENSIVE
- total: 1.3572
startsAt: '2023-01-31T07:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.7557
startsAt: '2023-01-31T08:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.7209
startsAt: '2023-01-31T09:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.669
startsAt: '2023-01-31T10:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.5598
startsAt: '2023-01-31T11:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.5121
startsAt: '2023-01-31T12:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.4956
startsAt: '2023-01-31T13:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.4886
startsAt: '2023-01-31T14:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.4903
startsAt: '2023-01-31T15:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.4949
startsAt: '2023-01-31T16:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.5442
startsAt: '2023-01-31T17:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.5316
startsAt: '2023-01-31T18:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.4783
startsAt: '2023-01-31T19:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.4044
startsAt: '2023-01-31T20:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.321
startsAt: '2023-01-31T21:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.2908
startsAt: '2023-01-31T22:00:00.000+01:00'
level: VERY_EXPENSIVE
- total: 1.1058
startsAt: '2023-01-31T23:00:00.000+01:00'
level: VERY_EXPENSIVE
And this is how Iām using it into the plot:
entities:
- entity: sensor.electricity_price
line:
width: 3
color: orange
- entity: sensor.electricity_price
name: Future price
line:
width: 3
dash: dot
color: green
filters:
- fn: |
({xs,ys,states}) => {
var today = states.map(state => state?.attributes?.today);
var tomorrow = states.map(state => state?.attributes?.tomorrow);
var all_prices = today.concat(tomorrow);
return {xs: Array.from(all_prices.keys("startsAt")), ys: Array.from(all_prices.keys("total"))};
}
- entity: null
name: Now
yaxis: y9
showlegend: false
line:
width: 1
dash: dot
color: deepskyblue
filters:
- fn: |
({xs,ys}) => {
return {xs:[Date.now(),Date.now()], ys:[0,1]}
}
And this is what I got:
*The future prices line is starting around the year 1960.
Sorry, found my mistakeā¦
The solution to the weather forecast question: Weather forecast plot (`meta` and nested attributes) Ā· Discussion #213 Ā· dbuezas/lovelace-plotly-graph-card Ā· GitHub
Hi Edward, can you share the yaml for this
There is (including versions for Tibber and NordPool):
I just hit the upgrade button and get this on all my MACOS browsers. Safari and Brave
my ipad IOS is fine. Home assistant on iOS is also fine.
the other browsers are likely showing the cached version. The errors you see are the braking changes stated in the release version notes. But donāt panik, the error messages tell you how to fix them!
I just noticed the repo has pretty much one closed issue per star. If this wasnāt open source, the cost per star would be absolutely outrageous!
A quick question I could not find (maybe I cannot search well): how can I set the color of a bar? For a line color (and fill color) I know how to do it, but I cannot find the way to set the (fill) color of a bar?
Iām not sure if this is the best way, but the marker
worked fine for me to set the color:
entities:
- entity: sensor.total_energy_utility_meter
name: Energy consumption
type: bar
marker:
color: rgba(165,165,0,0.6)
I am also not sure if it is the best way, but the most important thing is that it works
Hey, trying to figure out the new $fn for using theme colors and Iām missing something.
entities:
- entity: sensor.motion_sensor_1_temperature
connectgaps: true
line:
width: 3
color: $fn ({css_vars}) => css_vars.primary_color
It isnāt throwing any visible errors (like when using the wrong variable), but it also isnāt setting the color of the line. Iāve cleared the cache and hard refresh, so Iām pretty sure the updated code is active.
primary-color in the theme is: primary-color: "#aa3151"
, but the line is the default blue.
Thoughts on what Iām missing?
Thanks!