Octoprint Config Flow and sensors (#19854)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Ryan Fleming 2021-10-26 06:10:21 -04:00 committed by GitHub
parent 54bf52e7cd
commit d16418622e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 141 deletions

View File

@ -1,13 +1,17 @@
---
title: OctoPrint
description: Instructions on how to setup the OctoPrint in Home Assistant.
description: Integration between OctoPrint and Home Assistant.
ha_category:
- Hub
- Binary Sensor
- Sensor
ha_config_flow: true
ha_release: 0.19
ha_codeowners:
- '@rfleming71'
ha_iot_class: Local Polling
ha_domain: octoprint
ha_zeroconf: true
ha_ssdp: true
ha_platforms:
- binary_sensor
- sensor
@ -15,119 +19,30 @@ ha_platforms:
[OctoPrint](https://octoprint.org/) is a web interface for your 3D printer. This is the main integration to integrate OctoPrint sensors.
There is currently support for the following device types within Home Assistant:
{% include integrations/config_flow.md %}
- [Binary Sensor](#binary-sensor)
- [Sensor](#sensor)
### API Key
## Configuration
The Octoprint integration will attempt to register itself via the [application keys plugin](https://docs.octoprint.org/en/master/bundledplugins/appkeys.html). After submitting the configuration UI in Home Assistant, open the Octoprint UI and click allow on the prompt.
To get started with the OctoPrint API, please follow the directions on their [site](https://docs.octoprint.org/en/master/api/general.html). Once OctoPrint is configured you will need to add your API key and host to your `configuration.yaml`.
## Binary Sensor
```yaml
octoprint:
host: YOUR_OCTOPRINT_HOST
api_key: YOUR_API_KEY
```
The OctoPrint integration provides the following binary sensors:
{% configuration %}
host:
description: IP address or hostname of Octoprint host.
required: true
type: string
api_key:
description: The retrieved API key.
required: true
type: string
name:
description: The name for this printer, must be unique if multiple printers are defined.
required: false
type: string
default: OctoPrint
port:
description: The port of the Octoprint server.
required: false
type: integer
default: 80
path:
description: The URL path of the Octoprint instance.
required: false
type: string
default: /
ssl:
description: Enable or disable SSL/TLS.
required: false
type: boolean
default: false
bed:
description: If the printer has a heated bed.
required: false
type: boolean
default: false
number_of_tools:
description: Number of temperature adjustable tools, e.g., nozzle.
required: false
type: integer
default: 0
sensors:
description: Configuration for the sensors.
required: false
type: map
keys:
monitored_conditions:
description: The sensors to activate.
type: list
default: all (`Current State`, `Temperatures`, `Job Percentage`, `Time Elapsed`, `Time Remaining`)
keys:
"Current State":
description: Text of current state.
"Temperatures":
description: Temperatures of all available tools, e.g., `print`, `head`, `print bed`, etc. These will be displayed as `tool0`, `tool1`, or `toolN` please refer to your OctoPrint frontend to associate the tool number with an actual device.
"Job Percentage":
description: Percentage of the job.
"Time Elapsed":
description: Time elapsed on current print job, in seconds.
"Time Remaining":
description: Time remaining on current print job, in seconds.
binary_sensors:
description: Configuration for the binary sensors.
required: false
type: map
keys:
monitored_conditions:
description: The sensors to activate.
type: list
default: all (`Printing`, `Printing Error`)
keys:
"Printing":
description: State of the printer.
"Printing Error":
description: Error while printing.
{% endconfiguration %}
- Printing
- Print Error
<div class='note'>
## Sensor
If you are tracking temperature it is recommended to set `bed` and/or `number_of_tools` in your octoprint configuration. This will allow the octoprint sensors to load if the printer is offline during Home Assistant startup.
The OctoPrint integration lets you monitor various states of your 3D printer and its print jobs.
Supported sensors:
</div>
- Current Printer State
- Job Completed Percentage
- Estimated Finish Time
- Estimated Start Time
Example with multiple printers:
```yaml
octoprint:
- host: YOUR_OCTOPRINT_HOST
api_key: YOUR_API_KEY
name: PRINTER_NAME_1
number_of_tools: 2
sensors:
monitored_conditions:
- 'Current State'
- 'Job Percentage'
- host: YOUR_OCTOPRINT_HOST
api_key: YOUR_API_KEY
name: PRINTER_NAME_2
number_of_tools: 1
```
## Camera
If the OctoPrint host is equipped with a web camera it is possible to add this as well.
@ -138,38 +53,3 @@ camera:
still_image_url: http://YOUR_OCTOPRINT_HOST_IP/webcam/?action=snapshot
mjpeg_url: http://YOUR_OCTOPRINT_HOST_IP/webcam/?action=stream
```
## Binary Sensor
The `octoprint` binary sensor platform let you monitor if your 3D printer is printing or if there was a printing error.
To set it up, add the following information to your `configuration.yaml` file:
```yaml
binary_sensor:
- platform: octoprint
monitored_conditions:
- Printing
- Printing Error
```
{% configuration %}
monitored_conditions:
description: States to monitor.
required: true
type: list
keys:
printing:
description: State of the printer.
printing error:
description: Error while printing.
name:
description: The name of the sensor.
required: false
type: string
default: OctoPrint
{% endconfiguration %}
## Sensor
The `octoprint` sensor platform let you monitor various states of your 3D printer and its print jobs.

View File

@ -37,6 +37,7 @@ The following integrations are automatically discovered by the SSDP integration:
- [Keenetic NDMS2 Router](/integrations/keenetic_ndms2/)
- [Konnected.io](/integrations/konnected/)
- [Logitech Harmony](/integrations/harmony/)
- [OctoPrint](/integrations/octoprint/)
- [Philips Hue](/integrations/hue/)
- [Roku](/integrations/roku/)
- [Samsung SyncThru Printer](/integrations/syncthru/)