Hi
I’m starting to play with this card and here is something I can’t manage: I would like to fill the area below a line depending on the status of a switch. So I added a series based on the switch status, transformed to get the value of the sensor. However, I only get a on/off type of chart!
Any idea of what I am doing wrong?
Here is the code:
header:
show: true
title: Bureau
show_states: false
colorize_states: true
all_series_config:
stroke_width: 2
type: line
extend_to_end: true
series:
- entity: sensor.temperature_bureau
name: Température mesurée
curve: smooth
group_by:
func: avg
duration: 15min
- entity: climate.bureau
name: Consigne
attribute: temperature
curve: stepline
- entity: switch.chaudiere
transform: 'return x === ''on'' ? hass.states[''sensor.temperature_bureau''].state: 0;'
type: area
curve: stepline
stroke_width: 0
color: red
This card is amazing. Thank you! I’ve been using it for a variety of graphs. I’m having a bit of trouble with the colorization of my air quality graph and was hoping form pointers. I know this is an experimental feature, and I would be happy with only colorizing the numbers in the header (if I could colorize both the lines and the numbers, that would be a bonus). Here’s the code:
That is possible if you use group_by with func: sum. It will sum all the values over duration. It might not be exactly what you are looking for though…
You’ll have to use card-mod for that. At least for now.
You assume that: transform: 'return x === ''on'' ? hass.states[''sensor.temperature_bureau''].state: 0;' is using the history for the other sensor, but it’s not. hass.states[''sensor.temperature_bureau''].state always returns the latest value of the sensor, not the one aligned with the history point.
A suggestion might be to use a second y axis with min = 0, max = 1 to chart on/off with 0/1, but it’s going to take the whole height of the chart.
Yes, that is a bug in the library I use. Use fill_raw: last on each serie to fix it
thanks for your feedback
alternatively, is there a way to change the color of the line for sensor.temperature_bureau depending on the status of switch.chaudiere ?
thank you so much for sharing your amazing work. I finally managed to have the chart for my router traffic like I wanted (dynamic kb/mb). I merged the one I made with 2-3 things I learned from your code. So happy about the result. ApexCharts is amazing (great job @RomRider) and your use of it is really inspiring (Unifi Style Radial Sensor is gorgeous).
The uptime tile is made with uptime-card and a binary_sensor. I was wondering if it could be made with ApexCharts, but it goes way beyond my ApexCharts knowledge, I just started…
Thanks a lot for the heads-up. I’m sure it will be available sooner or later. I’m very satisfied about uptime-card for now, so it’s not really a priority issue for me.
Hi.
I am using ApexCharts to display water heater data combined with power price.
My on/off logic is displayed using transform and area type.
My issue is that the area isn’t “closed” until the state has changed, so the area is not filled “until now” which is probably not a function.
I could use “until_end”, but this clutters the entire graph in my opinion.
Any suggestion on how to achieve a filled area graph showing the current state filled?
My code for just that entity included to show my transform and it is the orange area graph I am thinking of.
- entity: climate.varmtvann
name: Varmtvann på
extend_to_end: false
transform: 'return x === ''heat'' ? 1 : 0;'
type: area
curve: stepline
color: orange
fill_raw: last
opacity: 0.3
stroke_width: 3
show:
in_header: after_now
legend_value: false
yaxis_id: binary
Hi all, I’m try to create a rainfall prediction chart (for the next hour) with openaweathermap rest sensor.
So I have a sensor with attribute like this:
I use APEX card a lot on my lovelace views, super work.
With all the new energy long term statistical entities I would like to get some long term graphs. However the “statestical graph card” have very little functionality.
Is it possible to get the long term statestical information for the entities and use that as input in APEX?
There is a PR on github that I need to review to support long term statistics. It’s a bit complex so I will need to take some time to review it, but it’s going to land, no worries
Could it be that the timestamps are already offset by your timezone (they are expressed as being in your timezone directly)? Could you tell me what is your timezone please so I can check if that is the case?
Eg:
1636662360 (the first entry) is Thursday, November 11, 2021 8:26:00 PM in GMT timezone. Is that correct?
Thanks RomRider for the reply.
My time zone is GMT + 1 (Italy).
I had thought of a problem related to the date and, through the website www.epochconverter.com, I converted the date but it is correct (afaik).
Example:
now (16:58 local time)
the first value is 1636732560 which should be “November 12, 2021 16:56:00 GMT + 01:00”
the last value is 1636736160 which should mean “November 12, 2021 17:56:00 GMT + 01:00”