A simple plugin that adds a button to the navigation bar for toggling a HomeAssistant connected Light.
Code forked from OctoLight by gigibu5 with HA integration based on OctoPrint-PSUControl by kantlivelong
Install via the bundled Plugin Manager or manually using this URL:
https://github.com/mark-bloom/OctoLight_Home-Assistant/archive/master.zip
Alternatively:
- Download the repository code as a .zip
- In the plugin manager of OctoPrint, go to "Get More"
- Under "... from an uploaded file" select the .zip you downloaded to install.
Curently, you can configure 8 settings, including 4 configuration items:
-
Address
: The IP address or hostname of your HomeAssistant server. e.g. http://ip:port or http://hostname:port. Do not include a trailing slash / -
Access token
: The long-lived access token generated by HomeAssistant. -
Entity ID
: The Home Assistant ID of the entity you'd like to control. Currently must be a light device supporting the light/toggle action. -
Verify certificate
: Toggle on to verify TLS certificate and not connect on certificate issues (keep disabled if using http on local network).
-
Turn on light on print start
: Turn on the light when OctoPrint receives a "print started" message. -
Turn off light on print end
: Turn off the light when OctoPrint receives a "print complete" message. -
Turn off light on print failure
: Turn off the light when OctoPrint receives a "print failure" message. -
Turn off light on print cancellation
: Turn off the light when OctoPrint receives a "print cancellation" message.
UNTESTED in HA MOD
Base API URL : GET http://YOUR_OCTOPRINT_SERVER/api/plugin/octolight?action=ACTION_NAME
This API always returns updated light state in JSON: {state: true}
(if the action parameter not given, the action toggle will be used by default)
- toggle (default action): Toggle light switch on/off.
- turnOn: Turn on light.
- turnOff: Turn off light.
- getState: Get current light switch state.
- Update interface if Light is turned on or off
- Turn off on finish print (thank you Nick-Gatti)
Maybe in the distant future:
- Add light settings (e.g. brightness and colour) for turn on