Guide: Alexa Octoprint Integration & Coaster 3d model
3dmdb logo
Thingiverse
Guide: Alexa Octoprint Integration & Coaster

Guide: Alexa Octoprint Integration & Coaster

by Thingiverse
Last crawled date: 4 years, 3 months ago
This write up is meant to serve as a guide for adding smart home controller support to a Raspberry Pi and integrating that support with Octoprint. This example details controlling the power for an Ender 3 but should be easily adaptable for other items like lights and fans.
What's with the Coaster?
A: It seemed morally wrong to click "Publish a Thing" but not have a thing.
Disclaimer
Please note this project will involve some basic electrical work and even though most of that should be low voltage DC you still need to be careful. If you are not comfortable with basic skills like soldering or reading a volt meter it might be a good time to stop.
Deliverables
When complete you will be able to turn your printer or lights on and off via both your smart home controller and the main Octoprint interface. Notifications will also 'push' to your smart home app.
TL,DR;


You'll be able to say Alexa, turn on my printer / Alexa turn off my printer lights / etc.
Example

This will also work via the Octoprint menu and push status notifications to your smart phone app. (1-5 second lag)






Write-up Structure

1. High level overview of how to configure your hardware.
2. Detailed write up of what scripts are needed how to integrate them with Octoprint and start everything at boot
3. Resources / AppendixHardware
Mounting
Mount your hardware as desired, personal recommendations listed below:
Raspberry Pi Mount]
Relay Mount
Buck Converter Mount
Wiring
Wire components as required. The relay will require a 5v supply, ground, and one control wire per actual relay. Be sure to note the pin(s) used for control as this will be required later.

Wire the PSU to the printer through the relay so that the circuit is only closed when the relay is powered.







Optional Buck Converter
Although the power requirements of the relay should be well within the capabilities of the Pi it's best practice to power the relay via the buck converter if equipped.
Wiring the buck converter directly to the printers PSU will also eliminate some wires keeping wire clutter to a minimum.
Software
Overview
Low level instructions for installation and configuration of the scripts required to make this work are detailed on the git hub page

Below is a quick high level overview of the scripts involved and what each does.

Relay Scripts

Two scripts are involved in controlling power to the printer. One script controls only the relay and the other serves as the controller handling additional logic like shutting off power to the USB ports in order to prevent powering the motherboard LCD while the relay is off.

* powerPrinter.py (maps to relay and controls cycling)
* powerPrinter (controller with additional logic)

Octoprint Registration

Register the powerPrinter script with the Octoprint config.yaml

Emmulation

The third script emulates a Belkin Wemo smart plug and interacts with the smart home controller. This script calls the control script mentioned above.

* fauxMo.js

This script can emulate several devices at once and can be configured as needed.

Boot

The fourth script is really just a cron job that ensures the emulation script is started at boot.

Resources

Git Hub Library (this writeup)https://github.com/NHiggs/OctoFauxmo

Git Hub (node-fauxmo)https://github.com/lspiehler/node-fauxmo#readme


Notes
Feedback and input on improving this write-up welcome.

Tags