Conversation
Normalize `/storage/image` responses where `data.files` is `null` instead of a list.
On a real NanoKVM Pro (app 1.2.14 / image v1.0.14), the endpoint can return:
{"code":0,"msg":"success","data":{"files":null}}
That caused `GetImagesRsp` validation to fail with `NanoKVMInvalidResponseError`.
This change coerces `files=None` to `[]` while keeping the public Python type as `list[str]`.
|
I tested this branch against a real NanoKVM Pro ( Other than that, the Pro support in this PR behaved as intended on real hardware. The shared/Pro reads, the reversible Pro setters I exercised, MJPEG, and the WebSocket mouse helpers all worked correctly, and the non-Pro-only methods correctly reported From my testing, the Of course, we can add support for additional API endpoints later, but for now this should be sufficient. |
This PR was lovingly hand-crafted by CC, I don't own the Pro hardware and have no way to runtime test this change. Unfortunately, it looks like the Pro has its own independent API that has starting diverging from the non-Pro variant.
I've condensed the Home Assistant-relevant breaking changes below:
get_virtual_device_status()returnsGetVirtualDeviceRsp | GetVirtualDeviceProRsp- caller must check typeget_hdmi_state(), reset_hdmi(), enable_hdmi(), disable_hdmi() raiseNanoKVMNotSupportedErroron Proget_swap_size(),set_swap_size(),enable_swap(),disable_swap()raiseNanoKVMNotSupportedErroron Proget_memory_limit(), set_memory_limit() raise NanoKVMNotSupportedError on Proget_cdrom_status()raises NanoKVMNotSupportedError on Proupdate_virtual_device()returns None instead of UpdateVirtualDeviceRsp; accepts newdisk_typekwarg for ProAnd the expected HA integration breaks:
Related issue: Wouter0100/homeassistant-nanokvm#66