File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828 GetHardwareRsp ,
2929 GetHdmiStateRsp ,
3030 GetHidModeRsp ,
31+ GetHostnameRsp ,
3132 GetImagesRsp ,
3233 GetInfoRsp ,
3334 GetMdnsStateRsp ,
5455 PasteReq ,
5556 SetGpioReq ,
5657 SetHidModeReq ,
58+ SetHostnameReq ,
5759 SetMemoryLimitReq ,
5860 SetMouseJigglerReq ,
5961 SetOledReq ,
@@ -323,6 +325,22 @@ async def get_hardware(self) -> GetHardwareRsp:
323325 response_model = GetHardwareRsp ,
324326 )
325327
328+ async def get_hostname (self ) -> GetHostnameRsp :
329+ """Get the configured hostname."""
330+ return await self ._api_request_json (
331+ hdrs .METH_GET ,
332+ "/vm/hostname" ,
333+ response_model = GetHostnameRsp ,
334+ )
335+
336+ async def set_hostname (self , hostname : str ) -> None :
337+ """Set the device hostname (applies after reboot)."""
338+ await self ._api_request_json (
339+ hdrs .METH_POST ,
340+ "/vm/hostname" ,
341+ data = SetHostnameReq (hostname = hostname ),
342+ )
343+
326344 async def get_gpio (self ) -> GetGpioRsp :
327345 """Get GPIO LED status."""
328346 return await self ._api_request_json (
Original file line number Diff line number Diff line change @@ -160,6 +160,14 @@ class GetInfoRsp(BaseModel):
160160 device_key : str = Field (alias = "deviceKey" )
161161
162162
163+ class GetHostnameRsp (BaseModel ):
164+ hostname : str
165+
166+
167+ class SetHostnameReq (BaseModel ):
168+ hostname : str # Applies after reboot
169+
170+
163171class GetHardwareRsp (BaseModel ):
164172 version : HWVersion
165173
You can’t perform that action at this time.
0 commit comments