klippy_connection: request endpoints before setting the state

All of Klipper's endpoints should be available before Moonraker
reports the "ready" state.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-05-12 19:22:56 -04:00
parent 3d9f5dc6d9
commit 09ac00ce2e
No known key found for this signature in database
GPG Key ID: 7027245FBBDDF59A
1 changed files with 5 additions and 2 deletions

View File

@ -326,13 +326,16 @@ class KlippyConnection:
msg = f"Klipper Version: {version}" msg = f"Klipper Version: {version}"
self.server.add_log_rollover_item("klipper_version", msg) self.server.add_log_rollover_item("klipper_version", msg)
self._klippy_info = dict(result) self._klippy_info = dict(result)
self._state = result.get('state', "unknown") state = result.get('state', "unknown")
if state != "startup" and "endpoints_requested" not in self.init_list:
await self._request_endpoints()
self.init_list.append("endpoints_requested")
self._state = state
if send_id: if send_id:
self.init_list.append("identified") self.init_list.append("identified")
await self.server.send_event("server:klippy_identified") await self.server.send_event("server:klippy_identified")
if self._state != "startup": if self._state != "startup":
self.init_list.append('startup_complete') self.init_list.append('startup_complete')
await self._request_endpoints()
await self.server.send_event("server:klippy_started", await self.server.send_event("server:klippy_started",
self._state) self._state)
if self._state != "ready": if self._state != "ready":