Skip to content

nobodyguy/obico_ml_ha_integration

Repository files navigation

Obico ML Home Assistant Integration

hacs_badge

HA Integration for Obico ML REST API server addon. This integration allows you to turn any HA Camera entity into a source for Obico's AI 3D printing failure detection.

Features

  • Automatically detects 3D printing errors by periodically sending camera images to an external detection backend.
  • Configurable detection interval, threshold, and camera entity.
  • Provides three Home Assistant entities:
    • Camera: Displays the image with detected errors.
    • Binary Sensor: Indicates whether any errors have been detected.
    • Sensor: Indicates detected failure confidence.
    • Switch: Toggles communication with the detection API.

Installation

  1. Install HACS (Home Assistant Community Store) if you haven't already.
  2. Add this repository to HACS as a custom repository:
    • Go to HACS > Integrations.
    • Click on the three dots in the upper-right corner and select Custom repositories.
    • Enter the URL: https://github.com/nobodyguy/obico_ml_ha_integration.
    • Choose Integration as the category.
  3. Search for Obico ML in HACS and install the integration.
  4. Restart Home Assistant.

Alternatively, you can manually copy the obico_ml_ha_integration folder to your custom_components directory.

Configuration

To configure the integration:

  1. Go to Configuration > Integrations in Home Assistant.
  2. Click on the Add Integration button.
  3. Search for Obico ML and click on it to configure.
  4. Fill in the configuration parameters.

Configuration Options

  • API URL: The URL of the detection backend.
  • Camera Entity: The camera entity used to capture images for error detection.
  • Detection Interval: The interval (in seconds) between detection API calls.
  • Detection Threshold: Optional. The threshold for error detection sensitivity.

Provided Entities

Camera

Displays the image with detected 3D printing errors. This camera entity updates periodically based on the detection interval.

Binary Sensor

A binary sensor that indicates whether any errors have been detected. If errors are found in the image, the sensor will show on, otherwise off.

Sensor

A numeric sensor that indicates detected failure confidence.

Switch

Allows you to enable or disable the periodic communication with the detection API to save HW resources. When switched off, error detection is paused.

Example Usage

# Example automation for detecting 3D printing failures
automation:
  - alias: "Toggle Obico ML Detection based on Printer State"
    trigger:
      - platform: state
        entity_id: sensor.prusalink
    action:
      - choose:
          - conditions:
              - condition: state
                entity_id: sensor.prusalink
                state: "printing"
            sequence:
              - service: switch.turn_on
                target:
                  entity_id: switch.obico_ml_communication
          - conditions:
              - condition: not
                conditions:
                  - condition: state
                    entity_id: sensor.prusalink
                    state: "printing"
            sequence:
              - service: switch.turn_off
                target:
                  entity_id: switch.obico_ml_communication
  - alias: "Notify on 3D printing failure"
    trigger:
      - platform: state
        entity_id: binary_sensor.obico_ml_failure_detected
        to: "on"
    action:
      - service: notify.notify
        data:
          message: "3D printing failure detected!"
          data:
            image: /api/camera_proxy/camera.obico_ml_detection_camera

Troubleshooting

If you encounter issues with the integration, check the Home Assistant logs for error messages. Common issues include:

  • Camera entity not found: Ensure that the camera entity you configured is available and working.
  • API communication issues: Verify that the detection backend is running and reachable by Home Assistant.

Issues

If you encounter any issues or have feature requests, please open an issue on the GitHub repository.

Contributing

Contributions are welcome! Please open a pull request with any changes or improvements.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

TODO

About

HA Integration for Obico ML REST API server

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages