From f086f75c07c536550e25c3ee028762e1778d8e43 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Sun, 24 Oct 2021 11:37:27 -0400 Subject: [PATCH] docs: Add documentation for new service and power features Signed-off-by: Eric Callahan --- docs/configuration.md | 22 +++++++++++++++- docs/web_api.md | 61 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 71 insertions(+), 12 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 056bd4f..a9508e2 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -213,6 +213,13 @@ restart_klipper_when_powered: False # If set to True, Moonraker will issue a "FIRMWARE_RESTART" to Klipper # after the device has been powered on. The default is False, thus no # attempt to made to restart Klipper after power on. +bound_service: +# Can be set to any service Moonraker is authorized to manage with the +# exception of the moonraker service itself. See the tip below this section +# for details on what services are authorized. When a bound service has +# been set the service will be started when the device powers on and stopped +# when the device powers off. The default is no service is bound to the +# device. restart_delay: 1. # If "restart_klipper_when_powered" is set, this option specifies the amount # of time (in seconds) to delay the restart. Default is 1 second. @@ -310,8 +317,21 @@ off_code: # The above options are used for "rf" devices. The # codes should be valid binary codes that are send via the RF transmitter. # For example: 1011. - ``` + +!!! Tip + Moonraker is authorized to manage the `klipper`, `klipper_mcu`, + `webcamd`, `MoonCord`, `KlipperScreen`, and `moonraker-telegram-bot` + services. It can also manage multiple instances of a service, ie: + `klipper_1`, `klipper_2`. Keep in mind that service names are case + sensitive. + +!!! Note + If a device has been bound to the `klipper` service and the + `restart_klipper_when_powered` option is set to `True`, the restart + will be scheduled to execute after Klipper reports that its startup + sequence is complete. + Below are some potential examples: ```ini # moonraker.conf diff --git a/docs/web_api.md b/docs/web_api.md index 8e708d2..3adba37 100644 --- a/docs/web_api.md +++ b/docs/web_api.md @@ -833,27 +833,26 @@ Returns: Information about the host system in the following format: ```json { "system_info": { - "available_services": ["moonraker", "klipper"], "cpu_info": { - "cpu_count": 1, + "cpu_count": 4, "bits": "32bit", - "processor": "armv6l", - "cpu_desc": "ARMv6-compatible processor rev 7 (v6l)", + "processor": "armv7l", + "cpu_desc": "ARMv7 Processor rev 4 (v7l)", "hardware_desc": "BCM2835", - "model": "Raspberry Pi Zero W Rev 1.1", - "total_memory": 439276, + "model": "Raspberry Pi 3 Model B Rev 1.2", + "total_memory": 945364, "memory_units": "kB" }, "sd_info": { "manufacturer_id": "03", "manufacturer": "Sandisk", "oem_id": "5344", - "product_name": "SS08G", + "product_name": "SU32G", "product_revision": "8.0", - "serial_number": "00112233", - "manufacturer_date": "9/2017", - "capacity": "7.4 GiB", - "total_bytes": 7948206080 + "serial_number": "46ba46", + "manufacturer_date": "4/2018", + "capacity": "29.7 GiB", + "total_bytes": 31914983424 }, "distribution": { "name": "Raspbian GNU/Linux 10 (buster)", @@ -866,6 +865,25 @@ Returns: Information about the host system in the following format: }, "like": "debian", "codename": "buster" + }, + "available_services": [ + "klipper", + "klipper_mcu", + "moonraker" + ], + "service_state": { + "klipper": { + "active_state": "active", + "sub_state": "running" + }, + "klipper_mcu": { + "active_state": "active", + "sub_state": "running" + }, + "moonraker": { + "active_state": "active", + "sub_state": "running" + } } } } @@ -3349,6 +3367,27 @@ sent when an existing user is deleted. } ``` +#### Service State Changed +Moonraker monitors the state of systemd services it is authorized to track. +When the state of a service changes the following notification is sent: + +```json +{ + "jsonrpc": "2.0", + "method": "notify_service_state_changed", + "params": [ + { + "klipper": { + "active_state": "inactive", + "sub_state": "dead" + } + } + ] +} +``` + +The example above shows that the `klipper` service has changed to `inactive`. + ### Appendix #### Websocket setup