Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
miaucl committed Aug 23, 2024
1 parent 4be168d commit a8ae81f
Show file tree
Hide file tree
Showing 15 changed files with 359 additions and 57 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build documentation

on:
push:
branches:
- master

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

# Default to bash
defaults:
run:
shell: bash

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: Build
run: mkdocs build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./site

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
docker-compose.dev.yaml
.venv
.mypy_cache
.ruff_cache
.ruff_cache
site
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ You can use environment variables to control the behavior.

## Consuming The Data

Data is published to the topic `docker/<DOCKER2MQTT_HOSTNAME>/<container>/events` using JSON serialization. It will arrive whenever a change happens and its type can be inspected in [types.py](./src/types.py).
Data is published to the topic `docker/<DOCKER2MQTT_HOSTNAME>/<container>/events` using JSON serialization. It will arrive whenever a change happens and its type can be inspected in [type_definitions.py](./docker2mqtt/type_definitions.py) or the documentation.

Data is also published to the topic `docker/<DOCKER2MQTT_HOSTNAME>/<container>/stats` using JSON serialization. It will arrive every `STATS_RECORD_SECONDS` seconds or so can be inspected in [types.py](./src/types.py).
Data is also published to the topic `docker/<DOCKER2MQTT_HOSTNAME>/<container>/stats` using JSON serialization. It will arrive every `STATS_RECORD_SECONDS` seconds or so can be inspected in [type_definitions.py](./docker2mqtt/type_definitions.py) or the documentation.

## Home Assistant

After you start the service binary sensors should show up in Home Assistant immediately. Look for sensors that start with `binary_sensor.docker`. Metadata about the container will be available as attributes, which you can then expose using template sensors if you wish.

![Screenshot of Home Assistant sensor showing status and attributes.](docs/ha_screenshot.png)
![Screenshot of Home Assistant sensor showing status and attributes.](./media/ha_screenshot.png)

## Dev

Expand Down
4 changes: 3 additions & 1 deletion docker2mqtt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

__VERSION__ = "2.0.0-rc.0"


from .const import (
ANSI_ESCAPE,
DESTROYED_CONTAINER_TTL_DEFAULT,
Expand All @@ -26,6 +25,7 @@
WATCHED_EVENTS,
)
from .docker2mqtt import DEFAULT_CONFIG, Docker2Mqtt
from .exceptions import Docker2MqttEventsException, Docker2MqttStatsException
from .type_definitions import (
ContainerDeviceEntry,
ContainerEntry,
Expand Down Expand Up @@ -68,4 +68,6 @@
"ANSI_ESCAPE",
"STATS_REGISTRATION_ENTRIES",
"DEFAULT_CONFIG",
"Docker2MqttEventsException",
"Docker2MqttStatsException",
]
1 change: 1 addition & 0 deletions docker2mqtt/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@
docker2mqtt.loop_busy()

except Exception as ex:
main_logger.info("Error occurred, printing relevant information and exiting...")
main_logger.error("Error processing: %s", str(ex))
print(ex)
Loading

0 comments on commit a8ae81f

Please sign in to comment.