Recovery mode
Check whether the sensor is in recovery mode and why, and boot the installed firmware again. In the WebGUI, see Recovery mode.
The examples use the Python library and sign in with an application key. Replace qb2-xxxxxxxxx with the hostname or IP address of your sensor and application-key-for-qb2-xxxxxxxxx with the secret of your key.
Check if the sensor is in recovery mode
The method Get tells whether the sensor is in recovery mode, and why.
import blickfeld_qb2
def get_recovery_state() -> None:
# Create token factory using an application key
token_factory = blickfeld_qb2.TokenFactory(
application_key_secret="application-key-for-qb2-xxxxxxxxx"
)
# Open a secure connection to the sensor
with blickfeld_qb2.Channel("qb2-xxxxxxxxx", token=token_factory) as channel:
# Use recovery service
service = blickfeld_qb2.hardware.services.Recovery(channel)
# Get the information from the recovery service
response = service.get()
# Print the response
print(response)
get_recovery_state()
Output of a sensor that is not in recovery mode, which has no reason:
RecoveryGetResponse(recovery=Recovery())
In recovery mode, reason is one of the reasons defined in the Recovery object, for example Recovery(reason=2):
| Value | Reason | Next step |
|---|---|---|
|
|
Try to boot the installed firmware again, see Boot the installed firmware again. |
|
|
Boot the installed firmware again
With the reason REASON_BOOT_ATTEMPTS_EXCEEDED, the method AttemptBoot tries to boot the installed firmware again. With any other reason, the sensor refuses the call with FAILED_PRECONDITION; install a firmware instead.
import blickfeld_qb2
def attempt_boot_from_recovery() -> None:
# Create token factory using an application key
token_factory = blickfeld_qb2.TokenFactory(
application_key_secret="application-key-for-qb2-xxxxxxxxx"
)
# Open a secure connection to the sensor
with blickfeld_qb2.Channel("qb2-xxxxxxxxx", token=token_factory) as channel:
# Use Recovery service
service = blickfeld_qb2.hardware.services.Recovery(channel)
# Call the service to attempt a boot into the existing firmware
service.attempt_boot()
attempt_boot_from_recovery()