Skip to content

Instantly share code, notes, and snippets.

@rasmi
Created December 6, 2025 17:37
Show Gist options
  • Select an option

  • Save rasmi/c67e33671fe40f073657e0f3b1c4bdc5 to your computer and use it in GitHub Desktop.

Select an option

Save rasmi/c67e33671fe40f073657e0f3b1c4bdc5 to your computer and use it in GitHub Desktop.
SureHub API Home Assistant
# /addons/surehub_api/config.yaml
name: "SureHub API"
slug: "surehub_api"
version: "1.0.0" # bump when you change Dockerfile or wrapper
description: "Expose the Sure Petcare cloud as a local REST API for Home Assistant."
url: "https://github.com/fabieu/sureflap-api"
arch:
- amd64
- armv7
- aarch64
startup: services # start before HA Core
boot: auto # start on every host boot
init: false # wrapper takes care of entry point
stage: stable
# ────────────────────────── Network ──────────────────────────
ports:
3001/tcp: 8080 # internal 3001 → host 8080 (change if needed)
ports_description:
3001/tcp: "REST API"
# ────────────────────────── User options ─────────────────────
options:
email: "" # Sure Petcare account e‑mail
password: "" # Sure Petcare password
loglevel: "info" # critical|error|warning|info|debug|trace
cors: ""
port: 3001
debug: false
schema:
email: str
password: str
loglevel: "match(critical|error|warning|info|debug|trace)"
cors: str
port: int
debug: bool
ARG BUILD_FROM=ghcr.io/home-assistant/amd64-base:latest
FROM fabieu/sureflap-api:latest
RUN apk add --no-cache jq
COPY run.sh /run.sh
RUN chmod +x /run.sh
ENTRYPOINT ["/bin/sh", "/run.sh"]
#!/usr/bin/with-contenv sh
set -e
# Read user options the Supervisor writes to /data/options.json
JSON=/data/options.json
EMAIL=$(jq -r '.email' "$JSON")
PASS=$(jq -r '.password' "$JSON")
LEVEL=$(jq -r '.loglevel' "$JSON")
CORS=$(jq -r '.cors // empty' "$JSON")
PORT=$(jq -r '.port' "$JSON")
DEBUG=$(jq -r '.debug // false' "$JSON")
export SUREHUB_EMAIL="$EMAIL"
export SUREHUB_PASSWORD="$PASS"
export SUREHUB_LOGLEVEL="$LEVEL"
export SUREHUB_CORS="$CORS"
export SUREHUB_PORT="$PORT"
export SUREHUB_DEBUG="$DEBUG"
exec python /usr/src/app/surehub_api/main.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment