Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global or tag based date and time picker. #403

Open
kylian-002 opened this issue Mar 29, 2024 · 4 comments
Open

Global or tag based date and time picker. #403

kylian-002 opened this issue Mar 29, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@kylian-002
Copy link

Describe the solution you'd like
I would like to have the ability to use a single set of date and time selection controls to select the date and time for all cards on a given dashboard, or perhaps for a selected few that are selectable by tags. This functionality would be similar to how the "energy-date-selection" card works for the energy dashboard but applicable to Plotly cards and usable for purposes other than energy-related data.

How would it be defined in yaml?

type: custom:plotly-graph
entities:
  - entity: sensor.monthly_internet_energy
     entity_feature_config: xxx
global_feature_config: xxx
tag: tagname
@kylian-002 kylian-002 added the enhancement New feature or request label Mar 29, 2024
@dbuezas
Copy link
Owner

dbuezas commented Mar 29, 2024

You could post values from one plot into a sensor using the hass object, then fetch it in the other one.
The currently visible range is in get('vidible_range')

@dbuezas
Copy link
Owner

dbuezas commented Mar 29, 2024

Ok, I tried it and it does work but it is not great to be honest.

One thing you could do is to put all plots in a single card like this:
#13

@dbuezas
Copy link
Owner

dbuezas commented Mar 30, 2024

For the record, this was my experiment:

Kapture.2024-03-30.at.08.22.56.mp4

Master chart

type: custom:plotly-graph
entities:
  - entity: sensor.senseair_co2
fn: >
  $ex hass.callApi("POST", "states/sensor.plotly_visible_range", {state:
  JSON.stringify(get("visible_range"))})

Other synched chart

type: custom:plotly-graph
entities:
  - entity: sensor.senseair_co2
  - entity: sensor.plotly_visible_range
    internal: false
    comment1: for some reason, plotly doesnt update the layout if this is internal true
    comment2: this is here just to make plotly refresh when visible range changes
    yaxis: y10
    'y': []
layout:
  xaxis:
    range: |
      $ex JSON.parse(hass.states["sensor.plotly_visible_range"].state)
hours_to_show: 24
refresh_interval: auto

@kylian-002
Copy link
Author

Ok, I tried it and it does work but it is not great to be honest.

One thing you could do is to put all plots in a single card like this: #13

I think this wil work for my usecase. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants