A modern web application for planning and importing shifts into Home Assistant calendars with an intuitive calendar interface and intelligent shift categorization.
- 📅 Interactive Calendar View - Visual shift planning with modern horizontal shift badges
- 👥 Multi-Person Support - Plan shifts for multiple people simultaneously
- 🎨 Intelligent Color Grouping - Automatic categorization into Morning, Day, Evening, Night, and Special shifts
- 🏷️ Manual Categorization - Define custom categories in JSON configuration for precise control
- 📋 Enhanced Shift Selection - Dropdown menus show shift times, duration, and color-coded options
- 🗂️ Grouped Legend - Organized shift legend with icons and categories for better overview
- 🎯 Flexible Shift Recognition - Supports both time-based and name-based shift categorization
- 🌙 Dark Theme - Modern dark interface for comfortable viewing
- 🔄 Real-time Updates - Shifts sync immediately with Home Assistant calendars
- 📱 Responsive Design - Works perfectly on desktop and tablet. Mobile devices (WIP)
- 🐳 Docker Ready - Easy deployment with Docker and Docker Compose
- Docker and Docker Compose installed
- Home Assistant instance with Long-Lived Access Token
- Calendar entities created in Home Assistant
-
Clone the repository
git clone https://github.com/panteLx/hass-shift-planner.git cd hass-shift-planner -
Configure environment variables
Create a
.envfile in the root directory:# Home Assistant Configuration HA_URL=http://homeassistant.local:8123 HA_TOKEN=your_long_lived_access_token_here CALENDAR_ENTITY_IDS={"Name 1":"calendar.name1","Name 2":"calendar.name2"} # Optional: Server Configuration (defaults shown) HOST=0.0.0.0 PORT=3000Environment Variables:
HA_URL: Your Home Assistant URLHA_TOKEN: Long-Lived Access Token from Home AssistantCALENDAR_ENTITY_IDS: JSON object mapping person names to calendar entity IDsHOST: Server host address (default: 0.0.0.0)PORT: Server port (default: 3000)
-
Configure shift types
Copy, edit and rename
shifts_config.json.exampletoshifts_config.jsonwith your shift times and categories:cp shifts_config.json.example shifts_config.json{ "sebastian": { "früh": { "start": "06:00:00", "end": "14:00:00", "category": "morning" }, "mittel": { "start": "10:00:00", "end": "18:00:00", "category": "day" }, "spät": { "start": "13:00:00", "end": "21:00:00", "category": "evening" }, "nacht": { "start": "20:45:00", "end": "23:59:00", "category": "night" }, "fortbildung": { "start": "08:00:00", "end": "16:00:00", "category": "special" } } }Categories:
morning🌅 - Morning shifts (green colors)day☀️ - Day shifts (blue colors)evening🌆 - Evening/late shifts (orange colors)night🌙 - Night shifts (purple colors)special⭐ - Special shifts like training, vacation (various colors)
-
Copy Docker Compose file
Copy the example Docker Compose file:
cp docker-compose-examples/docker-compose.yaml docker-compose.yaml -
Start the application
docker compose up -d -
Access the application
Open http://localhost:3000 in your browser
- Select a person from the dropdown menu
- Select a shift type from the available options
- Click on calendar days to add shifts
- Click again on a day to remove that specific shift
- Submit planned shifts to sync with Home Assistant
The application uses intelligent categorization with manual control:
Define categories in your shifts_config.json:
- 🌅 Morning shifts (
"category": "morning") - Green tones - ☀️ Day shifts (
"category": "day") - Blue tones - 🌆 Evening shifts (
"category": "evening") - Orange tones - 🌙 Night shifts (
"category": "night") - Purple tones - ⭐ Special shifts (
"category": "special") - Various colors for training, vacation, etc.
For shifts without manual categories, the system uses:
- Time-based detection - Categorizes by shift start times
- Keyword recognition - Recognizes common patterns like "früh", "spät", "nacht"
- Switch between people using the dropdown
- Previously planned shifts are preserved when switching
- Each person's shifts are displayed with their initials
- Multiple shifts can exist on the same day
# Start in background
docker compose up -d
# Start with rebuild
docker compose up --build
# Stop containers
docker compose down
# View logs
docker compose logs -f
# Restart
docker compose restart
Defines shift times, categories, and configurations for each person. Enhanced structure with manual categorization:
{
"PersonName": {
"ShiftType": {
"start": "HH:MM:SS",
"end": "HH:MM:SS",
"category": "morning|day|evening|night|special"
}
}
}
Example with complex shifts:
{
"lisa": {
"früh": {
"start": "07:45:00",
"end": "15:45:00",
"category": "morning"
},
"mittel-1": {
"start": "10:00:00",
"end": "18:00:00",
"category": "day"
},
"mittel-2": {
"start": "11:00:00",
"end": "19:00:00",
"category": "evening"
},
"spät-1": {
"start": "12:15:00",
"end": "20:10:00",
"category": "evening"
}
}
}
docker compose logs -f
docker logs hass-shift-planner
docker compose config
docker exec -it hass-shift-planner sh
Port already in use:
- Change
PORTin.envfile - Restart:
docker compose up -d
Calendar not updating:
- Verify
HA_TOKENis valid - Check
CALENDAR_ENTITY_IDSmatch your Home Assistant setup - Ensure calendar entities exist in Home Assistant
Configuration not loading:
- Verify
shifts_config.jsonis valid JSON - Check file permissions
- Restart container:
docker compose restart
-
Install dependencies:
npm install -
Create
.envfile with configuration -
Start development server:
npm start -
Access at http://localhost:3000
- Backend: Node.js, Express
- Frontend: Vanilla JavaScript, HTML5, CSS3
- UI/UX: Modern dark theme, responsive flexbox layouts, horizontal shift badges
- Data Management: JSON-based configuration with caching
- Container: Docker, Docker Compose
- Integration: Home Assistant REST API
MIT
Contributions are welcome! Please feel free to submit a Pull Request.