Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6ffm70 patch 1 #5

Merged
merged 4 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions octoprint_signalclirestapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ def get_settings_defaults(self):
printfailedevent=True,
printcancelledevent=True,
printpausedevent=True,
filamentchangeevent=True,
printresumedevent=True,
printstartedeventtemplate="OctoPrint@{host}: {filename}: Job started.",
printdoneeventtemplate="OctoPrint@{host}: {filename}: Job complete after {elapsed_time}.",
printpausedeventtemplate="OctoPrint@{host}: {filename}: Job paused!",
filamentchangeeventtemplate="OctoPrint@{host}: Filament change required!",
printfailedeventtemplate="OctoPrint@{host}: {filename}: Job failed after {elapsed_time} ({reason})!",
printcancelledeventtemplate="OctoPrint@{host}: {filename}: Job cancelled after {elapsed_time}!",
printresumedeventtemplate="OctoPrint@{host}: {filename}: Job resumed!",
Expand Down Expand Up @@ -152,6 +154,10 @@ def print_failed_event(self):
def print_paused_event(self):
return self._settings.get_boolean(["printpausedevent"])

@property
def filament_change_event(self):
return self._settings.get_boolean(["filamentchangeevent"])

@property
def print_cancelled_event(self):
return self._settings.get_boolean(["printcancelledevent"])
Expand Down Expand Up @@ -183,6 +189,10 @@ def print_started_event_template(self):
@property
def print_paused_event_template(self):
return self._settings.get(["printpausedeventtemplate"])

@property
def filament_change_event_template(self):
return self._settings.get(["filamentchangeeventtemplate"])

@property
def print_cancelled_event_template(self):
Expand Down Expand Up @@ -307,6 +317,12 @@ def on_event(self, event, payload):
self._create_group_if_not_exists()
message = self.print_paused_event_template.format(**supported_tags)
self._send_message(message)
elif event == "FilamentChange":
if self.enabled and self.filament_change_event:
if self.create_group_for_every_print:
self._create_group_if_not_exists()
message = self.filament_change_event_template.format(**supported_tags)
self._send_message(message)
elif event == "PrintResumed":
if self.enabled and self.print_resumed_event:
if self.create_group_for_every_print:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,25 @@
</form>
<hr/>

<form class="form horizontal">
<div class="control-group">
<div class="control-group" title="{{ _('Filament Change') }}">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: settings.plugins.signalclirestapi.filamentchangeevent" /> {{ _('Filament Change') }}
</label>
</div>
</div>
<p>Supported Tags: <code>{user}</code>, <code>{host}</code></p>
<div class="control-group" title="{{ _('Body:') }}">
<label class="control-label">{{ _('Body:') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: settings.plugins.signalclirestapi.filamentchangeeventtemplate">
</div>
</div>
</div>
</form>
<hr/>

<form class="form horizontal">
<div class="control-group">
Expand Down