Persistent connections to Moonraker (websocket, unix socket) will
receive asynchronous via JSON-RPC notifications. A "notification"
in JSON-RPC is a method call without an id parameter, for example:
To keep consistency Moonraker always sends parameters as positional
arguments. Specifically, the params field will always contain
an array. This can often lead to a somewhat strange format where
the params field contains a single element array, where the element
is an object.
All of the notifications sent by Moonraker are outlined in this document.
An object containing changes to subscribed Klipper objects. Each key is the name of a printer object, each value will be an object containing fields that have changed since the last update.
1
float
A timestamp indicating the time the subscription data was sent. This time is relative to the monotonic clock used by Klipper.
Tip
See Klipper's status reference
for details on printer objects and the fields they report.
Moonraker's file_manager will emit notifications when a change
to one of its watched root directories is detected. This includes
changes to files and subdirectories within the root.
The path of the destination item relative to the root directory.
root
string
The root node of the destination item.
modified
float
The last modified date in Unix Time (seconds).
size
int
The size of the destination item.
permissions
string
Permissions available on the changed item (if applicable).
source_item
object
The source item affected by the change. Only present for move_file and move_dir actions.
Source Item Info
Field
Type
Description
path
string
The path of the source item relative to the root directory.
root
string
The root node of the source item.
Filelist Changed Action
Action
Description
create_file
A file has been created within the watched root.
create_dir
A subdirectory has been created within the watched root.
delete_file
A file has been deleted within the watched root.
delete_dir
A subdirectory has been deleted within the watched root.
move_file
A file in a watched root has been moved.
move_dir
A subdirectory in a watched root has been moved.
modify_file
A file in a watched root has been modified.
root_update
A root folder's location on disk has changed.
Tip
Notifications are bundled where applicable. For example, when a
directory containing children is deleted a single delete_dir
notification is pushed. Likewise, when a directory is moved or copied,
a single move_dir or create_dir notification is pushed. Children
that are moved, copied, or deleted as a result of a parent's action will
not receive individual notifications.
While the update_manager is in the process of updating one or more
registered software items, it will emit notifications containing information
about the current status of the update.
After the update manager has performed a refresh of the
registered software update state it will send a notification
to all connections containing the complete current status.
Notification Method Name
notify_update_refreshed
Example Notification
{"jsonrpc":"2.0","method":"notify_update_refreshed","params":[{"busy":false,"github_rate_limit":60,"github_requests_remaining":57,"github_limit_reset_time":1615836932,"version_info":{"system":{"name":"system","configured_type":"system","package_count":4,"package_list":["libtiff5","raspberrypi-sys-mods","rpi-eeprom-images","rpi-eeprom"]},"moonraker":{"channel":"dev","debug_enabled":true,"is_valid":true,"configured_type":"git_repo","corrupt":false,"info_tags":[],"detected_type":"git_repo","name":"moonraker","remote_alias":"arksine","branch":"master","owner":"arksine","repo_name":"moonraker","version":"v0.7.1-364","remote_version":"v0.7.1-364","rollback_version":"v0.7.1-360","current_hash":"ecfad5cff15fff1d82cb9bdc64d6b548ed53dfaf","remote_hash":"ecfad5cff15fff1d82cb9bdc64d6b548ed53dfaf","is_dirty":false,"detached":true,"commits_behind":[],"git_messages":[],"full_version_string":"v0.7.1-364-gecfad5c","pristine":true,"recovery_url":"https://github.com/Arksine/moonraker.git","remote_url":"https://github.com/Arksine/moonraker.git","warnings":[],"anomalies":["Unofficial remote url: https://github.com/Arksine/moonraker-fork.git","Repo not on official remote/branch, expected: origin/master, detected: altremote/altbranch","Detached HEAD detected"]},"mainsail":{"name":"mainsail","owner":"mainsail-crew","version":"v2.1.1","remote_version":"v2.1.1","rollback_version":"v2.0.0","configured_type":"web","channel":"stable","info_tags":["desc=Mainsail Web Client","action=some_action"],"warnings":[],"anomalies":[],"is_valid":true},"fluidd":{"name":"fluidd","owner":"fluidd-core","version":"v1.16.2","remote_version":"v1.16.2","rollback_version":"v1.15.0","configured_type":"web","channel":"beta","info_tags":[],"warnings":[],"anomalies":[],"is_valid":true},"klipper":{"channel":"dev","debug_enabled":true,"is_valid":true,"configured_type":"git_repo","corrupt":false,"info_tags":[],"detected_type":"git_repo","name":"klipper","remote_alias":"origin","branch":"master","owner":"Klipper3d","repo_name":"klipper","version":"v0.10.0-1","remote_version":"v0.10.0-41","rollback_version":"v0.9.1-340","current_hash":"4c8d24ae03eadf3fc5a28efb1209ce810251d02d","remote_hash":"e3cbe7ea3663a8cd10207a9aecc4e5458aeb1f1f","is_dirty":false,"detached":false,"commits_behind":[{"sha":"e3cbe7ea3663a8cd10207a9aecc4e5458aeb1f1f","author":"Kevin O'Connor","date":"1644534721","subject":"stm32: Clear SPE flag on a change to SPI CR1 register","message":"The stm32 specs indicate that the SPE bit must be cleared before\nchanging the CPHA or CPOL bits.\n\nReported by @cbc02009 and @bigtreetech.\n\nSigned-off-by: Kevin O'Connor <kevin@koconnor.net>","tag":null},{"sha":"99d55185a21703611b862f6ce4b80bba70a9c4b5","author":"Kevin O'Connor","date":"1644532075","subject":"stm32: Wait for transmission to complete before returning from spi_transfer()","message":"It's possible for the SCLK pin to still be updating even after the\nlast byte of data has been read from the receive pin. (In particular\nin spi mode 0 and 1.) Exiting early from spi_transfer() in this case\ncould result in the CS pin being raised before the final updates to\nSCLK pin.\n\nAdd an additional wait at the end of spi_transfer() to avoid this\nissue.\n\nSigned-off-by: Kevin O'Connor <kevin@koconnor.net>","tag":null}],"git_messages":[],"full_version_string":"v0.10.0-1-g4c8d24ae-shallow","pristine":true,"recovery_url":"https://github.com/Klipper3d/klipper.git","remote_url":"https://github.com/Klipper3d/klipper.git","warnings":[],"anomalies":[]}}}]}
The current throttled state as an integer. A bitwise AND can be performed against this value to generate custom flag descriptions.
flags
[string]
A list of Throttled Flags describing the current state.
Throttled Flags
Flag
Bit Offset
Under-Voltage Detected
1 << 0
Frequency Capped
1 << 1
Currently Throttled
1 << 2
Temperature Limit Active
1 << 3
Previously Under-Volted
1 << 16
Previously Frequency Capped
1 << 17
Previously Throttled
1 << 18
Previously Temperature Limited
1 << 16
Note
It is possible for clients to receive this notification multiple times
if the system repeatedly transitions between an active and inactive throttled
condition.
If Moonraker's [machine] component is configured with its systemd
integration enabled it will monitor the state of various systemd services.
When a change is detected in service state Moonraker will emit a
notification.
Moonraker's [announcements] component will emit a notification
when announcement entries are added or removed.
Notification Method Name
notify_announcement_update
Example Notification
{"jsonrpc":"2.0","method":"notify_announcement_update","params":[{"entries":[{"entry_id":"arksine/moonlight/issue/3","url":"https://github.com/Arksine/moonlight/issues/3","title":"Test announcement 3","description":"Test Description [with a link](https://moonraker.readthedocs.io).","priority":"normal","date":1647459219,"dismissed":false,"date_dismissed":null,"dismiss_wake":null,"source":"moonlight","feed":"moonlight"},{"entry_id":"arksine/moonlight/issue/2","url":"https://github.com/Arksine/moonlight/issues/2","title":"Announcement Test Two","description":"This is a high priority announcement. This line is included in the description.","priority":"high","date":1646855579,"dismissed":false,"date_dismissed":null,"dismiss_wake":null,"source":"moonlight","feed":"moonlight"}{"entry_id":"arksine/moonraker/issue/349","url":"https://github.com/Arksine/moonraker/issues/349","title":"PolicyKit warnings; unable to manage services, restart system, or update packages","description":"This announcement is an effort to get ahead of a coming change that will certainly result in issues. PR #346 has been merged, and with it are some changes to Moonraker's default behavior.","priority":"normal","date":1643392406,"dismissed":false,"source":"moonlight","feed":"Moonraker"}]}]}
At times Moonraker may require sudo permission to perform a specific task.
This is rare and generally involves an upgrade (ie: Moonraker's systemd
service file needs to be modified). When Moonraker runs a command that
requires sudo permission an alert will be sent via notification.
Pending sudo requests that cannot be executed until the user
sets their sudo password will
also emit a notification.
Notification Method Name
notify_sudo_alert
Example Notification
{"jsonrpc":"2.0","method":"notify_sudo_alert","params":[{"sudo_requested":true,"sudo_messages":["Sudo password required to update Moonraker's systemd service."]}]}
Moonraker's [spoolman] component holds a persistent websocket
connection to the server. This allow Moonraker to remain aware
of the server's status. Moonraker will emit a notification when
the connection status to Spoolman changes.
Moonraker has limited support for third party extensions through
client connections that identify themselves as
agents.
Agents are granted access to additional endpoints that allow
them to extend Moonraker's functionality. One such method
allows agents to send events that are broadcast to all of Moonraker's
connected clients. Moonraker proxies agent events through a
notification.
Moonraker's [sensor] component will take periodic measurements
of configured sensors. When one or more new measurement is received
a notification will be emitted containing the new measurement data.
The object may contain multiple sensors, where each key is the name of a sensor and the value is a Sensor Values object.
Sensor Values
Field
Type
Description
value_name
any
The object may contain multiple values, where each key is the name of a parameter tracked by the sensor, and the value is the most recent reported measurement.