diff --git a/AUTHORS.md b/AUTHORS.md index f1a1f7775..d54b9fe3a 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -179,6 +179,7 @@ date of first contribution): * [Shyam Sunder](https://github.com/sgsunder) * [Conny Rasch](https://github.com/CMR-DEV) * [Christopher Perrin](https://github.com/cperrin88) + * [Martin Bartsch](https://github.com/kaenguruhs) OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by [Daid Braam](https://github.com/daid). Parts of its communication layer and diff --git a/src/octoprint/server/util/sockjs.py b/src/octoprint/server/util/sockjs.py index 3140887d7..834bbb972 100644 --- a/src/octoprint/server/util/sockjs.py +++ b/src/octoprint/server/util/sockjs.py @@ -381,10 +381,12 @@ class PrinterStateConnection( self._subscriptions["plugins"] = plugins self._subscriptions["events"] = events - if state and not old_state: - # trigger initial data + if state and state != old_state: + # state is requested and was changed from previous state + # we should send a history message to send the update data self._printer.send_initial_callback(self) elif old_state and not state: + # we no longer should send state updates self._initial_data_sent = False def on_printer_send_current_data(self, data): diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 2be15d04e..d5b15aca3 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -36,6 +36,7 @@ from octoprint.util import ( TypeAlreadyInQueue, TypedQueue, chunks, + dict_merge, filter_non_ascii, filter_non_utf8, get_bom, @@ -1377,7 +1378,7 @@ class MachineCom: if len(retval) == 3: variables = retval[2] - context.update({"plugins": {name: variables}}) + context = dict_merge(context, {"plugins": {name: variables}}) template = settings().loadScript("gcode", scriptName, context=context) if template is None: