I have a chart showing the last 30 days of electricity cost + usage. It would be nice to have an X axis annotation at each Monday, but I can’t see a way to nicely automate that. An alternative would be to have a binary sensor that turns on each Monday, and off for other days of the week, and use that as a chart series on a secondary Y axis. Anybody got something like this working?
I’ve tried adding the transform option but it gets ignored, I feel I need to add it in the data genetor somewhere but not very good with javascript or whatever it is.
Essentially, I’d like the precipitation value for the forecasted data to be multiplied by 4.
You can switch show: true to show: false on the two y-axis entries you don’t want to appear. Although I would recommend setting some max/min values so they align with the visible axis values to avoid confusion.
When I combine two sensors in one diagram (with two y-axis) the automatic scaling changes it’s behavior in a manner, that only the max value seems to work and the min value is always zero.
Both diagrams show the same sensor in red, left combined with another sensor. Both no max or min.
Is there a way to have the y-axis scaling automic for max and min?
** EDIT** Nevermind, there was a spacing issue… seems to work now. Thanks for the example!!!
Hi Mark thanks for putting this up on github, I looked at it and am working on doing the same thing in nodered since I already have this up and there is an influxdb node. I just wanted to see if I am formatting the sensor the same as you for your data_generator function. Is the below correct?
Hi everyone, i would like to import data with the data generator function
I recently switch to a french energy provider which provides API to get the lowest price of the day.
I managed to get the prices in either pyscript and nodered for comparaison purpose (pyscript will disapear as soon as i will be sure that everything is ok).
Data are stored in attributes under the dictionnary template {‘time’:value}.
Between NodeRed & Pyscript, no probs, they both have the same chart and the base time is in accordance with the official app.
I used one of the script if found in this topic:
type: 'custom:apexcharts-card'
header:
show: true
title: Barry Electricité NODERED (€/kWh)
show_states: false
colorize_states: true
y_axis_precision: 4
span:
start: day
offset: '-1day'
graph_span: 72hours
all_series_config:
stroke_width: 2
extend_to_end: false
curve: stepline
now:
show: true
label: now
color: red
series:
- entity: sensor.general_prices
unit: €/kWh
float_precision: 5
data_generator: |
let res = [];
for (const [key, value] of Object.entries(entity.attributes.values)) {
res.push([new Date(key).getTime(), value]);
}
return res.sort((a, b) => { return a[0] - b[0] })
I decided to process a moving average on NodeRed; no probs here, when i do the maths manually, i get the good time and the good average with the same data template
But when i’m using the same function used to plot the general prices, I now have a 2hr offset…
We can see there that between the lowest price in attributes and the lowest price in the graph, i have a 2hr offset.
Did anyone manage to get it working with two y-axes? I have three series I want to plot, so I put the one I want on the right y-axis first and then the other two since everything after the first is supposed to end up on the second axis.
This doesn’t work for me, the two series on the same axis are offset for some reason, one of them not really matching the scale of any axis:
maybe its a latency issue of HA getting to the DB too slowly, but still there’s many errors there in just the flash of an eye…
and another one after clicking restart HA:
I noticed that the #header comes with a padding of only 8px while I see most cards coming with 16px. Of course, I could use card_mod to adjust this, but I was wondering if I miss something?
bonjour, j’utilise votre code pour analyser des senseurs dans mon jardin, seulement je crois que je n’ai pas la dernière version que vous utilisez car je n’ai toujours pas la barre “now” au bon endroit!
auriez-vous la gentillesse de m’aider avec votre code le plus récent, c’est de cette façon que j’apprends, en regardant le code des autres.
I am trying to display solar monthly production history data which is in an influx DB.
All I get it the average amount for the total months as below which I have data for Jan to April 2021.
The data is in influxDB. It is added the last day of the month
root@pi4HA:~# influx -database 'sensors' Connected to http://localhost:8086 version 1.8.5
InfluxDB shell version: 1.8.5
> SELECT "value" FROM "solar" WHERE "entity_id"='month'
name: solar
time value
---- -----
1612085400000000000 588.8
1614504600000000000 596.5
1617183000000000000 736.7
1619775000000000000 572.9
>