ファームウェアの更新
このページは自動翻訳されたもので、まだレビューされていません。内容に相違がある場合は、英語の原文が優先されます。 英語の原文を読む
APIを介してファームウェアステータスを読み出し、ファームウェアを更新します。WebGUIでの操作は、ファームウェアを更新するを参照してください。
これらの例は Pythonライブラリを使用し、アプリケーションキーでサインインします。qb2-xxxxxxxxx をお使いのセンサーのホスト名またはIPアドレスに、application-key-for-qb2-xxxxxxxxx をキーのシークレットに置き換えてください。
ファームウェアステータスの取得
GetStatusメソッドは、インストール済みのファームウェアと、実行中または失敗したインストールを返します。
import blickfeld_qb2
token_factory = blickfeld_qb2.TokenFactory(application_key_secret="application-key-for-qb2-xxxxxxxxx")
with blickfeld_qb2.Channel(fqdn_or_ip="qb2-xxxxxxxxx", token=token_factory) as channel:
service = blickfeld_qb2.system.services.Firmware(channel)
# Read out current status
response = service.get_status()
print(response.status)
出力(1行に1フィールド):
FirmwareStatus(
idle=FirmwareStatusIdle(),
installed_firmware_info=FirmwareInfo(
label='HENNING v3.2.4',
version=Version(major=3, minor=2, patch=4, revision='d1c2d249'),
allowed_downgrade_version=Version(major=3, patch=11)
)
)
ファームウェアの取得とインストール
FetchAndInstallメソッドは、ファームウェアバンドルをダウンロードしてセンサーにインストールし、その後センサーが再起動します。
例のようにソースを指定しない場合は、最新のリリースを取得します。別のファームウェアをインストールするには、ファームウェアバンドルのアドレスを指定したurl、またはversionを渡してください。
センサーは、バンドルを保持するサーバーに到達できる必要があります。
import blickfeld_qb2
token_factory = blickfeld_qb2.TokenFactory(application_key_secret="application-key-for-qb2-xxxxxxxxx")
# Open a secure and authenticated connection to the sensor
with blickfeld_qb2.Channel(fqdn_or_ip="qb2-xxxxxxxxx", token=token_factory) as channel:
service = blickfeld_qb2.system.services.Firmware(channel)
# Fetch the latest firmware bundle and install it on the sensor
for response in service.fetch_and_install():
print(response.status)
出力:
FirmwareStatus(installation=FirmwareStatusInstallation(progress=FirmwareStatusInstallationProgress(message='Installing')))
FirmwareStatus(installation=FirmwareStatusInstallation(progress=FirmwareStatusInstallationProgress(message='Determining slot states')))
FirmwareStatus(installation=FirmwareStatusInstallation(progress=FirmwareStatusInstallationProgress(percent=20, message='Determining slot states done.')))
FirmwareStatus(installation=FirmwareStatusInstallation(progress=FirmwareStatusInstallationProgress(percent=20, message='Checking bundle')))
FirmwareStatus(installation=FirmwareStatusInstallation(progress=FirmwareStatusInstallationProgress(percent=20, message='Verifying signature')))
FirmwareStatus(installation=FirmwareStatusInstallation(progress=FirmwareStatusInstallationProgress(percent=40, message='Verifying signature done.')))
...
FirmwareStatus(installation=FirmwareStatusInstallation(progress=FirmwareStatusInstallationProgress(percent=99, message='Updating slots done.')))
FirmwareStatus(reboot=FirmwareStatusReboot())