Closed cibernox closed 3 years ago
I completely agree and this would be HUGE feature for minimal effort.
Another additional feature would be to set a fixed time window (e.g. 'today', which is a fixed 24 hour window), so that the axis is fixed and data is plotted from left to right as time progresses, rather than showing a fixed length of time in the past. This would then be able to show future data (if it exists). It would also be great to be able to create daily power generation graphs such as this:
Home assistant doesn't provide data from the future so that is unfortunately not possible. The data comes from the history component of home assistant (and as its name states it, it stores only historical data 😊)
As for your other request the @thejonesyboy, it is a duplicate of some other requests already, like #486.
I'm closing this.
@RomRider that's not accurate. It's true that this components only renders values at a certain time, but that time doesn't have to be NOW. For the electricity for instance I know in advance all the values the graph, past, present and future (to a certain extent, prices of the next day are published at 7pm). For instance I could have a sensor that gives the the price of electricity 4 hours into the future and if I plotted that sensor using this component I'd be rendering data from the future, right? 😄
What would be missing tho is a way of style the last 4 bars of the graph a bit different (because I know they are in the future) from all the previous bars (because they are in the past), or maybe all but the one of the current time range (the present price of the electricity).
The real missing feature here is a way of style the bars (or the line if using a chart) differently starting at one point in the X axis.
My point exactly! Yet far better expressed, thank you.
On Wed, 20 Jan 2021, 8:19 am Miguel Camba, notifications@github.com wrote:
@RomRider https://github.com/RomRider that's not accurate. It's true that this components only renders values at a certain time, but that time doesn't have to be NOW. For the electricity for instance I know in advance all the values the graph, past, present and future. For instance I could have a sensor that gives the the price of electricity 4 hours into the future and if I plotted that sensor using this component I'd be rendering data from the future, right? 😄
What would be missing tho is a way of style the last 4 bars of the graph a bid different (because I know they are in the future) from all the previous bar (because they are in the past), or maybe all but the one of the current time range (the present price of the electricity).
The real missing feature here is a way of style the bars (or the line if using a chart) differently starting at one point in the X axis.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kalkih/mini-graph-card/issues/459#issuecomment-763236123, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGYGQYT3A7UWRL6IGVTQSDS2YORFANCNFSM4SDJNFJA .
I think I am accurate ;)
You have to understand how home assistant works:
Since we rely on what homeassistant provides, we can't graph future data. That's how it is :shrug: and is very unlikely to change in home assistant.
For the sake of being complete in my answer:
Ok, thanks for clarifying.
On Wed, 20 Jan 2021, 8:45 am Jérôme W., notifications@github.com wrote:
I think I am accurate ;)
You have to understand how home assistant works:
- Your sensor, even though it has the future data in its attributes (because that's how the dev decided to develop it), only generates a new state (probably) every hour.
- when a new state is generated (every hour), that value is stored in homeassistant's history of states in the database
- the only data which is provided by home assistant is the past data even with a time in the future. You can't retrieve the data from the future because they don't exist yet in homeassistant since those future states have not yet been generated by the sensor.
Since we rely on what homeassistant provides, we can't graph future data. That's how it is 🤷 and is very unlikely to change in home assistant.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kalkih/mini-graph-card/issues/459#issuecomment-763245907, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGYGQZCMYNNHDLZNODQSVDS2YRUBANCNFSM4SDJNFJA .
If you want to trick the system you could however create a template sensor consuming the attributes of this sensor where the value_template
would be equal to YOUR_ENTITY.attributes.price_(now + 4h)
. You'd have to account for overflow over 24h obviously.
This would generate a state a the current time of your system but with the data of now + 4h. It's ugly, your graph would show the wrong time for the data but you'd manage to display your graph with a fake 4h ahead data. I'll let you figure out the template though if this is something you'd consider.
@RomRider that virtual sensor YOUR_ENTITY.attributes.price_(now + 4h)
is exactly what I had in mind and why I said that the real requested feature here wasn't really to read values from the future but to be able to style graphs starting at one point in the X axis differently.
Well, for completeness I'd also be nice to be able for the graph to use this price-in-4-hours sensor but the text displayed next to it to use the current-price sensor, which I haven't even checked if it's possible. Probably can be hacked by rendering two graphs but making one of them transparent.
@thejonesyboy @cibernox, I've published a new card to display graphs and it supports to generate data out of attributes in a generic way and display the future also 🔮 I've tested with the PVPC integration and it works amazingly well :)
==> Card: https://github.com/RomRider/apexcharts-card ==> Feature request: https://github.com/RomRider/apexcharts-card/issues/6 where you'll also find links to the PR with some explanation!
@RomRider Thanks for this! I've added your card https://github.com/RomRider/apexcharts-card to my home assistant and it now shows the future electricity prices as provided by the Agile Octopus integration https://github.com/markgdev/home-assistant_OctopusAgile Great work! Thanks, Matt
I use this component for almost all my graphs and it's great. I've however identified a feature that would be useful, but perhaps too niche: Render not only past values but also future values.
For instance, I'm on an electric tariff with two time periods and I've created this beautiful bar graph with the electric prices:
Price is different every hour. And every day at 8PM the prices for the next day are published. So I know in advance what the graph for the next day will be. And in fact it's more useful to me to display what the prices will be than what the price was.
I'd like to be able to render a graph that instead of the last 24h, it shows me the last 12h and the future 12h (probably styled slightly different).
For completion, this is the HA sensor I have for the prices:
Is there any feature that allows this already?
I considered that I could create some sort of virtual sensor in HA but that displays the value 4h in the future, and make the graph card track that sensor instead, but I don't know how would I display the current price in the top-left corner if I did that, or how I'd display the past hours and the future hours with different colors (perhaps with a slight transparency)