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

Add GPS panel query/support to Grafana integration #535

Open
daisycrego opened this issue Apr 22, 2020 · 0 comments
Open

Add GPS panel query/support to Grafana integration #535

daisycrego opened this issue Apr 22, 2020 · 0 comments
Assignees

Comments

@daisycrego
Copy link
Contributor

User story
tbd

Acceptance criteria

grafana-cli plugins install pr0ps-trackmap-panel
  • For remote-host Grafana, create instructions for how to add the plugin.
  • Detect from the sensor that this is a GPS sensor when the sensor is created in the UI
  • Build special SQL query for the TrackMap plugin:
SELECT timestamp as "time",
        cast(value->'result'->'latitude' AS float) AS lat,
        cast(value->'result'->'longitude' AS float) AS lon
        FROM ag_data_agmeasurement
        WHERE $__timeFilter("timestamp")
        AND sensor_id_id=1
        AND "event_uuid_id"='f64d1e21-22f7-4245-8a2d-dcbb7fef8df9'
        ORDER BY timestamp

Definition of Done
tbd

daisycrego added a commit that referenced this issue Apr 26, 2020
1. Add an attribute to the AGSensorType model: graph_type. Graph type stores a string representing the graph type. Current options are: graph (simple line graph), map (for GPS sensors), and gauge (for single-value readings, e.g. speed). Add migrations file for the model change.
2. Update the Grafana class to support creating 3 panel types: regular graph (type that was made previously), map (using the TrackMap plugin), and gauge.
a. Update Grafana.create_panel_query to create a special type of query if panel_type=="map". The TrackMap plugin requires specific field names, while graph and gauge types can be built using the previous approach.
b. Update Grafana.create_panel_dict to take a new parameter, panel_type, and create a panel JSON object with the required attributes for that panel type.
c. Update Grafana.update_panel_sensor to update the graph type when the sensor is updated.
3. Update sensor.html, sensor.py, and sensor.js to support choosing graph type:
a. Allow the user to choose their graph type when creating a new sensor.
b. Allow the user to update their graph type when updating a new sensor.
c. When the user changes the select option, a picture illustrating the graph type is displayed. This works both when adding a new sensor and when updating an existing sensor.
d. If the user tries to create a map panel without exactly 2 fields, the sensor will not be created/updated and a warning will be shown.
4. Update gf_config.py. Grafana.update_dashboard_panels may throw a ValueError, which should be caught and passed to the user.

Other
1. Update the refresh rate to 1s when the dashboard is updated (previously when the dashboard was reset, the refresh time was being reset to 0.5 s.
2. Warn before deleting sensor - warn the user before a sensor is deleted that measurements will be deleted. Improved the previous warning implementation for updating a sensor.
@daisycrego daisycrego mentioned this issue Apr 27, 2020
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants