feat: add get_version endpoint for individual sensors

This commit is contained in:
2026-05-18 18:19:16 +02:00
parent 2601484fad
commit ef7bf8c6e4
3 changed files with 12 additions and 0 deletions
@@ -239,6 +239,12 @@ defmodule Localiser.Web.Controllers.SensorController do
json(conn, %{status: "ok"})
end
def get_version(conn, %{"id" => id}) do
sensor = Sensors.get_sensor!(id)
{:ok, _} = Sensors.get_version(sensor)
json(conn, %{status: "ok"})
end
def reconfigure(conn, %{"id" => id} = params) do
sensor = Sensors.get_sensor!(id)
config = Map.take(params, ["ssid", "password", "mqtt_broker", "mqtt_port"])
+1
View File
@@ -103,5 +103,6 @@ defmodule Localiser.Web.Router do
post "/sensors/:id/reconfigure", SensorController, :reconfigure
post "/sensors/:id/calibration/start", SensorController, :calibration_start
post "/sensors/:id/calibration/stop", SensorController, :calibration_stop
get "/sensors/:id/version", SensorController, :get_version
end
end