Skip to content

sHedC/homeassistant-leakbot

Repository files navigation

Leakbot

License Project Maintenance GitHub Activity

Discord Community Forum Leakbot Forum BuyMeCoffee

Stable - GitHub Release workflow-release codecov

Latest - GitHub Release workflow-lastest issues

Please Read

⚠️ Leakbot Only Allows One Login:: If you use this integration the token your mobile app is connected to becomes invalid and you get logged out. This happens also if you re-log back into the app it invalidates the token for the integration, however the integration should automatically re-authenticate.

About the Integration

leakbot

An integration for homeassistant (via HACS) to connect to Leakbot via the leakbot cloud api.

NOTES:

  • The integration updates every four hours at this time, it is not currently changable. I only see the the device connecting once or twice a day, not sure how long it takes to detect a leak or what it does.
  • There are three sensors: battery status, leak status and leak free days. There is also a device tracker but might remove that as seems pointless.
  • For some reason leak free days is showing in the UI hours, not sure why as its setup in days.
  • Some translation is done as don't know what other options there are, example goodbattery not seen other states to setup.
  • Diagnotic download is not yet available.

Installation

The preferred and easiest way to install this is from the Home Assistant Community Store (HACS). Follow the link in the badge above for details on HACS.

Go to HACS and integraitons, then select to download Leakbot from HACS.

Configuration

Go to the Home Assistant UI, go to "Configuration" -> "Integrations" click "+" and search for "Leakbot" follow the configuration screen.

Beta Versions

If you want to see Beta versions open the Leakbot in HACS, after download, and click the three dots on the top right and select re-download. Here you will se an option to see beta versions.

Debugging

It is possible to show the info and debug logs for the Leakbot integration, to do this you need to enable logging in the configuration.yaml, example below:

Logs do not remove sensitive information so careful what you share, check what you are about to share and blank identifying information. Note the diagnostic info attempts to redact sensitive information.

logger:
  default: warning
  logs:
    # Log for Leakbot
    custom_components.leakbot: info

Manual Install

To install manually, if you really want to: I won't support this.

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called leakbot.
  4. Download all the files from the custom_components/leakbot/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant
  7. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Leakbot"

Development Environment

I have set this up to be able to run development or testing using Visual Studio Code with Docker or Podman in line with the integration blueprint.

To setup just copy the .devcontainer-template.json to .devcontainer.json

If using podman uncomment the section runArgs to avoid permission issues. Update BUILD_TYPE to "run" to run an instance of Home Assistant and "dev" to do development with pytest.

Debugging in Pythong 3.12 seems slow to startup: To enable vscode debugging a sample /.vscode/launch.json is:

{
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      // Example of Debugging Tests.
      "name": "Python: Debug Tests",
      "type": "debugpy",
      "request": "launch",
      "program": "${file}",
      "purpose": [
        "debug-test"
      ],
      "console": "integratedTerminal",
      "justMyCode": true,
      "env": {
        "PYTEST_ADDOPTS": "--no-cov"
      }
    },
    {
      // Example of attaching to local debug server
      "name": "Python: Attach Local",
      "type": "debugpy",
      "request": "attach",
      "connect": {
        "host": "localhost",
        "port": 5678
      },
      "pathMappings": [
        {
          "localRoot": "${workspaceFolder}",
          "remoteRoot": "."
        }
      ],
    }
  ]
}

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines

Or just raise a feature request, would be useful to have a use-case, what system you have and what you want to get done.