Coder Social home page Coder Social logo

Comments (6)

adriankumpf avatar adriankumpf commented on May 19, 2024 1

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

SELECT name AS __text, id AS __value FROM cars

from teslamate.

adriankumpf avatar adriankumpf commented on May 19, 2024

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

from teslamate.

bahree avatar bahree commented on May 19, 2024

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!

from teslamate.

adriankumpf avatar adriankumpf commented on May 19, 2024

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?

from teslamate.

bahree avatar bahree commented on May 19, 2024

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.

from teslamate.

adriankumpf avatar adriankumpf commented on May 19, 2024

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.

from teslamate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.