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

Suggestion - In dashboard can we have the car names instead of ID? #93

Closed
bahree opened this issue Aug 15, 2019 · 6 comments
Closed

Suggestion - In dashboard can we have the car names instead of ID? #93

bahree opened this issue Aug 15, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@bahree
Copy link

bahree commented Aug 15, 2019

So I am curious if this is a simple join or something more - when looking at the various dashboards, instead of the car numeral ("1") in my case, is it possible to show the Car name instead? This is the drop down in the top left corner.

@adriankumpf
Copy link
Collaborator

adriankumpf commented Aug 15, 2019

Yes, that would be great! I haven't figured out how to do it yet. But there's probably a clever way.

@adriankumpf adriankumpf added enhancement New feature or request note:help wanted Extra attention is needed labels Aug 15, 2019
@bahree
Copy link
Author

bahree commented Aug 15, 2019

When you insert the car ID in the database, perhaps if we add a column and call it CarName or something similar? From Tesla, the API returns this as "display_name" and it seems you are already logging this.

Here is what I saw - looks like a function called create_new in vehicles.ex. Just using the display_name in addition to everything else might work.

Logger.info("Found car '#{vehicle.display_name}'")

    {:ok, car} =
      case Log.get_car_by_eid(vehicle.id) do
        nil ->
          properties = Identification.properties(vehicle)

          Log.create_car(%{
            eid: vehicle.id,
            vid: vehicle.vehicle_id,
            model: properties.model,
            efficiency: properties.efficiency
          })

        car ->
          {:ok, car}
      end

I don't know Elixir, but sometime back I had written a Tesla Token Generator (for windows) and you can see the details on what the API returns here.

Happy to try it out and help test/debug.

Thanks again!

@adriankumpf
Copy link
Collaborator

adriankumpf commented Aug 15, 2019

Yes, storing the display_name like you proposed would become necessary. What then remains is showing the display_name in grafana while at the same time combining it with the id somehow i.e. selecting the car's name in the dropdown should actually set the corresponding car_id (the car_id is required by most queries). Does that make sense?

@bahree
Copy link
Author

bahree commented Aug 16, 2019

Do you think, it could be something like car_id - display_name. So it would show up like 1 - WhateverCoolNameYourCarHas - or something along those lines.

@adriankumpf
Copy link
Collaborator

If there is some way to replace text inside a variable, that could work!

Another idea is to use two variables: one to select the name and another hidden one that references the name variable fetches the corresponding car id.

@adriankumpf
Copy link
Collaborator

adriankumpf commented Aug 16, 2019

Oh, there is a way to create a key/value variables in Grafana!

SELECT name AS __text, id AS __value FROM cars

@adriankumpf adriankumpf removed the note:help wanted Extra attention is needed label Aug 17, 2019
@adriankumpf adriankumpf mentioned this issue Aug 18, 2019
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