Skip to content

MachineNamespace

pymoonraker.api.MachineNamespace

Host machine administration.

Auto-generated from schema/moonraker_api.yaml.

Source code in src/pymoonraker/api/_generated.py
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
class MachineNamespace:
    """Host machine administration.

    Auto-generated from schema/moonraker_api.yaml.
    """

    def __init__(self, client: MoonrakerClient) -> None:
        self._client = client

    async def system_info(self) -> MachineSystemInfoResponse:
        """Get host system information (CPU, distro, network)."""
        raw = await self._client.call("machine.system_info")
        return MachineSystemInfoResponse.model_validate(raw)

    async def shutdown(self) -> str:
        """Shut down the host machine."""
        raw = await self._client.call("machine.shutdown")
        return cast("str", raw)

    async def reboot(self) -> str:
        """Reboot the host machine."""
        raw = await self._client.call("machine.reboot")
        return cast("str", raw)

    async def proc_stats(self) -> MachineProcStatsResponse:
        """Get process statistics for Moonraker and system."""
        raw = await self._client.call("machine.proc_stats")
        return MachineProcStatsResponse.model_validate(raw)

    async def restart_service(self, service: str) -> str:
        """Restart a systemd service.

        Args:
            service: Service name to restart

        """
        params: dict[str, Any] = {}
        params["service"] = service
        raw = await self._client.call("machine.services.restart", params)
        return cast("str", raw)

    async def stop_service(self, service: str) -> str:
        """Stop a systemd service.

        Args:
            service: Service name to stop

        """
        params: dict[str, Any] = {}
        params["service"] = service
        raw = await self._client.call("machine.services.stop", params)
        return cast("str", raw)

    async def start_service(self, service: str) -> str:
        """Start a systemd service.

        Args:
            service: Service name to start

        """
        params: dict[str, Any] = {}
        params["service"] = service
        raw = await self._client.call("machine.services.start", params)
        return cast("str", raw)

proc_stats async

proc_stats() -> MachineProcStatsResponse

Get process statistics for Moonraker and system.

Source code in src/pymoonraker/api/_generated.py
493
494
495
496
async def proc_stats(self) -> MachineProcStatsResponse:
    """Get process statistics for Moonraker and system."""
    raw = await self._client.call("machine.proc_stats")
    return MachineProcStatsResponse.model_validate(raw)

reboot async

reboot() -> str

Reboot the host machine.

Source code in src/pymoonraker/api/_generated.py
488
489
490
491
async def reboot(self) -> str:
    """Reboot the host machine."""
    raw = await self._client.call("machine.reboot")
    return cast("str", raw)

restart_service async

restart_service(service: str) -> str

Restart a systemd service.

Parameters:

Name Type Description Default
service str

Service name to restart

required
Source code in src/pymoonraker/api/_generated.py
498
499
500
501
502
503
504
505
506
507
508
async def restart_service(self, service: str) -> str:
    """Restart a systemd service.

    Args:
        service: Service name to restart

    """
    params: dict[str, Any] = {}
    params["service"] = service
    raw = await self._client.call("machine.services.restart", params)
    return cast("str", raw)

shutdown async

shutdown() -> str

Shut down the host machine.

Source code in src/pymoonraker/api/_generated.py
483
484
485
486
async def shutdown(self) -> str:
    """Shut down the host machine."""
    raw = await self._client.call("machine.shutdown")
    return cast("str", raw)

start_service async

start_service(service: str) -> str

Start a systemd service.

Parameters:

Name Type Description Default
service str

Service name to start

required
Source code in src/pymoonraker/api/_generated.py
522
523
524
525
526
527
528
529
530
531
532
async def start_service(self, service: str) -> str:
    """Start a systemd service.

    Args:
        service: Service name to start

    """
    params: dict[str, Any] = {}
    params["service"] = service
    raw = await self._client.call("machine.services.start", params)
    return cast("str", raw)

stop_service async

stop_service(service: str) -> str

Stop a systemd service.

Parameters:

Name Type Description Default
service str

Service name to stop

required
Source code in src/pymoonraker/api/_generated.py
510
511
512
513
514
515
516
517
518
519
520
async def stop_service(self, service: str) -> str:
    """Stop a systemd service.

    Args:
        service: Service name to stop

    """
    params: dict[str, Any] = {}
    params["service"] = service
    raw = await self._client.call("machine.services.stop", params)
    return cast("str", raw)

system_info async

system_info() -> MachineSystemInfoResponse

Get host system information (CPU, distro, network).

Source code in src/pymoonraker/api/_generated.py
478
479
480
481
async def system_info(self) -> MachineSystemInfoResponse:
    """Get host system information (CPU, distro, network)."""
    raw = await self._client.call("machine.system_info")
    return MachineSystemInfoResponse.model_validate(raw)