Background:
I am using the Noble bluetooth library, but am experiencing a bug where the bluetooth radio hangs if the peripheral is disconnected during the connect phase. For now, I have only bypassed this by restarting the container. At first, I tried querying the balena supervisor using the api call
$BALENA_SUPERVISOR_ADDRESS/v1/restart?apikey=$BALENA_SUPERVISOR_API_KEY
.
This works as expected, but I have found out I need to restart the whole service for the bluetooth radio to recover properly.
Issue:
As per the Node SDK, I should be able to call
balena.models.device.restartService(UUID, imageID).then(function() { ... });
As evident, I need the Image ID, which the supervisor documentation tells me I should be able to fetch using
curl -X GET --header "Content-Type:application/json" \ "$BALENA_SUPERVISOR_ADDRESS/v1/apps/<appId>?apikey=$BALENA_SUPERVISOR_API_KEY"
but the response does not contain an image id, only appid, container id and release id.
Does anybody know how I can get the Image ID - or do anybody have alternatives to restarting the service (similarly to how you would do in the dashboard) in a better way?
All the best,
Rasmus