Skip to content

Commit

Permalink
[MERGE] Merge branch 'printoid'
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyst91 committed Apr 26, 2020
2 parents bb13222 + 09fa4ed commit f0353fe
Show file tree
Hide file tree
Showing 20 changed files with 160 additions and 225 deletions.
4 changes: 2 additions & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# These are supported funding model platforms

github: gdombiak # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
github: anthonyst91
patreon: https://www.patreon.com/printoid
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
Expand Down
6 changes: 3 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include README.md
recursive-include octoprint_octopod/templates *
recursive-include octoprint_octopod/translations *
recursive-include octoprint_octopod/static *
recursive-include octoprint_printoid/templates *
recursive-include octoprint_printoid/translations *
recursive-include octoprint_printoid/static *
63 changes: 11 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# OctoPrint-OctoPod
# OctoPrint-Printoid

[![Version](https://img.shields.io/badge/dynamic/json.svg?color=brightgreen&label=version&url=https://api.github.com/repos/gdombiak/OctoPrint-OctoPod/releases&query=$[0].name)]()
[![Released](https://img.shields.io/badge/dynamic/json.svg?color=brightgreen&label=released&url=https://api.github.com/repos/gdombiak/OctoPrint-OctoPod/releases&query=$[0].published_at)]()
[![Version](https://img.shields.io/badge/dynamic/json.svg?color=brightgreen&label=version&url=https://api.github.com/repos/anthonyst91/OctoPrint-Printoid/releases&query=$[0].name)]()
[![Released](https://img.shields.io/badge/dynamic/json.svg?color=brightgreen&label=released&url=https://api.github.com/repos/anthonyst91/OctoPrint-Printoid/releases&query=$[0].published_at)]()

This plugin sends immediate push notifications to your iOS devices running
[OctoPod](https://itunes.apple.com/us/app/octopod-for-octoprint/id1412557625?mt=8) once a
This plugin sends immediate push notifications to your Android devices running
[Printoid for OctoPrint](https://play.google.com/store/apps/details?id=fr.yochi76.printoid.phones.premium&utm_source=github&utm_medium=plugin) once a
print has finished, made certain print progress, reached specified layers, bed reached target temp,
bed cooled down or MMU requires user assistance. Push notifications when print is finished
include a snapshot of the configured camera. If you have multiple cameras then you can include
a snapshot of any of them. Even if the cameras are not connected to OctoPrint you can still
include a snapshot of the camera.

It is based on the great plugin made by the developer of OctoPod of iOS:
[OctoPod](https://itunes.apple.com/us/app/octopod-for-octoprint/id1412557625?mt=8)
[OctoPrint-OctopPod plugin](https://github.com/gdombiak/OctoPrint-OctoPod)

This is the complete list of supported notifications:
1. Print finished (includes camera snapshot) or at specific progress percentages
1. Print reached specified layers (requires [DisplayLayerProgress plugin](https://plugins.octoprint.org/plugins/DisplayLayerProgress/))
Expand All @@ -27,58 +31,13 @@ This is the complete list of supported notifications:
Install via the bundled [Plugin Manager](https://github.com/foosel/OctoPrint/wiki/Plugin:-Plugin-Manager)
or manually using this URL:

https://github.com/gdombiak/OctoPrint-OctoPod/archive/master.zip
https://github.com/anthonyst91/OctoPrint-Printoid/archive/master.zip

## Configuration

Once plugin has been installed, go to _Settings_ and under _Plugins_ you will find a new
entry _OctoPod Notifications_. You must complete the field _Notification Server URL_ (use
entry _Printoid Notifications_. You must complete the field _Notification Server URL_ (use
default value) and optionally complete the field _Snapshot URL_ if you want a snapshot in
the notification. Update Bed, MMU and other notifications as needed.

You can test the configuration before saving it by using the _Send test notification_ button.

## Changelog

**[0.2.5]** (03/21/2020)
- Print notifications can be configured to be sent at different progress percentages
- Added new notification when print reaches specified layers (requires [DisplayLayerProgress plugin](https://plugins.octoprint.org/plugins/DisplayLayerProgress/) and OctoPod 3.2 or later)
- Added Russian translation. Thanks Alexey Tsykov

**[0.2.4]** (12/05/2019)
- Plugin is now compatible with upcoming OctoPrint 1.4.0 and Python 3

**[0.2.3]** (10/19/2019)
- Added French translation. Thanks Sébastien Laading

**[0.2.2]** (08/23/2019)
- Send notification when Palette 2 encountered a problem while printing
- (bug fix) Fixed HTML warning since 2 elements share the same id

**[0.2.1]** (08/03/2019)
- Send notification when extruder (tool0) cooled down below threshold once print finished
- Added Swedish translation. Thanks Jonas Bohdén

**[0.2.0]** (06/30/2019)
- Send notification when printer paused for user
- Send notification for firmware errors (e.g. runaway temp, min temp error, max temp error, probing failed, etc.)
- Send notification when OctoPrint lost connection to printer
- Notifications are now displayed even if the iOS app was killed by user
- (bug fix) Not all iOS devices were receiving bed or MMU events
- (bug fix) Sometimes Print Finished notification is displayed twice
- (bug fix) Log level is not restored after a restart

**[0.1.3]** (06/16/2019)
- Send MMU Notification when user assistance is required. Requires Prusa firmware.

**[0.1.2]** (05/28/2019)
- Initial Release

[0.2.5]: https://github.com/gdombiak/OctoPrint-OctoPod/tree/0.2.5
[0.2.4]: https://github.com/gdombiak/OctoPrint-OctoPod/tree/0.2.4
[0.2.3]: https://github.com/gdombiak/OctoPrint-OctoPod/tree/0.2.3
[0.2.2]: https://github.com/gdombiak/OctoPrint-OctoPod/tree/0.2.2
[0.2.1]: https://github.com/gdombiak/OctoPrint-OctoPod/tree/0.2.1
[0.2.0]: https://github.com/gdombiak/OctoPrint-OctoPod/tree/0.2.0
[0.1.3]: https://github.com/gdombiak/OctoPrint-OctoPod/tree/0.1.3
[0.1.2]: https://github.com/gdombiak/OctoPrint-OctoPod/tree/0.1.2
2 changes: 1 addition & 1 deletion extras/README.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Currently Cookiecutter generates the following helpful extras to this folder:

octopod.md
printoid.md
Data file for plugins.octoprint.org. Fill in the missing TODOs once your
plugin is ready for release and file a PR as described at
http://plugins.octoprint.org/help/registering/ to get it published.
Expand Down
82 changes: 0 additions & 82 deletions extras/octopod.md

This file was deleted.

74 changes: 74 additions & 0 deletions extras/printoid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
layout: plugin

id: printoid
title: OctoPrint-Printoid
description: OctoPrint plugin for Printoid
author: Anthony Stéphan
license: Apache-2.0

date: 2020-04-25

homepage: https://github.com/anthonyst91/OctoPrint-Printoid
source: https://github.com/anthonyst91/OctoPrint-Printoid
archive: https://github.com/anthonyst91/OctoPrint-Printoid/archive/master.zip

# TODO
# Set this to true if your plugin uses the dependency_links setup parameter to include
# library versions not yet published on PyPi. SHOULD ONLY BE USED IF THERE IS NO OTHER OPTION!
#follow_dependency_links: false

# TODO
tags:
- printoid
- bed temperature
- print finished
- Android
- notifications

# TODO
screenshots:
- url: /assets/img/plugins/printoid/settings.png
alt: Configure Notifications
caption: Configure Notifications
- url: /assets/img/plugins/printoid/print_finished.jpg
alt: Print Finished
caption: Print Finished
- url: /assets/img/plugins/printoid/bed_cooled.jpg
alt: Bed Cooled Down
caption: Bed Cooled Down

# TODO
featuredimage: /assets/img/plugins/printoid/print_finished.jpg

---

This plugin sends immediate push notifications to your Android devices when:
* your print has finished. Notifications include a snapshot of your camera. If you
have multiple cameras then you can include a snapshot of any of them. Even if the
cameras are not connected to OctoPrint you can still make use of them
* bed has cooled down enough so you can remove your print
* bed has warmed up to target temperature for a specified period so you can start
printing knowing that bed's material won't expand anymore

If you are using [Printoid](https://play.google.com/store/apps/details?id=fr.yochi76.printoid.phones.premium)
to control your printer from any Android device then this plugin is a great addition.

This plugin is based on the plugin made by the developer of [OctoPod](https://itunes.apple.com/us/app/octopod-for-octoprint/id1412557625?mt=8)


## Installation

Installation is super easy. There is no need to change your router configuration, do
port forwarding or open holes in your firewall. Just follow these steps and you will
be up and running in no time.

1. Download and install this plugin as you would do with any other OctoPrint plugin
1. Download [Printoid](https://play.google.com/store/apps/details?id=fr.yochi76.printoid.phones.premium) from the App Store
1. Start [Printoid](https://play.google.com/store/apps/details?id=fr.yochi76.printoid.phones.premium) so
it can receive notifications. This step is required for testing the plugin
1. Go to OctoPrint settings and configure this plugin
* If needed, update _Snapshot URL_ to point to the camera that will provide an image when your print is finished
* Click on _Send test notification_ to confirm setup is operational
* Configure _Bed Notifications_ to receive cooled down or warm up bed events
* Save settings and enjoy
36 changes: 18 additions & 18 deletions octoprint_octopod/__init__.py → octoprint_printoid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
from .layer_notifications import LayerNotifications


# Plugin that stores APNS tokens reported from iOS devices to know which iOS devices to alert
# Plugin that stores APNS tokens reported from Android devices to know which Android devices to alert
# when print is done or other relevant events

class OctopodPlugin(octoprint.plugin.SettingsPlugin,
class PrintoidPlugin(octoprint.plugin.SettingsPlugin,
octoprint.plugin.AssetPlugin,
octoprint.plugin.TemplatePlugin,
octoprint.plugin.StartupPlugin,
Expand All @@ -31,8 +31,8 @@ class OctopodPlugin(octoprint.plugin.SettingsPlugin,
octoprint.plugin.ProgressPlugin):

def __init__(self):
super(OctopodPlugin, self).__init__()
self._logger = logging.getLogger("octoprint.plugins.octopod")
super(PrintoidPlugin, self).__init__()
self._logger = logging.getLogger("octoprint.plugins.printoid")
self._checkTempTimer = None
self._job_notifications = JobNotifications(self._logger)
self._tool_notifications = ToolsNotifications(self._logger)
Expand All @@ -45,7 +45,7 @@ def __init__(self):
# StartupPlugin mixin

def on_after_startup(self):
self._logger.info("OctoPod loaded!")
self._logger.info("Printoid loaded!")
# Set logging level to what we have in the settings
if self._settings.get_boolean(["debug_logging"]):
self._logger.setLevel(logging.DEBUG)
Expand All @@ -63,7 +63,7 @@ def on_after_startup(self):
def get_settings_defaults(self):
return dict(
debug_logging=False,
server_url='http://octopodprint.com/',
server_url='https://fcm.googleapis.com/fcm/send',
camera_snapshot_url='http://localhost:8080/?action=snapshot',
tokens=[],
temp_interval=5,
Expand Down Expand Up @@ -123,8 +123,8 @@ def get_assets(self):
# Define your plugin's asset files to automatically include in the
# core UI here.
return dict(
js=["js/octopod.js"],
css=["css/octopod.css"],
js=["js/printoid.js"],
css=["css/printoid.css"],
)

# ProgressPlugin
Expand Down Expand Up @@ -175,12 +175,12 @@ def update_token(self, old_token, new_token, device_name, printer_id, printer_na

if found:
if printer_name is not None and ("printerName" not in token or token["printerName"] != printer_name):
# Printer name in OctoPod has been updated
# Printer name in Printoid has been updated
token["printerName"] = printer_name
token["date"] = datetime.datetime.now()
updated = True
if language_code is not None and ("languageCode" not in token or token["languageCode"] != language_code):
# Language being used by OctoPod has been updated
# Language being used by Printoid has been updated
token["languageCode"] = language_code
token["date"] = datetime.datetime.now()
updated = True
Expand Down Expand Up @@ -242,7 +242,7 @@ def on_api_command(self, command, data):

def get_template_configs(self):
return [
dict(type="settings", name="OctoPod Notifications", custom_bindings=True)
dict(type="settings", name="Printoid Notifications", custom_bindings=True)
]

# Softwareupdate hook
Expand All @@ -252,18 +252,18 @@ def get_update_information(self):
# Plugin here. See https://github.com/foosel/OctoPrint/wiki/Plugin:-Software-Update
# for details.
return dict(
octopod=dict(
displayName="OctoPod Plugin",
printoid=dict(
displayName="Printoid Plugin",
displayVersion=self._plugin_version,

# version check: github repository
type="github_release",
user="gdombiak",
repo="OctoPrint-OctoPod",
user="anthonyst91",
repo="OctoPrint-Printoid",
current=self._plugin_version,

# update method: pip
pip="https://github.com/gdombiak/OctoPrint-OctoPod/archive/{target_version}.zip"
pip="https://github.com/anthonyst91/OctoPrint-Printoid/archive/{target_version}.zip"
)
)

Expand Down Expand Up @@ -302,12 +302,12 @@ def process_gcode(self, comm, line, *args, **kwargs):
# If you want your plugin to be registered within OctoPrint under a different name than what you defined in setup.py
# ("OctoPrint-PluginSkeleton"), you may define that here. Same goes for the other metadata derived from setup.py that
# can be overwritten via __plugin_xyz__ control properties. See the documentation for that.
__plugin_name__ = "OctoPod Plugin"
__plugin_name__ = "Printoid Plugin"
__plugin_pythoncompat__ = ">=2.7,<4"

def __plugin_load__():
global __plugin_implementation__
__plugin_implementation__ = OctopodPlugin()
__plugin_implementation__ = PrintoidPlugin()

global __plugin_hooks__
__plugin_hooks__ = {
Expand Down
3 changes: 0 additions & 3 deletions octoprint_octopod/alerts.py → octoprint_printoid/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ def send_alert(self, apns_token, url, printer_name, message, category, image):
self._logger.warn("Could not send message: %s" % str(e))
return -500

# Silent notifications. Legacy mode uses them and also to ask OctoPod app to update
# complications of Apple Watch

def send_job_request(self, apns_token, image, printer_id, printer_state, completion, url, test=False):
data = {"tokens": [apns_token], "printerID": printer_id, "printerState": printer_state, "silent": True,
"useDev": self._use_dev}
Expand Down
Loading

0 comments on commit f0353fe

Please sign in to comment.