98 lines
2.4 KiB
Markdown
98 lines
2.4 KiB
Markdown
# Simple Home Assistant Addon
|
|
|
|
This is a simple Home Assistant addon that demonstrates the basic structure and functionality of a Home Assistant addon with a web interface.
|
|
|
|
## Features
|
|
|
|
- Basic addon structure
|
|
- Service registration
|
|
- Logging capabilities
|
|
- Python-based implementation
|
|
- Web interface for interaction
|
|
- API endpoints for status and messaging
|
|
|
|
## Installation
|
|
|
|
### Method 1: Local Development
|
|
|
|
1. Build the Docker image:
|
|
```bash
|
|
docker build -t simple-addon .
|
|
```
|
|
|
|
2. Push the image to your container registry
|
|
|
|
3. Add the addon to your Home Assistant instance through the Supervisor interface
|
|
|
|
### Method 2: Home Assistant Add-on Store
|
|
|
|
1. Add this repository URL to your Home Assistant add-on store:
|
|
- Navigate to Settings → Add-ons → Add-on Store
|
|
- Click the three dots in the top right corner
|
|
- Select "Repositories"
|
|
- Add the URL of this repository
|
|
|
|
2. Find the "Simple Addon" in the add-on store and click install
|
|
|
|
## Configuration
|
|
|
|
The addon can be configured through the Home Assistant Supervisor interface. Available options:
|
|
|
|
- `message`: Default message to display (default: "Hello from Home Assistant!")
|
|
|
|
## Usage
|
|
|
|
### Web Interface
|
|
|
|
The addon provides a web interface accessible through:
|
|
|
|
- Home Assistant sidebar (the addon adds an icon to the sidebar)
|
|
- Direct URL: `http://your-home-assistant:8099/addon/`
|
|
|
|
The web interface allows you to:
|
|
- Check the addon status
|
|
- Send messages to Home Assistant
|
|
- View activity logs
|
|
|
|
### Service Calls
|
|
|
|
You can also use the addon's services through Home Assistant's service calls:
|
|
|
|
```yaml
|
|
service: simple_addon.hello
|
|
data:
|
|
message: "Hello from Home Assistant!"
|
|
```
|
|
|
|
### API Endpoints
|
|
|
|
The addon exposes the following API endpoints:
|
|
|
|
- `GET /api/status` - Get the current status of the addon
|
|
- `POST /api/message` - Send a message to the addon
|
|
|
|
## Development
|
|
|
|
To develop this addon, you'll need:
|
|
- Docker
|
|
- Python 3.8+
|
|
- Home Assistant development environment
|
|
|
|
### Project Structure
|
|
|
|
```
|
|
/
|
|
├── config.yaml # Addon configuration
|
|
├── Dockerfile # Docker build instructions
|
|
├── main.py # Main Python code
|
|
├── README.md # Documentation
|
|
└── web/ # Web interface files
|
|
├── index.html # HTML interface
|
|
├── styles.css # CSS styling
|
|
└── script.js # JavaScript for interactivity
|
|
```
|
|
|
|
## License
|
|
|
|
MIT License
|